diff console/gntblist.c @ 15503:704d40050800

Wonderful patch from Richard 'wabz' Nelson to fix the bug of lacking a pounce ui. Some of the strings differ from the GTK+ counterpart by an underscore. How big of a problem/annoyance is that going to be? I haven't added the file in po/POTFILES.in. Should I?
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 03 Feb 2007 05:55:41 +0000
parents 28051164843c
children 35fa1d1c4ef2
line wrap: on
line diff
--- a/console/gntblist.c	Fri Feb 02 06:09:03 2007 +0000
+++ b/console/gntblist.c	Sat Feb 03 05:55:41 2007 +0000
@@ -45,6 +45,7 @@
 #include "gnttree.h"
 #include "gntutils.h"
 #include "gntwindow.h"
+#include "gntpounce.h"
 
 #include "gntblist.h"
 #include "gntconv.h"
@@ -883,6 +884,17 @@
 }
 
 static void
+gg_blist_pounce_node_cb(GaimBlistNode *node, GaimBlistNode *selected)
+{
+	GaimBuddy *b;
+	if (GAIM_BLIST_NODE_IS_CONTACT(node))
+		b = gaim_contact_get_priority_buddy((GaimContact *)node);
+	else
+		b = (GaimBuddy *)node;
+	gg_pounce_editor_show(b->account, b->name, NULL);
+}
+
+static void
 gg_blist_rename_node_cb(GaimBlistNode *node, GaimBlistNode *selected)
 {
 	const char *name = NULL;
@@ -1123,8 +1135,10 @@
 			add_custom_action(GNT_MENU(context), _("Place tagged"),
 					GAIM_CALLBACK(gg_blist_place_tagged), node);
 		}
-		
+
 		if (GAIM_BLIST_NODE_IS_BUDDY(node) || GAIM_BLIST_NODE_IS_CONTACT(node)) {
+			add_custom_action(GNT_MENU(context), _("Add Buddy Pounce"),
+					GAIM_CALLBACK(gg_blist_pounce_node_cb), node);
 			add_custom_action(GNT_MENU(context), _("Toggle Tag"),
 					GAIM_CALLBACK(gg_blist_toggle_tag_buddy), node);
 		}
@@ -1692,6 +1706,7 @@
 	GList *list;
 	GaimStatusPrimitive prim;
 	const char *message;
+	gboolean found = FALSE, saved = TRUE;
 
 	if (!ggblist)
 		return;
@@ -1708,19 +1723,26 @@
 	/* Rebuild the status dropdown */
 	populate_status_dropdown();
 
-	list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses");
-	for (; list; list = list->next)
-	{
-		StatusBoxItem *item = list->data;
-		if (item->type == STATUS_PRIMITIVE && item->u.prim == prim)
+	while (!found) {
+		list = g_object_get_data(G_OBJECT(ggblist->status), "list of statuses");
+		for (; list; list = list->next)
 		{
-			char *mess = gaim_unescape_html(message);
-			gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item);
-			gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess);
-			gnt_widget_draw(ggblist->status);
-			g_free(mess);
+			StatusBoxItem *item = list->data;
+			if ((saved && item->type != STATUS_PRIMITIVE && item->u.saved == now) ||
+					(!saved && item->type == STATUS_PRIMITIVE && item->u.prim == prim))
+			{
+				char *mess = gaim_unescape_html(message);
+				gnt_combo_box_set_selected(GNT_COMBO_BOX(ggblist->status), item);
+				gnt_entry_set_text(GNT_ENTRY(ggblist->statustext), mess);
+				gnt_widget_draw(ggblist->status);
+				g_free(mess);
+				found = TRUE;
+				break;
+			}
+		}
+		if (!saved)
 			break;
-		}
+		saved = FALSE;
 	}
 
 	g_signal_handlers_unblock_matched(ggblist->status, G_SIGNAL_MATCH_FUNC,