changeset 19584:f69e7fb8a449

pidgin_conversations_fill_menu now also adds a separator and a 'Show All' item if there are more than one conversations in the list. Does this break backward compatibility?
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Mon, 03 Sep 2007 02:36:46 +0000
parents 87e9d418cbf6
children 7f7f2f4806d9
files ChangeLog.API pidgin/gtkconv.c
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Sun Sep 02 21:20:32 2007 +0000
+++ b/ChangeLog.API	Mon Sep 03 02:36:46 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	Sun Sep 02 21:20:32 2007 +0000
+++ b/pidgin/gtkconv.c	Mon Sep 03 02:36:46 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;
 }