Re: [evolution-patches] fix for 57653 : toolbar visibility
- From: William Jon McCann <mccannwj pha jhu edu>
- To: Not Zed <notzed ximian com>
- Cc: evolution-patches lists ximian com
- Subject: Re: [evolution-patches] fix for 57653 : toolbar visibility
- Date: Tue, 01 Jun 2004 16:45:52 -0400
Shoot. This one doesn't leak the prop string.
Jon
William Jon McCann wrote:
I have updated the patch to address Michael's concern about multiple
open windows.
The toolbar status is now saved to gconf only in
e_shell_window_save_defaults().
Does this look ok?
Thanks,
Jon
? shell/ChangeLog.about_box
? shell/ChangeLog.window_menu
? shell/e-shell-window-commands.c.conflict
? shell/e-sidebar.c.zerofix
? shell/shell-errors.xml.h
Index: ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.395
diff -p -u -r1.395 ChangeLog
--- ui/ChangeLog 28 May 2004 16:34:29 -0000 1.395
+++ ui/ChangeLog 1 Jun 2004 20:43:55 -0000
@@ -1,3 +1,7 @@
+2004-06-01 William Jon McCann <mccann jhu edu>
+
+ * evolution.xml: Add toolbar visibility toggle to View menu.
+
2004-05-28 JP Rosevear <jpr novell com>
* evolution.xml: changed to About Evolution; comment out FAQ
Index: ui/evolution.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution.xml,v
retrieving revision 1.93
diff -p -u -r1.93 evolution.xml
--- ui/evolution.xml 28 May 2004 16:34:29 -0000 1.93
+++ ui/evolution.xml 1 Jun 2004 20:43:55 -0000
@@ -10,6 +10,9 @@
<cmd name="FileExit" _label="E_xit" _tip="Exit the program"
pixtype="stock" pixname="gtk-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"/>
@@ -70,6 +73,7 @@
<submenu name="View" _label="_View">
<placeholder name="ViewBegin"/>
<submenu name="Window" _label="_Window"/>
+ <menuitem name="ViewToolbar" id="ViewToolbar" verb="" accel="*Control**Shift*o"/>
<placeholder name="ViewAfterControl"/>
</submenu>
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1447
diff -p -u -r1.1447 ChangeLog
--- shell/ChangeLog 1 Jun 2004 04:16:26 -0000 1.1447
+++ shell/ChangeLog 1 Jun 2004 20:43:55 -0000
@@ -1,3 +1,16 @@
+2004-06-01 William Jon McCann <mccann jhu edu>
+
+ * e-shell-window-commands.c (e_shell_window_commands_setup):
+ Add listener for the ViewToolbar command.
+ (view_toolbar_item_toggled_handler):
+ New function to handle toggling toolbar visibility and saving state.
+
+ * e-shell-window.c (e_shell_window_save_defaults):
+ Save the status of the toolbar visibility.
+ (setup_widgets): Set initial state of toolbar visibility.
+
+ * apps_evolution_shell.schemas.in.in: Added schema for toolbar_visible.
+
2004-05-27 Not Zed <NotZed Ximian com>
** See #58827.
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 1 Jun 2004 20:43:55 -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.18
diff -p -u -r1.18 e-shell-window-commands.c
--- shell/e-shell-window-commands.c 28 May 2004 16:35:44 -0000 1.18
+++ shell/e-shell-window-commands.c 1 Jun 2004 20:43:55 -0000
@@ -46,6 +46,7 @@
#include <bonobo/bonobo-ui-component.h>
+#include <string.h>
/* Utility functions. */
@@ -608,6 +609,21 @@ shell_line_status_changed_cb (EShell *sh
update_offline_menu_item (shell_window, new_status);
}
+static void
+view_toolbar_item_toggled_handler (BonoboUIComponent *ui_component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ EShellWindow *shell_window)
+{
+ gboolean is_visible;
+
+ is_visible = (strcmp (state, "1") == 0);
+
+ bonobo_ui_component_set_prop (ui_component, "/Toolbar",
+ "hidden", is_visible ? "0" : "1", NULL);
+}
+
/* Public API. */
@@ -628,6 +644,9 @@ 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.25
diff -p -u -r1.25 e-shell-window.c
--- shell/e-shell-window.c 1 Jun 2004 04:16:26 -0000 1.25
+++ shell/e-shell-window.c 1 Jun 2004 20:43:55 -0000
@@ -574,6 +574,7 @@ setup_widgets (EShellWindow *window)
GSList *p;
GString *xml;
int button_id;
+ gboolean toolbar_visible;
priv->paned = gtk_hpaned_new ();
@@ -595,6 +596,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;
xml = g_string_new("");
for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
@@ -862,6 +877,8 @@ void
e_shell_window_save_defaults (EShellWindow *window)
{
GConfClient *client = gconf_client_get_default ();
+ char *prop;
+ gboolean toolbar_visible;
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/width",
GTK_WIDGET (window)->allocation.width, NULL);
@@ -870,6 +887,19 @@ e_shell_window_save_defaults (EShellWind
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/folder_bar/width",
gtk_paned_get_position (GTK_PANED (window->priv->paned)), NULL);
+
+ prop = bonobo_ui_component_get_prop (e_shell_window_peek_bonobo_ui_component (window),
+ "/commands/ViewToolbar",
+ "state",
+ NULL);
+ if (prop) {
+ toolbar_visible = strcmp (prop, "1") == 0;
+ gconf_client_set_bool (client,
+ "/apps/evolution/shell/view_defaults/toolbar_visible",
+ toolbar_visible,
+ NULL);
+ g_free (prop);
+ }
g_object_unref (client);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]