Re: [Evolution-hackers] Re: component selection from menus was Re: [evolution-patches] 57653 & 57654 : toolbar and sidebar visibility



Not Zed wrote:

This is kind of sweet.

Although the "Window" toplevel menu looks odd. Maybe it should be a submenu of view? Otherwise you're going to have to put more there, like "New Window" from the File menu. And I guess even things to do with the current window, like hide sidebar, etc might also have to go there. I guess it depends on what the HIG says about it.

I'm not sure putting them in a submenu is the way to go. I think they should be in one of the toplevels but I don't have any strong opinions on which one.

Should we also have accelerators, like alt-f1/f2/etc to switch between them?

Sure. I updated the patch to include them. I used Ctrl+F1... Alt ones seem to be used by GNOME/metacity.

Otherwise looks good to me, and something like this is necessary before we go hiding the sidebar. I guess its just up to product design to comment.

Cool.

Jon
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1697
diff -p -u -r1.1697 ChangeLog
--- addressbook/ChangeLog	5 May 2004 06:24:11 -0000	1.1697
+++ addressbook/ChangeLog	6 May 2004 03:55:55 -0000
@@ -1,3 +1,8 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* gui/component/GNOME_Evolution_Addressbook.server.in.in:
+	Add menu_label and menu_accelerator.
+
 2004-05-05  Hans Petter Jansson  <hpj ximian com>
 
 	* gui/contact-editor/e-contact-editor.c (init_address_textview):
Index: addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in,v
retrieving revision 1.15
diff -p -u -r1.15 GNOME_Evolution_Addressbook.server.in.in
--- addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in	3 May 2004 14:23:22 -0000	1.15
+++ addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in	6 May 2004 03:55:56 -0000
@@ -59,6 +59,8 @@
 
 	<oaf_attribute name="evolution:component_alias" type="string" value="contacts"/>
 
+        <oaf_attribute name="evolution:menu_label" type="string" _value="C_ontacts"/>
+        <oaf_attribute name="evolution:menu_accelerator" type="string" _value="*Control*F2"/>
         <oaf_attribute name="evolution:button_label" type="string" _value="Contacts"/>
         <oaf_attribute name="evolution:button_sort_order" type="string" value="-9"/>
         <oaf_attribute name="evolution:button_icon" type="string" value="stock_addressbook"/>
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2307
diff -p -u -r1.2307 ChangeLog
--- calendar/ChangeLog	5 May 2004 12:40:55 -0000	1.2307
+++ calendar/ChangeLog	6 May 2004 03:56:13 -0000
@@ -1,3 +1,8 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* gui/GNOME_Evolution_Calendar.server.in.in: Add menu_label and
+	menu_accelerator.
+
 2004-05-05  JP Rosevear  <jpr ximian com>
 
 	Fixes #58025
Index: calendar/gui/GNOME_Evolution_Calendar.server.in.in
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/GNOME_Evolution_Calendar.server.in.in,v
retrieving revision 1.12
diff -p -u -r1.12 GNOME_Evolution_Calendar.server.in.in
--- calendar/gui/GNOME_Evolution_Calendar.server.in.in	19 Apr 2004 15:19:32 -0000	1.12
+++ calendar/gui/GNOME_Evolution_Calendar.server.in.in	6 May 2004 03:56:13 -0000
@@ -43,6 +43,8 @@
 
 	<oaf_attribute name="name" type="string" _value="Evolution's Calendar component"/>
 
+	<oaf_attribute name="evolution:menu_label" type="string" _value="_Calendars"/>
+	<oaf_attribute name="evolution:menu_accelerator" type="string" _value="*Control*F3"/>
 	<oaf_attribute name="evolution:button_label" type="string" _value="Calendars"/>
         <oaf_attribute name="evolution:button_icon" type="string" value="stock_calendar"/>
 	<oaf_attribute name="evolution:button_sort_order" type="string" value="-8"/>
@@ -78,6 +80,8 @@
 
 	<oaf_attribute name="name" type="string" _value="Evolution's Tasks component"/>
 
+	<oaf_attribute name="evolution:menu_label" type="string" _value="_Tasks"/>
+	<oaf_attribute name="evolution:menu_accelerator" type="string" _value="*Control*F4"/>
 	<oaf_attribute name="evolution:button_label" type="string" _value="Tasks"/>
         <oaf_attribute name="evolution:button_icon" type="string" value="stock_todo"/>
 	<oaf_attribute name="evolution:button_sort_order" type="string" value="-8"/>
