Re: [evolution-patches] fix for 57653 : toolbar visibility



Not Zed wrote:

Given that the 'preview pane' option, which is pretty similar in that it affects a block of the ui is near the top, it should probably go near the top. Although i dont think it needs to go right at the top. Below the view menu might make sens,e they all have one of those don't they?


Ok. Shall we try it directly at the top for now? It is easy to change it if we find that it should be lower.

Is it ok to commit the attached patch? It is just the toolbar visibility stuff - no sidebar...

Thanks,
Jon

? ui/ChangeLog.icons
? ui/evolution-addressbook.xml.icons
? ui/evolution-composer-entries.xml.icons
? ui/evolution-contact-editor.xml.icons
? ui/evolution-contact-list-editor.xml.icons
? ui/evolution-mail-global.xml.icons
? ui/evolution-mail-list.xml.icons
? ui/evolution-mail-message.xml.icons
? ui/evolution-message-composer.xml.icons
? ui/evolution-subscribe.xml.icons
? ui/evolution-tasks.xml.icons
? ui/evolution.xml.icons
? ui/evolution.xml.newest
? shell/apps_evolution_shell.schemas.in.in.newest
? shell/e-shell-window-commands.c.newest
? shell/e-shell-window.c.newest
? shell/e-shell-window.h.newest
? shell/e-sidebar.c.zerofix
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	5 May 2004 19:20:31 -0000
@@ -1,3 +1,7 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* evolution.xml: Add Toolbar item to View menu.
+
 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	5 May 2004 19:20:31 -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="T_oolbar" type="toggle"
+      _tip="Change the visibility of the toolbar" state="1"/>
+
     <cmd name="HelpSubmitBug" _label="Submit Bug Report"
       _tip="Submit a bug report using Bug Buddy"/>
 
@@ -68,6 +71,8 @@
     </placeholder>
 
     <submenu name="View" _label="_View">
+      <menuitem name="ViewToolbar" id="ViewToolbar" verb="" accel="*Control**Shift*o"/>
+      <separator />
       <placeholder name="ViewBegin"/>
       <placeholder name="ViewAfterControl"/>
     </submenu>
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	5 May 2004 19:20:32 -0000
@@ -1,3 +1,13 @@
+2004-05-05  William Jon McCann  <mccann jhu edu>
+
+	* e-shell-window.[ch] (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-05-05  Dan Winship  <danw ximian com>
 
 	* e-sidebar.c (layout_buttons): Change the algorithm so that if
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	5 May 2004 19:20:32 -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-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	5 May 2004 19:20:32 -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);
 
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	5 May 2004 19:20:32 -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) {


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