changeset 14493:5ac8f22e7b08

[gaim-migrate @ 17212] Update the statuslist with appropriate list of stauses in the buddylist when global status is changed. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 10 Sep 2006 00:17:44 +0000
parents a85299caf0c3
children 0aa6adcdd819
files console/gntblist.c console/libgnt/gntcombobox.c console/libgnt/gntcombobox.h console/libgnt/gntmain.c
diffstat 4 files changed, 23 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntblist.c	Sat Sep 09 21:58:04 2006 +0000
+++ b/console/gntblist.c	Sun Sep 10 00:17:44 2006 +0000
@@ -1317,6 +1317,8 @@
 	GaimStatusPrimitive prims[] = {GAIM_STATUS_AVAILABLE, GAIM_STATUS_AWAY,
 			GAIM_STATUS_INVISIBLE, GAIM_STATUS_OFFLINE, GAIM_STATUS_UNSET};
 
+	gnt_combo_box_remove_all(GNT_COMBO_BOX(ggblist->status));
+
 	for (i = 0; prims[i] != GAIM_STATUS_UNSET; i++)
 	{
 		item = g_new0(StatusBoxItem, 1);
@@ -1492,7 +1494,6 @@
 static void
 savedstatus_changed(GaimSavedStatus *now, GaimSavedStatus *old)
 {
-	/* Block the signals we don't want to emit */
 	GList *list;
 	GaimStatusPrimitive prim;
 	const char *message;
@@ -1500,6 +1501,7 @@
 	if (!ggblist)
 		return;
 
+	/* Block the signals we don't want to emit */
 	g_signal_handlers_block_matched(ggblist->status, G_SIGNAL_MATCH_FUNC,
 			0, 0, NULL, status_selection_changed, NULL);
 	g_signal_handlers_block_matched(ggblist->statustext, G_SIGNAL_MATCH_FUNC,
@@ -1508,6 +1510,9 @@
 	prim = gaim_savedstatus_get_type(now);
 	message = gaim_savedstatus_get_message(now);
 
+	/* Rebuild the status dropdown */
+	populate_status_dropdown();
+
 	list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses");
 	for (; list; list = list->next)
 	{
@@ -1610,8 +1615,6 @@
 	ggblist->statustext = gnt_entry_new(NULL);
 	gnt_box_add_widget(GNT_BOX(ggblist->window), ggblist->statustext);
 
-	populate_status_dropdown();
-
 	gnt_widget_show(ggblist->window);
 
 	gaim_signal_connect(gaim_blist_get_handle(), "buddy-status-changed", gg_blist_get_handle(),
--- a/console/libgnt/gntcombobox.c	Sat Sep 09 21:58:04 2006 +0000
+++ b/console/libgnt/gntcombobox.c	Sun Sep 10 00:17:44 2006 +0000
@@ -287,3 +287,16 @@
 	set_selection(box, key);
 }
 
+void gnt_combo_box_remove(GntComboBox *box, gpointer key)
+{
+	gnt_tree_remove(GNT_TREE(box->dropdown), key);
+	if (box->selected == key)
+		set_selection(box, NULL);
+}
+
+void gnt_combo_box_remove_all(GntComboBox *box)
+{
+	gnt_tree_remove_all(GNT_TREE(box->dropdown));
+	set_selection(box, NULL);
+}
+
--- a/console/libgnt/gntcombobox.h	Sat Sep 09 21:58:04 2006 +0000
+++ b/console/libgnt/gntcombobox.h	Sun Sep 10 00:17:44 2006 +0000
@@ -48,6 +48,10 @@
 
 void gnt_combo_box_add_data(GntComboBox *box, gpointer key, const char *text);
 
+void gnt_combo_box_remove(GntComboBox *box, gpointer key);
+
+void gnt_combo_box_remove_all(GntComboBox *box);
+
 gpointer gnt_combo_box_get_selected_data(GntComboBox *box);
 
 void gnt_combo_box_set_selected(GntComboBox *box, gpointer key);
--- a/console/libgnt/gntmain.c	Sat Sep 09 21:58:04 2006 +0000
+++ b/console/libgnt/gntmain.c	Sun Sep 10 00:17:44 2006 +0000
@@ -577,8 +577,6 @@
 	x -= 33;
 	y -= 33;
 
-	/* It might be a better idea to use panel_below. That would allow mouse-clicks
-	 * to be operated on transient windows, which would be cool.*/
 	while ((p = panel_below(p)) != NULL) {
 		const GntNode *node = panel_userptr(p);
 		GntWidget *wid;