Re: [evolution-patches] Patch for bug#307780



hope this will do.

i have included both the patch and the changelog.

saving whenever state changed also looks good when opening new windows and changing the state there.

On 7/25/05, Not Zed < notzed ximian com> wrote:
On Fri, 2005-07-22 at 15:56 +0530, Antony Vincent Pandian wrote:
>
> On 7/21/05, Not Zed <notzed ximian com> wrote:
>
>         Umm, since you already calculate is_visible, it would make
>         sense to use
>         it in the next line of code which implements the visibility,
>         right?
>
>         Also the following code sets the bonobo-ui state, the thing is
>         it is in
>         the listener function which just let you know of the state
>         change, so
>         there isn't any point setting the state in the ui, is there?
>
>         And again, your patches should include the changelog changes
>         in the one
>         diff, No need to attach it separately.
>
> ok.
>
>
>         Instead of all that get_prop stuff (which isn't very
>         efficient), you
>         should just set the gconf key in the listener callback
>         instead.
>
> ive used the get_prop stuff only while saving the visibility of the
> statusbar after closing evolution.
>
> do you mean to say to save the state in the key each time the status
> is changed? or  use the EShellWindow to get the visibility of the
> status bar? or some other ....??

Yes, save it when it changes.  For various other reasons its better to
save straight away rather than wait till closing anyway.

>




--
Luv,
S.Antony Vincent Pandian
--- evolution.xml	2005-07-21 16:41:27.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/ui/evolution.xml	2005-07-21 16:42:11.000000000 +0530
@@ -28,6 +28,9 @@
     <cmd name="ViewToolbar" _label="Tool_bar" type="toggle"
       _tip="Change the visibility of the toolbar" state="1"/>
 
+    <cmd name="ViewStatusBar" _label="_View Status Bar" type="toggle"
+      _tip="View/Hide the Status Bar" state="1"/>
+
     <cmd name="HelpSubmitBug" _label="Submit Bug Report"
       _tip="Submit a bug report using Bug Buddy"/>
 
@@ -108,6 +111,7 @@
     <submenu name="View" _label="_View">
       <placeholder name="ViewBegin"/>
       <menuitem name="ViewToolbar" id="ViewToolbar" verb="" accel="*Control**Shift*o"/>
+      <menuitem name="ViewStatusBar" id="ViewStatusBar" accel="*Control**Shift*v"/>
       <placeholder name="ViewPreview"/>
       <submenu name="Buttons" _label="_Switcher Appearance">
             <menuitem name="ViewButtonsIconText" id="ViewButtonsIconText" verb=""/>
--- e-shell-window.h	2005-07-20 20:28:36.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/shell/e-shell-window.h	2005-07-20 20:46:28.000000000 +0530
@@ -66,6 +66,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);
+GtkWidget         *e_shell_window_peek_statusbar            (EShellWindow *window);
 
 void  e_shell_window_save_defaults  (EShellWindow *window);
 void  e_shell_window_show_settings  (EShellWindow *window);
--- e-shell-window.c	2005-07-20 20:29:13.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/shell/e-shell-window.c	2005-07-25 16:30:22.000000000 +0530
@@ -557,7 +557,8 @@ setup_status_bar (EShellWindow *window)
 	priv = window->priv;
 
 	priv->status_bar = gtk_hbox_new (FALSE, 2);
-	gtk_widget_show (priv->status_bar);
+	if(gconf_client_get_bool (gconf_client_get_default(),"/apps/evolution/shell/view_defaults/statusbar_visible",NULL))
+		gtk_widget_show (priv->status_bar);
 
 	setup_offline_toggle (window);
 	setup_menu_hint_label (window);
@@ -672,6 +673,16 @@ setup_widgets (EShellWindow *window)
 	}
 	g_free (style);
 
