changeset 19585:7f7f2f4806d9

merge of 'e227a655c6a9f079748dafa19d46fcb9d99bf20a' and 'f049878920b7b8305fe3d05b429899d96ace0742'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 03 Sep 2007 02:43:43 +0000
parents d4fb44035799 (current diff) f69e7fb8a449 (diff)
children c3259b161070
files pidgin/gtkconv.c
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Mon Sep 03 02:19:23 2007 +0000
+++ b/ChangeLog.API	Mon Sep 03 02:43:43 2007 +0000
@@ -14,6 +14,10 @@
 		  The UI no longer needs to call it.
 
 	Pidgin:
+		Changed:
+		* pidgin_conversations_fill_menu now also adds a separator and a 'Show
+		  All' item if there are more than one conversations in the list.
+
 		Added:
 		* pidgin_set_accessible_relations, sets up label-for and labelled-by
 		  ATK relations (broken out from pidgin_set_accessible_label)
--- a/pidgin/gtkconv.c	Mon Sep 03 02:19:23 2007 +0000
+++ b/pidgin/gtkconv.c	Mon Sep 03 02:43:43 2007 +0000
@@ -2768,6 +2768,18 @@
 	pidgin_conv_present_conversation(conv);
 }
 
+static void
+unseen_all_conv_menu_cb(GtkMenuItem *item, GList *list)
+{
+	g_return_if_fail(list != NULL);
+	/* Do not free the list from here. It will be freed from the
+	 * 'destroy' callback on the menuitem. */
+	while (list) {
+		pidgin_conv_present_conversation(list->data);
+		list = list->next;
+	}
+}
+
 guint
 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs)
 {
@@ -2799,6 +2811,19 @@
 		ret++;
 	}
 
+	if (convs->next) {
+		/* There are more than one conversation. Add an option to show all conversations. */
+		GtkWidget *item;
+		GList *list = g_list_copy(convs);
+
+		pidgin_separator(menu);
+
+		item = gtk_menu_item_new_with_label(_("Show All"));
+		g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(unseen_all_conv_menu_cb), list);
+		g_signal_connect_swapped(G_OBJECT(item), "destroy", G_CALLBACK(g_list_free), list);
+		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
+	}
+
 	return ret;
 }