Index: applets/wncklet/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/wncklet/ChangeLog,v
retrieving revision 1.542
diff -u -p -r1.542 ChangeLog
--- applets/wncklet/ChangeLog	23 Oct 2004 10:12:24 -0000	1.542
+++ applets/wncklet/ChangeLog	27 Oct 2004 04:18:48 -0000
@@ -1,3 +1,10 @@
+2004-10-25  Matt Proud	<khanreaper@nerp.net>
+	* window-menu.c (window_menu_connect_to_window),
+	(window_menu_window_name_changed), (window_menu_destroy_menu),
+	(window_menu_popup_menu), (window_menu_item_new): Added a hook
+	into wnck's "name_changed" signal to allow the applet to rename
+	windows in its list if a name changes.
+	
 2004-10-23  Crispin Flowerday  <gnome@flowerday.cx>
 
 	* window-menu.c (window_menu_destroy), (window_menu_destroy_menu) 
Index: applets/wncklet/window-menu.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/applets/wncklet/window-menu.c,v
retrieving revision 1.23
diff -u -p -r1.23 window-menu.c
--- applets/wncklet/window-menu.c	23 Oct 2004 10:12:24 -0000	1.23
+++ applets/wncklet/window-menu.c	27 Oct 2004 04:18:49 -0000
@@ -54,6 +54,7 @@ typedef struct {
 	GdkPixbuf    *icon_pixbuf;
 	WnckWindow   *icon_window;
 	GHashTable   *window_hash;
+	GHashTable   *label_hash;
 
 	int           size;
 
@@ -328,6 +329,30 @@ window_menu_window_icon_changed (WnckWin
 }
 
 static void
+window_menu_window_name_changed (WnckWindow *window,
+				 WindowMenu *window_menu)
+{
+	gpointer item;
+	const char *window_name;
+	char *freeme;
+
+	item = NULL;
+	window_name = NULL;
+	freeme = NULL;
+	item = g_hash_table_lookup (window_menu->label_hash, window);
+	if (item != NULL && window != NULL) {
+		window_name = wnck_window_get_name (window);
+		if (window_name == NULL) {
+			freeme = g_strdup(_("Untitled Window"));
+			window_name = freeme;
+		}
+		eel_ellipsizing_label_set_text (EEL_ELLIPSIZING_LABEL (item), window_name);
+		if (freeme != NULL)
+			g_free (freeme);
+	}
+}
+
+static void
 window_menu_active_window_changed (WnckScreen *screen,
 				   WindowMenu *window_menu)
 {
@@ -392,15 +417,22 @@ get_width (GtkWidget *widget, const char
 static GtkWidget*
 window_menu_item_new (WindowMenu  *window_menu,
 		      const gchar *label,
-		      gboolean make_bold)
+		      WnckWindow *window)
 {
 	GtkWidget *item;
 	GtkWidget *ellipsizing_label;
+	gboolean make_bold;
 
 	item = gtk_image_menu_item_new ();
 	
 	ellipsizing_label = eel_ellipsizing_label_new (label);
 	gtk_misc_set_alignment (GTK_MISC (ellipsizing_label), 0.0, 0.5);
+	if (window == NULL)
+		make_bold = FALSE;
+	else {
+		make_bold = wnck_window_demands_attention (window);
+		g_hash_table_insert (window_menu->label_hash, window, ellipsizing_label);
+	}
 	if (make_bold)
 		window_menu_make_label_bold (GTK_LABEL (ellipsizing_label));
 
@@ -443,7 +475,7 @@ window_menu_add_window (WindowMenu *wind
 
 	item = window_menu_item_new (window_menu,
 				     label,
-				     wnck_window_demands_attention (window));
+				     window);
 	if (freeme)
 		g_free (freeme);
 
@@ -516,6 +548,10 @@ window_menu_connect_to_window (WindowMen
 				     G_CALLBACK (window_menu_window_icon_changed),
 				     window_menu,
 				     window_menu->applet);
+	wncklet_connect_while_alive (window, "name_changed",
+				     G_CALLBACK (window_menu_window_name_changed),
+				     window_menu,
+				     window_menu->applet);
 }
 
 static void
@@ -546,7 +582,10 @@ window_menu_destroy_menu (GtkWidget  *wi
 
 	if (window_menu->window_hash)
 		g_hash_table_destroy (window_menu->window_hash);
+	if (window_menu->label_hash)
+		g_hash_table_destroy (window_menu->label_hash);
 	window_menu->window_hash = NULL;
+	window_menu->label_hash = NULL;
 	window_menu->no_windows_item = NULL;
 }
 
@@ -622,6 +661,10 @@ window_menu_popup_menu (WindowMenu *wind
 	if (window_menu->window_hash)
 		g_hash_table_destroy (window_menu->window_hash);
 	window_menu->window_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+	if (window_menu->label_hash)
+		g_hash_table_destroy (window_menu->label_hash);
+	window_menu->label_hash = g_hash_table_new (g_direct_hash, g_direct_equal);
+
 
 	for (l = windows; l; l = l->next)
 		window_menu_add_window (window_menu, l->data);
@@ -636,7 +679,7 @@ window_menu_popup_menu (WindowMenu *wind
 		window_menu->no_windows_item =
 			window_menu_item_new (window_menu,
 					      _("No Windows Open"),
-					      FALSE);
+					      NULL);
 
 		gtk_widget_set_sensitive (window_menu->no_windows_item, FALSE);
 		gtk_widget_show (window_menu->no_windows_item);	
