Re: [evolution-patches] set window title to component name



Not Zed wrote:
Instead of using the alias, shouldn't we use the string which is used
for the component buttons?

Excellent idea. I guess at first I didn't know how to get access to it. I think I figured it out.

This updated patch also sets the window icon to the sidebar button icon.

Please let me know if this looks ok.

Thanks,
Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1406
diff -p -u -r1.1406 ChangeLog
--- ChangeLog	31 Mar 2004 17:05:51 -0000	1.1406
+++ ChangeLog	1 Apr 2004 17:09:01 -0000
@@ -1,3 +1,8 @@
+2004-04-01  William Jon McCann  <mccann jhu edu>
+
+	* e-shell-window.c (switch_view): set window title and icon when changing
+	component view.
+
 2004-03-31  Rodney Dawes  <dobey ximian com>
 
 	* e-shell-importer.c (choose_importer_from_list):
Index: e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.18
diff -p -u -r1.18 e-shell-window.c
--- e-shell-window.c	26 Jan 2004 21:56:03 -0000	1.18
+++ e-shell-window.c	1 Apr 2004 17:09:01 -0000
@@ -280,6 +280,10 @@ switch_view (EShellWindow *window, Compo
 {
 	EShellWindowPrivate *priv = window->priv;
 	GConfClient *gconf_client = gconf_client_get_default ();
+	EComponentRegistry *registry = e_shell_peek_component_registry (window->priv->shell);
+	EComponentInfo *info = e_component_registry_peek_info (registry,
+							       component_view->component_id);
+	char *title;
 
 	if (component_view->sidebar_widget == NULL) {
 		init_view (window, component_view);
@@ -293,6 +297,13 @@ switch_view (EShellWindow *window, Compo
 		gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->sidebar_notebook), component_view->notebook_page_num);
 		gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->statusbar_notebook), component_view->notebook_page_num);
 	}
+
+	title = g_strdup_printf ("Ximian Evolution %s", info->button_label);
+	gtk_window_set_title (GTK_WINDOW (window), title);
+	g_free (title);
+
+	if (info->button_icon)
+		gtk_window_set_icon (GTK_WINDOW (window), info->button_icon);
 
 	gconf_client_set_string (gconf_client, "/apps/evolution/shell/view_defaults/component_id",
 				 (component_view->component_alias != NULL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]