Index: mail/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3291
diff -p -u -r1.3291 ChangeLog
--- mail/ChangeLog	5 May 2004 21:01:24 -0000	1.3291
+++ mail/ChangeLog	6 May 2004 03:56:27 -0000
@@ -1,3 +1,8 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* GNOME_Evolution_Mail.server.in.in: Add menu_label and
+	menu_accelerator.
+
 2004-05-05  Jeffrey Stedfast  <fejj ximian com>
 
 	* em-folder-tree.c (emft_tree_row_collapsed): Select the row that
Index: mail/GNOME_Evolution_Mail.server.in.in
===================================================================
RCS file: /cvs/gnome/evolution/mail/GNOME_Evolution_Mail.server.in.in,v
retrieving revision 1.19
diff -p -u -r1.19 GNOME_Evolution_Mail.server.in.in
--- mail/GNOME_Evolution_Mail.server.in.in	19 Apr 2004 15:20:48 -0000	1.19
+++ mail/GNOME_Evolution_Mail.server.in.in	6 May 2004 03:56:28 -0000
@@ -29,6 +29,8 @@
 
     <oaf_attribute name="evolution:component_alias" type="string" value="mail"/>
 
+    <oaf_attribute name="evolution:menu_label" type="string" _value="_Mail"/>
+    <oaf_attribute name="evolution:menu_accelerator" type="string" _value="*Control*F1"/>
     <oaf_attribute name="evolution:button_label" type="string" _value="Mail"/>
     <oaf_attribute name="evolution:button_sort_order" type="string" value="-10"/>
     <oaf_attribute name="evolution:button_icon" type="string" value="stock_mail"/>
Index: ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.389
diff -p -u -r1.389 ChangeLog
--- ui/ChangeLog	3 May 2004 14:34:16 -0000	1.389
+++ ui/ChangeLog	6 May 2004 03:56:29 -0000
@@ -1,3 +1,7 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* evolution.xml: Add Window menu placeholder.
+
 2004-04-30  Dave Fallon <davef tetsubo com>
 
        * ui/evolution-addressbook.xml: Fixed Bug #57611.
Index: ui/evolution.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution.xml,v
retrieving revision 1.90
diff -p -u -r1.90 evolution.xml
--- ui/evolution.xml	9 Apr 2004 15:57:18 -0000	1.90
+++ ui/evolution.xml	6 May 2004 03:56:29 -0000
@@ -88,6 +88,10 @@
     <placeholder name="SearchPlaceholder">
     </placeholder>
 
+    <submenu name="Window" _label="_Window">
+      <placeholder name="WindowComponent"/>
+    </submenu>
+
     <submenu name="Help" _label="_Help">
 
       <placeholder name="BuiltMenuItems"/>
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1428
diff -p -u -r1.1428 ChangeLog
--- shell/ChangeLog	5 May 2004 15:36:37 -0000	1.1428
+++ shell/ChangeLog	6 May 2004 03:56:33 -0000
@@ -1,3 +1,12 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* e-shell-window.c (menu_component_selected, setup_widgets):
+	Add components to Window menu.
+
+	* e-component-registry.[ch] (component_info_new) 
+	(component_info_free, query_components): Add menu_label and
+	menu_accelerator fields.
+
 2004-05-05  Dan Winship  <danw ximian com>
 
 	* e-sidebar.c (layout_buttons): Change the algorithm so that if
