[evolution-patches] patch of adding a new gconf handler



Hi,

Based on evolution 1.4
 
Attached a patch that makes evolution responding to the changes of the
keys:
        /apps/evolution/shell/view_defaults/show_shortcut_bar
        /apps/evolution/shell/view_defaults/show_folder_bar

Evolution 1.4 has a bug that the shell could not do response to the
changes of the two keys above immediately. This patch will fix that bug
and you will find if you change the keys in gconf-editor, evolution
application will show/hide shortcut_bar/folder_bar of the shell at the
same time after patching.
Index: e-shell-view.h
===================================================================
RCS file: /export/src/cvs/evolution/shell/e-shell-view.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 e-shell-view.h
--- e-shell-view.h	2003/09/26 06:34:33	1.1.1.1
+++ e-shell-view.h	2004/07/02 07:51:57
@@ -28,7 +28,7 @@
 #include <bonobo/bonobo-window.h>
 #include <bonobo/bonobo-ui-component.h>
 #include <bonobo/bonobo-ui-container.h>
-
+#include <gconf/gconf-client.h>
 #ifdef __cplusplus
 extern "C" {
 #pragma }
@@ -98,6 +98,10 @@
 void      e_shell_view_show_folder_bar     (EShellView *shell_view,
 					    gboolean    show);
 gboolean  e_shell_view_folder_bar_shown    (EShellView *shell_view);
+void      e_shell_gconf_view_defaults_notify (GConfClient *gconf,
+                                                 guint cnxn_id,
+                                                 GConfEntry *entry,
+                                                 gpointer data);
 
 void e_shell_view_show_settings (EShellView *shell_view);
 
Index: e-shell-view.c
===================================================================
RCS file: /export/src/cvs/evolution/shell/e-shell-view.c,v
retrieving revision 1.6
diff -u -r1.6 e-shell-view.c
--- e-shell-view.c	2004/03/02 09:12:45	1.6
+++ e-shell-view.c	2004/07/02 07:52:03
@@ -454,6 +454,11 @@
 				     e_shell_get_local_directory (priv->shell));
 	e_tree_load_expanded_state (E_TREE (priv->storage_set_view),
 				    file_name);
+        gconf_client_add_dir (client, "/apps/evolution/shell/view_defaults",GCONF_CLIENT_PRELOAD_NONE, NULL);
+        gconf_client_notify_add (client,
+                        "/apps/evolution/shell/view_defaults",
+                        e_shell_gconf_view_defaults_notify, shell_view, NULL, NULL);
+
 	g_free (file_name);
 	g_object_unref (client);
 }
@@ -1772,6 +1777,26 @@
 		 void *data)
 {
 	return FALSE;
+}
+void
+e_shell_gconf_view_defaults_notify (GConfClient *gconf, guint cnxn_id, GConfEntry *entry, gpointer data)
+{
+                                                                                                                              
+                                                                                                                              
+        EShellView * esv=data;
+        gchar *tkey;
+                                                                                                                              
+        g_return_if_fail (entry != NULL);
+        g_return_if_fail (gconf_entry_get_key (entry) != NULL);
+        g_return_if_fail (gconf_entry_get_value (entry) != NULL);
+                                                                                                                              
+        tkey = strrchr (entry->key, '/');
+        if (!strcmp (tkey, "/show_folder_bar")) {
+                e_shell_view_show_folder_bar(esv,gconf_value_get_bool(gconf_entry_get_value(entry)));
+        }
+        else if(!strcmp(tkey,"/show_shortcut_bar")){
+                e_shell_view_show_shortcut_bar(esv,gconf_value_get_bool(gconf_entry_get_value(entry)));
+        }
 }
 
 


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