changeset 13934:ef0d515b9f97

[gaim-migrate @ 16462] Mark urgent-hinted windows in the window-list. Make the default size of some of the windows smaller. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 08 Jul 2006 19:06:59 +0000
parents ad171112d52c
children cd2da4b079cf
files console/gntaccount.c console/libgnt/gntmain.c console/libgnt/gnttree.c
diffstat 3 files changed, 28 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntaccount.c	Sat Jul 08 15:38:45 2006 +0000
+++ b/console/gntaccount.c	Sat Jul 08 19:06:59 2006 +0000
@@ -35,6 +35,7 @@
 	accounts.window = gnt_box_new(TRUE, TRUE);
 	gnt_box_set_toplevel(GNT_BOX(accounts.window), TRUE);
 	gnt_box_set_title(GNT_BOX(accounts.window), _("Accounts"));
+	gnt_box_set_pad(GNT_BOX(accounts.window), 0);
 	gnt_widget_set_name(accounts.window, "accounts");
 
 	gnt_box_add_widget(GNT_BOX(accounts.window),
@@ -58,7 +59,7 @@
 
 	g_signal_connect(G_OBJECT(accounts.tree), "toggled", G_CALLBACK(account_toggled), NULL);
 	
-	gnt_widget_set_size(accounts.tree, 40, 15);
+	gnt_widget_set_size(accounts.tree, 40, 10);
 	gnt_box_add_widget(GNT_BOX(accounts.window), accounts.tree);
 
 	box = gnt_box_new(FALSE, FALSE);
--- a/console/libgnt/gntmain.c	Sat Jul 08 15:38:45 2006 +0000
+++ b/console/libgnt/gntmain.c	Sat Jul 08 19:06:59 2006 +0000
@@ -118,6 +118,23 @@
 	}
 	update_panels();
 	doupdate();
+	draw_taskbar();
+}
+
+static void
+update_window_in_list(GntWidget *wid)
+{
+	GntTextFormatFlags flag = 0;
+
+	if (window_list.window == NULL)
+		return;
+
+	if (wid == focus_list->data)
+		flag |= GNT_TEXT_FLAG_DIM;
+	else if (GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_URGENT))
+		flag |= GNT_TEXT_FLAG_BOLD;
+
+	gnt_tree_set_row_flags(GNT_TREE(window_list.tree), wid, flag);
 }
 
 static void
@@ -163,6 +180,8 @@
 		wbkgdset(taskbar, '\0' | COLOR_PAIR(color));
 		mvwhline(taskbar, 0, width * i, ' ' | COLOR_PAIR(color), width);
 		mvwprintw(taskbar, 0, width * i, "%s", GNT_BOX(w)->title);
+
+		update_window_in_list(w);
 	}
 
 	wrefresh(taskbar);
@@ -240,6 +259,7 @@
 		GntBox *box = GNT_BOX(iter->data);
 
 		gnt_tree_add_row_after(GNT_TREE(tree), box, box->title, NULL, NULL);
+		update_window_in_list(GNT_WIDGET(box));
 	}
 
 	gnt_box_add_widget(GNT_BOX(win), tree);
@@ -468,7 +488,6 @@
 		}
 	}
 
-	draw_taskbar();
 	refresh();
 
 	return TRUE;
@@ -554,8 +573,11 @@
 	{
 		if ((GNT_IS_BOX(widget) && GNT_BOX(widget)->title) && window_list.window != widget
 				&& GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_CAN_TAKE_FOCUS))
+		{
 			gnt_tree_add_row_after(GNT_TREE(window_list.tree), widget,
 					GNT_BOX(widget)->title, NULL, NULL);
+			update_window_in_list(widget);
+		}
 	}
 
 	update_panels();
--- a/console/libgnt/gnttree.c	Sat Jul 08 15:38:45 2006 +0000
+++ b/console/libgnt/gnttree.c	Sat Jul 08 19:06:59 2006 +0000
@@ -201,6 +201,7 @@
 			g_snprintf(format, sizeof(format) - 1, "[%c] ", row->isselected ? 'X' : ' ');
 		}
 
+		/* XXX: Need a utf8 version of snprintf */
 		if ((wr = g_snprintf(str, widget->priv.width, "%s%s", format, row->text)) >= widget->priv.width)
 		{
 			/* XXX: ellipsize */
@@ -702,10 +703,10 @@
 void gnt_tree_set_row_flags(GntTree *tree, void *key, GntTextFormatFlags flags)
 {
 	GntTreeRow *row = g_hash_table_lookup(tree->hash, key);
-	if (!row)
+	if (!row || row->flags == flags)
 		return;
 
 	row->flags = flags;
-	redraw_tree(tree);
+	redraw_tree(tree);	/* XXX: Is shouldn't be necessary to redraw the whole darned tree */
 }