Index: shell/e-component-registry.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.c,v
retrieving revision 1.48
diff -p -u -r1.48 e-component-registry.c
--- shell/e-component-registry.c	30 Apr 2004 06:22:04 -0000	1.48
+++ shell/e-component-registry.c	6 May 2004 03:56:33 -0000
@@ -54,6 +54,8 @@ static EComponentInfo *
 component_info_new (const char *id,
 		    const char *alias,
 		    const char *button_label,
+		    const char *menu_label,
+		    const char *menu_accelerator,
 		    int sort_order,
 		    GdkPixbuf *button_icon)
 {
@@ -62,6 +64,8 @@ component_info_new (const char *id,
 	info->id = g_strdup (id);
 	info->alias = g_strdup (alias);
 	info->button_label = g_strdup (button_label);
+	info->menu_label = g_strdup (menu_label);
+	info->menu_accelerator = g_strdup (menu_accelerator);
 	info->sort_order = sort_order;
 
 	info->button_icon = button_icon;
@@ -77,6 +81,8 @@ component_info_free (EComponentInfo *inf
 	g_free (info->id);
 	g_free (info->alias);
 	g_free (info->button_label);
+	g_free (info->menu_label);
+	g_free (info->menu_accelerator);
 
 	if (info->button_icon)
 		g_object_unref (info->button_icon);
@@ -157,6 +163,8 @@ query_components (EComponentRegistry *re
 	for (i = 0; i < info_list->_length; i++) {
 		const char *id;
 		const char *label;
+		const char *menu_label;
+		const char *menu_accelerator;
 		const char *alias;
 		const char *icon_name;
 		const char *sort_order_string;
@@ -169,6 +177,12 @@ query_components (EComponentRegistry *re
 		if (label == NULL)
 			label = g_strdup (_("Unknown"));
 
+		menu_label = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_label", language_list);
+		if (menu_label == NULL)
+			menu_label = g_strdup (_("Unknown"));
+
+		menu_accelerator = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:menu_accelerator", language_list);
+
 		alias = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:component_alias", NULL);
 
 		icon_name = bonobo_server_info_prop_lookup (& info_list->_buffer[i], "evolution:button_icon", NULL);
@@ -185,7 +199,8 @@ query_components (EComponentRegistry *re
 		else
 			sort_order = atoi (sort_order_string);
 
-		info = component_info_new (id, alias, label, sort_order, icon);
+		info = component_info_new (id, alias, label, menu_label,
+					   menu_accelerator, sort_order, icon);
 		set_schemas (info, & info_list->_buffer [i]);
 
 		registry->priv->infos = g_slist_prepend (registry->priv->infos, info);
Index: shell/e-component-registry.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-component-registry.h,v
retrieving revision 1.14
diff -p -u -r1.14 e-component-registry.h
--- shell/e-component-registry.h	20 Nov 2003 17:51:07 -0000	1.14
+++ shell/e-component-registry.h	6 May 2004 03:56:34 -0000
@@ -67,6 +67,8 @@ struct _EComponentInfo {
 	GNOME_Evolution_Component iface;
 
 	char *button_label;
+	char *menu_label;
+	char *menu_accelerator;
 	GdkPixbuf *button_icon;
 
 	int sort_order;
Index: shell/e-shell-window.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.c,v
retrieving revision 1.22
diff -p -u -r1.22 e-shell-window.c
--- shell/e-shell-window.c	30 Apr 2004 06:22:04 -0000	1.22
+++ shell/e-shell-window.c	6 May 2004 03:56:35 -0000
@@ -552,6 +552,21 @@ setup_status_bar (EShellWindow *window)
 }
 
 static void
+menu_component_selected (BonoboUIComponent *uic,
+			 EShellWindow *window,
+			 const char *path)
+{
+	char *component_id = NULL;
+
+	component_id = g_utf8_strchr (path, -1, g_utf8_get_char ("-"));
+
+	if (component_id) {
+		component_id = g_utf8_next_char (component_id);
+		e_shell_window_switch_to_component (window, component_id);
+	}
+}
+
+static void
 setup_widgets (EShellWindow *window)
 {
 	EShellWindowPrivate *priv = window->priv;
@@ -583,11 +598,49 @@ setup_widgets (EShellWindow *window)
 
 	button_id = 0;
 	for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
+		char *xml, *verb;
 		EComponentInfo *info = p->data;
 		ComponentView *view = component_view_new (info->id, info->alias, button_id);
 
 		window->priv->component_views = g_slist_prepend (window->priv->component_views, view);
 		e_sidebar_add_button (E_SIDEBAR (priv->sidebar), info->button_label, info->button_icon, button_id);
+
+		verb = g_strdup_printf ("SwitchComponent-%s", info->alias);
+
+		bonobo_ui_component_add_verb (e_shell_window_peek_bonobo_ui_component (window),
+					      verb,
+					      (BonoboUIVerbFn)menu_component_selected,
+					      window);
+		
+		g_free (verb);
+
+		xml = g_strdup_printf ("<submenu name=\"Window\">"
+				       "<placeholder name=\"WindowComponent\">"
+				       "<menuitem name=\"SwitchComponent-%s\" "
+				       "verb=\"\" _tip=\"Switch to %s\" "
+				       "_label=\"%s\" pixtype=\"pixbuf\" "
+				       "pixname=\"%s\" accel=\"%s\"/>"
+				       "</placeholder></submenu>\n",
+				       info->alias,
+				       info->button_label,
+				       info->menu_label,
+				       bonobo_ui_util_pixbuf_to_xml (info->button_icon),
+				       info->menu_accelerator);
+
+		bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+						   "/menu",
+						   xml,
+						   NULL);
+		g_free (xml);
+
+		xml = g_strdup_printf ("<cmd name=\"SwitchComponent-%s\"/>\n",
+				       info->alias);
+
+		bonobo_ui_component_set_translate (e_shell_window_peek_bonobo_ui_component (window),
+						   "/commands",
+						   xml,
+						   NULL);
+		g_free (xml);
 
 		button_id ++;
 	}


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