[evolution-patches] 57653 & 57654 : toolbar and sidebar visibility



Hi,

Just to complicate things ;) I have added an option to show/hide the sidebar.

This patch reverts to using the top of the View menu for these options. This is because it seems to be the de facto standard place and because the mail component doesn't seem to want to put them anywhere else :)

The menu mnemonics should be ok.

Accelerators have been added that don't seem to conflict with anything that I can see.

I added one bit of API to peek at the shell sidebar widget.

Does this look ok?

Thanks,
Jon
? shell/e-sidebar.c.zerofix
? 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
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1427
diff -p -u -r1.1427 ChangeLog
--- shell/ChangeLog	3 May 2004 14:28:48 -0000	1.1427
+++ shell/ChangeLog	4 May 2004 17:13:23 -0000
@@ -1,3 +1,17 @@
+2004-05-04  William Jon McCann  <mccann jhu edu>
+
+	* e-shell-window.[ch] (setup_widgets): Set initial state of toolbar
+	and sidebar visibility.
+	(e_shell_window_peek_sidebar): New function to access shell sidebar.
+
+	* e-shell-window-commands.c (view_sidebar_item_toggled_handler):
+	New function to handle toggling sidebar visibility and saving state.
+	(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
+	and sidebar_visible.
+
 2004-05-03  Dan Winship  <danw ximian com>
 
 	* e-shell-importer.c (e_shell_importer_start_import): Fix warnings
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	4 May 2004 17:13:23 -0000
@@ -84,6 +84,30 @@
     </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/sidebar_visible</key>
+      <applyto>/apps/evolution/shell/view_defaults/sidebar_visible</applyto>
+      <owner>evolution</owner>
+      <type>bool</type>
+      <default>TRUE</default>
+      <locale name="C">
+        <short>Sidebar is visible</short>
+        <long>Whether the sidebar 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	4 May 2004 17:13:23 -0000
@@ -44,6 +44,7 @@
 
 #include <bonobo/bonobo-ui-component.h>
 
+#include <gconf/gconf-client.h>
 
 /* Utility functions.  */
 
@@ -428,6 +429,55 @@ 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);
+}
+
+
+static void
+view_sidebar_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);
+
+	if (!s)
+		gtk_widget_hide (GTK_WIDGET (e_shell_window_peek_sidebar (shell_window)));
+	else
+		gtk_widget_show (GTK_WIDGET (e_shell_window_peek_sidebar (shell_window)));
+
+	gconf_client_set_bool (gconf_client,
+			       "/apps/evolution/shell/view_defaults/sidebar_visible",
+			       s,
+			       NULL);
+
+	g_object_unref (gconf_client);
+}
+
 /* Public API.  */
 
 void
@@ -447,6 +497,14 @@ 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);
+
+	bonobo_ui_component_add_listener (uic, "ViewSidebar", 
+					  (BonoboUIListenerFn)view_sidebar_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	4 May 2004 17:13:23 -0000
@@ -560,6 +560,7 @@ setup_widgets (EShellWindow *window)
 	GtkWidget *contents_vbox;
 	GSList *p;
 	int button_id;
+	gboolean toolbar_visible, sidebar_visible;
 
 	priv->paned = gtk_hpaned_new ();
 
@@ -581,6 +582,28 @@ 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);
+
+	sidebar_visible = gconf_client_get_bool (gconf_client,
+						 "/apps/evolution/shell/view_defaults/sidebar_visible",
+						 NULL);
+	bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
+				      "/commands/ViewSidebar",
+				      "state",
+				      sidebar_visible ? "1" : "0",
+				      NULL);
 	button_id = 0;
 	for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
 		EComponentInfo *info = p->data;
@@ -599,6 +622,9 @@ setup_widgets (EShellWindow *window)
 	gtk_box_pack_start (GTK_BOX (contents_vbox), priv->status_bar, FALSE, TRUE, 0);
 	gtk_widget_show_all (contents_vbox);
 
+	if (!sidebar_visible)
+		gtk_widget_hide (priv->sidebar);
+
 	/* We only display this when a menu item is actually selected.  */
 	gtk_widget_hide (priv->menu_hint_label);
 
@@ -801,6 +827,15 @@ e_shell_window_peek_shell (EShellWindow 
 	g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
 
 	return window->priv->shell;
+}
+
+
+ESidebar *
+e_shell_window_peek_sidebar (EShellWindow *window)
+{
+	g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+
+	return window->priv->sidebar;
 }
 
 
Index: shell/e-shell-window.h
===================================================================
RCS file: /cvs/gnome/evolution/shell/e-shell-window.h,v
retrieving revision 1.8
diff -p -u -r1.8 e-shell-window.h
--- shell/e-shell-window.h	2 Dec 2003 02:17:23 -0000	1.8
+++ shell/e-shell-window.h	4 May 2004 17:13:23 -0000
@@ -51,6 +51,7 @@ struct _EShellWindowClass {
 
 
 #include "e-shell.h"
+#include "e-sidebar.h"
 
 
 GType  e_shell_window_get_type  (void);
@@ -64,6 +65,8 @@ const char *e_shell_window_peek_current_
 
 EShell            *e_shell_window_peek_shell                (EShellWindow *window);
 BonoboUIComponent *e_shell_window_peek_bonobo_ui_component  (EShellWindow *window);
+
+ESidebar          *e_shell_window_peek_sidebar              (EShellWindow *window);
 
 void  e_shell_window_save_defaults  (EShellWindow *window);
 void  e_shell_window_show_settings  (EShellWindow *window);
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	4 May 2004 17:13:23 -0000
@@ -1,3 +1,7 @@
+2004-05-04  William Jon McCann  <mccann jhu edu>
+
+	* evolution.xml: Add Toolbar and Sidebar items 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	4 May 2004 17:13:23 -0000
@@ -10,6 +10,12 @@
     <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="ViewSidebar" _label="_Sidebar" type="toggle"
+      _tip="Change the visibility of the sidebar" state="1"/>
+
     <cmd name="HelpSubmitBug" _label="Submit Bug Report"
       _tip="Submit a bug report using Bug Buddy"/>
 
@@ -68,6 +74,9 @@
     </placeholder>
 
     <submenu name="View" _label="_View">
+      <menuitem name="ViewToolbar" id="ViewToolbar" verb="" accel="*Control**Shift*o"/>
+      <menuitem name="ViewSidebar" id="ViewSidebar" verb="" accel="*Control**Shift*s"/>
+      <separator />
       <placeholder name="ViewBegin"/>
       <placeholder name="ViewAfterControl"/>
     </submenu>


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