+	/* Status Bar*/
+	visible = gconf_client_get_bool (gconf_client,
+				         "/apps/evolution/shell/view_defaults/statusbar_visible",
+					 NULL);
+	bonobo_ui_component_set_prop (e_shell_window_peek_bonobo_ui_component (window),
+				      "/commands/ViewStatusBar",
+				      "state",
+				      visible ? "1" : "0",
+				      NULL);
+
 	/* The tool bar */
 	visible = gconf_client_get_bool (gconf_client,
 					 "/apps/evolution/shell/view_defaults/toolbar_visible",
@@ -966,6 +977,12 @@ e_shell_window_peek_sidebar (EShellWindo
 	return E_SIDEBAR (window->priv->sidebar);
 }
 
+GtkWidget *
+e_shell_window_peek_statusbar (EShellWindow *window)
+{
+	return window->priv->status_bar;
+}
+
 void
 e_shell_window_save_defaults (EShellWindow *window)
 {
--- e-shell-window-commands.c	2005-07-20 20:29:18.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/shell/e-shell-window-commands.c	2005-07-25 16:54:39.419084664 +0530
@@ -49,6 +49,7 @@
 
 #include <libedataserverui/e-passwords.h>
 
+#include <gconf/gconf-client.h>
 #include <string.h>
 
 /* Utility functions.  */
@@ -878,6 +879,22 @@ view_toolbar_item_toggled_handler (Bonob
 				      "hidden", is_visible ? "0" : "1", NULL);
 }
 
+static void
+view_statusbar_item_toggled_handler (BonoboUIComponent           *ui_component,
+				     const char                  *path,
+				     Bonobo_UIComponent_EventType type,
+				     const char                  *state,
+				     EShellWindow                *shell_window)
+{
+	GtkWidget *status_bar = e_shell_window_peek_statusbar (shell_window);
+	gboolean is_visible;
+	is_visible = state[0] == '1';	
+	if(is_visible)
+		gtk_widget_show (status_bar);
+	else
+		gtk_widget_hide (status_bar);
+	gconf_client_set_bool (gconf_client_get_default (),"/apps/evolution/shell/view_defaults/statusbar_visible", is_visible, NULL);
+}
 
 /* Public API.  */
 
@@ -916,6 +933,9 @@ e_shell_window_commands_setup (EShellWin
 	bonobo_ui_component_add_listener (uic, "ViewToolbar",
 					  (BonoboUIListenerFn)view_toolbar_item_toggled_handler,
 					  (gpointer)shell_window);
+	bonobo_ui_component_add_listener (uic, "ViewStatusBar",
+					  (BonoboUIListenerFn)view_statusbar_item_toggled_handler,
+					  (gpointer)shell_window);
 
 	e_pixmaps_update (uic, pixmaps);
 
--- shell_ChangeLog	2005-07-21 13:35:54.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/shell/ChangeLog	2005-07-25 16:48:45.145942368 +0530
@@ -1,3 +1,26 @@
+2005-07-20 S.Antony Vincent Pandian <santony gmail com>
+
+	solves bug # 307780
+
+	* e-shell-window.h : added the prototype for the function
+	e_shell_window_peek_statusbar(..);
+	
+	* e-shell-window.c : show/hide the status bar widget based on the saved
+	property.
+
+	retreive the status bar's previous status and set in UI.
+
+	define the function e_shell_window_peek_statusbar() which retrieves
+	the status bar widget for e-shell-window-commands.c
+	
+	* e-shell-window-commands.c : view_statusbar_item_toggled_handler()
+	is the component listener for the "View Status Bar" menu item.it 
+	handles the click event in the menu item "View status Bar".The
+	state of the status bar is also saved every time an event occurs
+	on it.
+
+	setting the component listener to the component.
+		
 2005-07-07  Kjartan Maraas  <kmaraas gnome org>
 
 	* e-shell-window.c: (setup_widgets): Free the style here.
--- ui_ChangeLog	2005-07-21 16:33:53.000000000 +0530
+++ /home/evolution/cvs/evo/evolution/ui/ChangeLog	2005-07-21 16:33:45.000000000 +0530
@@ -1,3 +1,8 @@
+2005-07-20  S.Antony Vincent Pandian <santony gmail com>
+
+	* evolution.xml: Have added the "View Status Bar" under the "View" menu
+	This is a toggle button to hide/show the status bar
+
 2005-06-03  ANdre Klapper <a9016009 gmx de>
 	* evolution-mail-message.xml: Removing duplicate mnemonic,
 	this fixes bug 306153


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