[evolution-patches] fix for 57653 : toolbar visibility



Hi,

Here is a patch that enables the toolbar to be hidden.

Please let me know if this looks ok?

Thanks,
Jon
Index: ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.388
diff -p -u -r1.388 ChangeLog
--- ui/ChangeLog	15 Apr 2004 14:41:20 -0000	1.388
+++ ui/ChangeLog	30 Apr 2004 20:43:55 -0000
@@ -1,3 +1,7 @@
+2004-04-30  William Jon McCann  <mccann jhu edu>
+
+	* evolution.xml: Add Toolbar item to View menu.
+
 2004-04-15  JP Rosevear <jpr ximian com>
 
 	* evolution-comp-editor.xml: remove "Save" only option
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	30 Apr 2004 20:43:55 -0000
@@ -10,6 +10,9 @@
     <cmd name="FileExit" _label="E_xit" _tip="Exit the program"
       pixtype="stock" pixname="Quit" accel="*Control*q"/>
 
+    <cmd name="ViewToolbar" _label="_Toolbar" type="toggle"
+      _tip="Change the visibility of the toolbar in the current window" state="1"/>
+
     <cmd name="HelpSubmitBug" _label="Submit Bug Report"
       _tip="Submit a bug report using Bug Buddy"/>
 
@@ -68,6 +71,7 @@
     </placeholder>
 
     <submenu name="View" _label="_View">
+      <menuitem name="ViewToolbar" id="ViewToolbar" verb=""/>
       <placeholder name="ViewBegin"/>
       <placeholder name="ViewAfterControl"/>
     </submenu>
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1426
diff -p -u -r1.1426 ChangeLog
--- shell/ChangeLog	30 Apr 2004 19:07:22 -0000	1.1426
+++ shell/ChangeLog	30 Apr 2004 20:43:56 -0000
@@ -1,3 +1,13 @@
+2004-04-30  William Jon McCann  <mccann jhu edu>
+
+	* e-shell-window.c (setup_widgets): Set initial state of toolbar
+	visibility.
+
+	* e-shell-window-commands.c (view_toolbar_item_toggled_handler):
+	New function to handle toggling toolbar visibility and saving state.
+
+	* apps_evolution_shell.schemas.in.in: Added schema for toolbar_visible.
+
 2004-04-30  Dan Winship  <danw ximian com>
 
 	* apps_evolution_shell.schemas.in.in: Remove default folders,
Index: shell/apps_evolution_shell.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/shell/apps_evolution_shell.schemas.in.in,v
retrieving revision 1.2
diff -p -u -r1.2 apps_evolution_shell.schemas.in.in
--- shell/apps_evolution_shell.schemas.in.in	30 Apr 2004 19:07:22 -0000	1.2
+++ shell/apps_evolution_shell.schemas.in.in	30 Apr 2004 20:43:56 -0000
@@ -84,6 +84,18 @@
     </schema>
 
     <schema>
+      <key>/schemas/apps/evolution/shell/view_defaults/toolbar_visible</key>
+      <applyto>/apps/evolution/shell/view_defaults/toolbar_visible</applyto>
+      <owner>evolution</owner>
+      <type>bool</type>
+      <default>TRUE</default>
+      <locale name="C">
+        <short>Toolbar is visible</short>
+        <long>Whether the toolbar should be visible.</long>
+      </locale>
+    </schema>
+
+    <schema>
       <key>/schemas/apps/evolution/shell/view_defaults/component_id</key>
       <applyto>/apps/evolution/shell/view_defaults/component_id</applyto>
       <owner>evolution</owner>
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	30 Apr 2004 20:43:56 -0000
@@ -560,6 +560,7 @@ setup_widgets (EShellWindow *window)
 	GtkWidget *contents_vbox;
 	GSList *p;
 	int button_id;
+	gboolean toolbar_visible;
 
 	priv->paned = gtk_hpaned_new ();
 
@@ -580,6 +581,20 @@ setup_widgets (EShellWindow *window)
 
 	gtk_paned_set_position (GTK_PANED (priv->paned),
 				gconf_client_get_int (gconf_client, "/apps/evolution/shell/view_defaults/folder_bar/width", NULL));
+
+	toolbar_visible = gconf_client_get_bool (gconf_client,
+						 "/apps/evolution/shell/view_defaults/toolbar_visible",
+						 NULL);
+	bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
+				      "/commands/ViewToolbar",
+				      "state",
+				      toolbar_visible ? "1" : "0",
+				      NULL);
+	bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
+				      "/Toolbar",
+				      "hidden",
+				      toolbar_visible ? "0" : "1",
+				      NULL);
 
 	button_id = 0;
 	for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
Index: shell/e-shell-window-commands.c
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window-commands.c,v
retrieving revision 1.14
diff -p -u -r1.14 e-shell-window-commands.c
--- shell/e-shell-window-commands.c	30 Apr 2004 19:05:34 -0000	1.14
+++ shell/e-shell-window-commands.c	30 Apr 2004 20:43:57 -0000
@@ -44,6 +44,7 @@
 
 #include <bonobo/bonobo-ui-component.h>
 
+#include <gconf/gconf-client.h>
 
 /* Utility functions.  */
 
@@ -428,6 +429,29 @@ shell_line_status_changed_cb (EShell *sh
 }
 
 
+static void
+view_toolbar_item_toggled_handler (BonoboUIComponent           *ui_component,
+				   const char                  *path,
+				   Bonobo_UIComponent_EventType type,
+				   const char                  *state,
+				   EShellWindow                *shell_window)
+{
+	gboolean s;
+	GConfClient *gconf_client = gconf_client_get_default ();
+
+	s = (strcmp (state, "1") == 0);
+
+	bonobo_ui_component_set_prop (ui_component, "/Toolbar",
+				      "hidden", s ? "0" : "1", NULL);
+
+	gconf_client_set_bool (gconf_client,
+			       "/apps/evolution/shell/view_defaults/toolbar_visible",
+			       s,
+			       NULL);
+
+	g_object_unref (gconf_client);
+}
+
 /* Public API.  */
 
 void
@@ -447,6 +471,10 @@ e_shell_window_commands_setup (EShellWin
 	bonobo_ui_component_add_verb_list_with_data (uic, actions_verbs, shell_window);
 	bonobo_ui_component_add_verb_list_with_data (uic, tools_verbs, shell_window);
 	bonobo_ui_component_add_verb_list_with_data (uic, help_verbs, shell_window);
+
+	bonobo_ui_component_add_listener (uic, "ViewToolbar", 
+					  (BonoboUIListenerFn)view_toolbar_item_toggled_handler, 
+					  (gpointer)shell_window);
 
 	e_pixmaps_update (uic, pixmaps);
 


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