[evolution-patches] sidebar visibility patch
- From: William Jon McCann <mccannwj pha jhu edu>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] sidebar visibility patch
- Date: Tue, 29 Jun 2004 15:53:30 -0400
Hi,
I thought I would resubmit this now that there is a way to switch
components when the component buttons are not visible.
Please let me know what you think.
Thanks,
Jon
Index: ui/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/ui/ChangeLog,v
retrieving revision 1.398
diff -p -u -r1.398 ChangeLog
--- ui/ChangeLog 23 Jun 2004 03:59:03 -0000 1.398
+++ ui/ChangeLog 29 Jun 2004 19:46:16 -0000
@@ -1,3 +1,7 @@
+2004-06-29 William Jon McCann <mccann jhu edu>
+
+ * evolution.xml: Add sidebar visibility toggle to View menu.
+
2004-06-22 V Ravi Kumar Raju <vravikr yahoo co uk>
* evolution-addressbook.xml: Remove the Menu Seperator in View
Index: ui/evolution.xml
===================================================================
RCS file: /cvs/gnome/evolution/ui/evolution.xml,v
retrieving revision 1.94
diff -p -u -r1.94 evolution.xml
--- ui/evolution.xml 2 Jun 2004 20:37:45 -0000 1.94
+++ ui/evolution.xml 29 Jun 2004 19:46:16 -0000
@@ -13,6 +13,9 @@
<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"/>
@@ -74,6 +77,7 @@
<placeholder name="ViewBegin"/>
<submenu name="Window" _label="_Window"/>
<menuitem name="ViewToolbar" id="ViewToolbar" verb="" accel="*Control**Shift*o"/>
+ <menuitem name="ViewSidebar" id="ViewSidebar" verb="" accel="*Control**Shift*s"/>
<placeholder name="ViewAfterControl"/>
</submenu>
Index: shell/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/shell/ChangeLog,v
retrieving revision 1.1459
diff -p -u -r1.1459 ChangeLog
--- shell/ChangeLog 24 Jun 2004 08:14:51 -0000 1.1459
+++ shell/ChangeLog 29 Jun 2004 19:46:17 -0000
@@ -1,3 +1,12 @@
+2004-06-29 William Jon McCann <mccann jhu edu>
+
+ * e-shell-window.[ch] (setup_widgets,e_shell_window_peek_sidebar)
+ (e_shell_window_save_defaults):
+ * e-shell-window-commands.c (view_sidebar_item_toggled_handler)
+ (e_shell_window_commands_setup):
+ * apps_evolution_shell.schemas.in.in: Add support for toggling
+ the sidebar visibility.
+
2004-06-24 Not Zed <NotZed Ximian com>
** See bug #57367.
Index: shell/apps_evolution_shell.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/shell/apps_evolution_shell.schemas.in.in,v
retrieving revision 1.3
diff -p -u -r1.3 apps_evolution_shell.schemas.in.in
--- shell/apps_evolution_shell.schemas.in.in 2 Jun 2004 20:37:14 -0000 1.3
+++ shell/apps_evolution_shell.schemas.in.in 29 Jun 2004 19:46:17 -0000
@@ -96,6 +96,18 @@
</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.20
diff -p -u -r1.20 e-shell-window-commands.c
--- shell/e-shell-window-commands.c 6 Jun 2004 22:31:34 -0000 1.20
+++ shell/e-shell-window-commands.c 29 Jun 2004 19:46:17 -0000
@@ -623,6 +623,23 @@ view_toolbar_item_toggled_handler (Bonob
"hidden", is_visible ? "0" : "1", NULL);
}
+static void
+view_sidebar_item_toggled_handler (BonoboUIComponent *ui_component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ EShellWindow *shell_window)
+{
+ gboolean is_visible;
+
+ is_visible = state[0] == '1';
+
+ if (is_visible)
+ gtk_widget_show (GTK_WIDGET (e_shell_window_peek_sidebar (shell_window)));
+ else
+ gtk_widget_hide (GTK_WIDGET (e_shell_window_peek_sidebar (shell_window)));
+}
+
/* Public API. */
@@ -645,6 +662,9 @@ e_shell_window_commands_setup (EShellWin
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.27
diff -p -u -r1.27 e-shell-window.c
--- shell/e-shell-window.c 24 Jun 2004 08:14:51 -0000 1.27
+++ shell/e-shell-window.c 29 Jun 2004 19:46:17 -0000
@@ -575,6 +575,7 @@ setup_widgets (EShellWindow *window)
GString *xml;
int button_id;
gboolean toolbar_visible;
+ gboolean sidebar_visible;
priv->paned = gtk_hpaned_new ();
@@ -610,6 +611,15 @@ setup_widgets (EShellWindow *window)
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;
xml = g_string_new("");
for (p = e_component_registry_peek_list (registry); p != NULL; p = p->next) {
@@ -660,6 +670,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);
@@ -667,6 +680,13 @@ setup_widgets (EShellWindow *window)
g_object_unref (gconf_client);
}
+ESidebar *
+e_shell_window_peek_sidebar (EShellWindow *window)
+{
+ g_return_val_if_fail (E_IS_SHELL_WINDOW (window), NULL);
+
+ return window->priv->sidebar;
+}
/* GObject methods. */
@@ -874,7 +894,7 @@ e_shell_window_save_defaults (EShellWind
{
GConfClient *client = gconf_client_get_default ();
char *prop;
- gboolean toolbar_visible;
+ gboolean is_visible;
gconf_client_set_int (client, "/apps/evolution/shell/view_defaults/width",
GTK_WIDGET (window)->allocation.width, NULL);
@@ -889,10 +909,23 @@ e_shell_window_save_defaults (EShellWind
"state",
NULL);
if (prop) {
- toolbar_visible = prop[0] == '1';
+ is_visible = prop[0] == '1';
gconf_client_set_bool (client,
"/apps/evolution/shell/view_defaults/toolbar_visible",
- toolbar_visible,
+ is_visible,
+ NULL);
+ g_free (prop);
+ }
+
+ prop = bonobo_ui_component_get_prop (e_shell_window_peek_bonobo_ui_component (window),
+ "/commands/ViewSidebar",
+ "state",
+ NULL);
+ if (prop) {
+ is_visible = prop[0] == '1';
+ gconf_client_set_bool (client,
+ "/apps/evolution/shell/view_defaults/sidebar_visible",
+ is_visible,
NULL);
g_free (prop);
}
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 29 Jun 2004 19:46:17 -0000
@@ -51,7 +51,7 @@ struct _EShellWindowClass {
#include "e-shell.h"
-
+#include "e-sidebar.h"
GType e_shell_window_get_type (void);
@@ -64,6 +64,7 @@ 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]