changeset 15052:34e049e6ce10

[gaim-migrate @ 17835] Patch from wabz to: - Fix bug #1602136 - Better handle resizing of trees - Make the tooltip-info more closely resemble the tooltip-info in Gaim. Also remove some unnecessary debug statements. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 28 Nov 2006 07:06:37 +0000
parents f0ffd80aa196
children 51f3c0df6ab4
files console/gntblist.c console/gntstatus.c console/libgnt/gnttree.c
diffstat 3 files changed, 25 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntblist.c	Tue Nov 28 06:59:48 2006 +0000
+++ b/console/gntblist.c	Tue Nov 28 07:06:37 2006 +0000
@@ -1016,7 +1016,6 @@
 	if (GAIM_BLIST_NODE_IS_CONTACT(node))
 		node = (GaimBlistNode*)gaim_contact_get_priority_buddy((GaimContact*)node);
 	update_buddy_display((GaimBuddy*)node, ggblist);
-	gaim_debug_info("blist", "Tagged buddy\n");
 }
 
 static void
@@ -1059,7 +1058,6 @@
 			}
 		}
 	}
-	gaim_debug_info("blist", "Placed buddy\n");
 }
 
 static void
@@ -1150,9 +1148,12 @@
 	GaimPlugin *prpl;
 	GaimPluginProtocolInfo *prpl_info;
 	GaimAccount *account;
+	const char *alias = gaim_buddy_get_alias(buddy);
 
 	account = gaim_buddy_get_account(buddy);
-	
+
+	if (g_utf8_collate(gaim_buddy_get_name(buddy), alias))
+		g_string_append_printf(str, _("Nickname: %s\n"), alias);
 	g_string_append_printf(str, _("Account: %s (%s)"),
 			gaim_account_get_username(account),
 			gaim_account_get_protocol_name(account));
@@ -1230,12 +1231,9 @@
 		GaimBuddy *pr = gaim_contact_get_priority_buddy((GaimContact*)node);
 		gboolean offline = !GAIM_BUDDY_IS_ONLINE(pr);
 		gboolean showoffline = gaim_prefs_get_bool(PREF_ROOT "/showoffline");
-		const char *alias = gaim_contact_get_alias((GaimContact*)node);
 		const char *name = gaim_buddy_get_name(pr);
 
-		title = g_strdup(alias);
-		if (g_utf8_collate(alias, name))
-			g_string_append_printf(str, _("Nickname: %s\n"), gaim_buddy_get_name(pr));
+		title = g_strdup(name);
 		tooltip_for_buddy(pr, str);
 		for (node = node->child; node; node = node->next) {
 			GaimBuddy *buddy = (GaimBuddy*)node;
@@ -1251,7 +1249,6 @@
 			if (!showoffline && !GAIM_BUDDY_IS_ONLINE(buddy))
 				continue;
 			str = g_string_append(str, "\n----------\n");
-			g_string_append_printf(str, _("Nickname: %s\n"), gaim_buddy_get_name(buddy));
 			tooltip_for_buddy(buddy, str);
 		}
 	} else if (GAIM_BLIST_NODE_IS_BUDDY(node)) {
@@ -1361,6 +1358,7 @@
 				!gaim_prefs_get_bool(PREF_ROOT "/showoffline"));
 	} else if (strcmp(text, "t") == 0) {
 		gg_blist_toggle_tag_buddy(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));
+		gnt_bindable_perform_action_named(GNT_BINDABLE(ggblist->tree), "move-down");
 	} else if (strcmp(text, "a") == 0) {
 		gg_blist_place_tagged(gnt_tree_get_selection_data(GNT_TREE(ggblist->tree)));
 	} else
@@ -1377,9 +1375,6 @@
 	
 	contact = gaim_buddy_get_contact(buddy);
 
-	gaim_debug_fatal("sadrul", "updating display for %s\n", gaim_buddy_get_name(buddy));
-	g_printerr("sadrul:  updating display for %s\n", gaim_buddy_get_name(buddy));
-
 	gnt_tree_change_text(GNT_TREE(ggblist->tree), buddy, 0, get_display_name((GaimBlistNode*)buddy));
 	gnt_tree_change_text(GNT_TREE(ggblist->tree), contact, 0, get_display_name((GaimBlistNode*)contact));
 
@@ -1428,7 +1423,6 @@
 	gnt_widget_get_size(w, &width, &height);
 	gaim_prefs_set_int(PREF_ROOT "/size/width", width);
 	gaim_prefs_set_int(PREF_ROOT "/size/height", height);
-	gnt_tree_set_col_width(GNT_TREE(ggblist->tree), 0, width - 1);
 }
 
 static void
--- a/console/gntstatus.c	Tue Nov 28 06:59:48 2006 +0000
+++ b/console/gntstatus.c	Tue Nov 28 07:06:37 2006 +0000
@@ -359,7 +359,8 @@
 	name = g_strdup_printf("%s (%s)", gaim_account_get_username(account),
 			gaim_account_get_protocol_name(account));
 	gnt_tree_add_choice(GNT_TREE(edit->tree), key,
-			gnt_tree_create_row(GNT_TREE(edit->tree), name, type, message), NULL, NULL);
+			gnt_tree_create_row(GNT_TREE(edit->tree),
+				name, type ? type : "", message ? message : ""), NULL, NULL);
 
 	if (sub)
 		gnt_tree_set_choice(GNT_TREE(edit->tree), key, TRUE);
--- a/console/libgnt/gnttree.c	Tue Nov 28 06:59:48 2006 +0000
+++ b/console/libgnt/gnttree.c	Tue Nov 28 07:06:37 2006 +0000
@@ -669,6 +669,22 @@
 }
 
 static void
+gnt_tree_size_changed(GntWidget *widget, int w, int h)
+{
+	GntTree *tree = GNT_TREE(widget);
+	int i;
+	int n = 0;
+	if (widget->priv.width <= 0)
+		return;
+	for (i = 0; i < tree->ncol; ++i)
+		n += tree->columns[i].width;
+	if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
+		tree->columns[tree->ncol - 1].width += widget->priv.width - n - 1 * tree->ncol;
+	else
+		tree->columns[tree->ncol - 1].width += widget->priv.width - n - 2 - 1 * tree->ncol;
+}
+
+static void
 gnt_tree_class_init(GntTreeClass *klass)
 {
 	GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass);
@@ -679,6 +695,7 @@
 	parent_class->size_request = gnt_tree_size_request;
 	parent_class->key_pressed = gnt_tree_key_pressed;
 	parent_class->clicked = gnt_tree_clicked;
+	parent_class->size_changed = gnt_tree_size_changed;
 
 	signals[SIG_SELECTION_CHANGED] = 
 		g_signal_new("selection-changed",