[ekiga] Revert "Remove another part of the gmconf api"



commit 88273417d3433bf6de781c01b9b4e48eea93ba53
Author: Eugen Dedu <Eugen Dedu pu-pm univ-fcomte fr>
Date:   Sat Jul 17 11:49:34 2010 +0200

    Revert "Remove another part of the gmconf api"
    
    This reverts commit 315024075dca09f158ea953a5f37ba77a327e88a, which
    broke the View menu (Dialpad, Show Call Panel were not working
    anymore).

 lib/gmconf/gmconf-gconf.c |   14 ++++++++++++++
 lib/gmconf/gmconf-glib.c  |   31 +++++++++++++++++++++++++++++++
 lib/gmconf/gmconf.h       |    6 ++++++
 src/gui/main_window.cpp   |    3 +++
 4 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/lib/gmconf/gmconf-gconf.c b/lib/gmconf/gmconf-gconf.c
index ba7d47f..bd6b262 100644
--- a/lib/gmconf/gmconf-gconf.c
+++ b/lib/gmconf/gmconf-gconf.c
@@ -392,3 +392,17 @@ gm_conf_notifier_trigger (const gchar *namespac)
 
   gconf_client_notify (client, namespac);
 }
+
+void
+gm_conf_watch ()
+{
+  gconf_client_add_dir (client, "/apps/" PACKAGE_NAME,
+			GCONF_CLIENT_PRELOAD_NONE, NULL);
+}
+
+
+void
+gm_conf_unwatch ()
+{
+  gconf_client_remove_dir (client, "/apps/" PACKAGE_NAME, NULL);
+}
diff --git a/lib/gmconf/gmconf-glib.c b/lib/gmconf/gmconf-glib.c
index 249a71a..b5682af 100644
--- a/lib/gmconf/gmconf-glib.c
+++ b/lib/gmconf/gmconf-glib.c
@@ -97,6 +97,7 @@
  */
 typedef struct _DataBase
 {
+  gboolean is_watched;
   GData *entries;
 } DataBase;
 
@@ -254,6 +255,7 @@ static GmConfEntry *database_get_entry_for_key (DataBase *, const gchar *);
 static GmConfEntry *database_get_entry_for_key_create (DataBase *,
 						       const gchar *);
 
+static void database_set_watched (DataBase *, const gboolean);
 static void database_notify_on_namespace (DataBase *, const gchar *);
 
 /*
@@ -713,6 +715,7 @@ database_new ()
   DataBase *db = NULL;
 
   db = g_new (DataBase, 1);
+  db->is_watched = FALSE;
   db->entries = NULL;
   g_datalist_init (&db->entries);
   return db;
@@ -1042,6 +1045,15 @@ database_get_entry_for_key_create (DataBase *db,
 }
 
 static void
+database_set_watched (DataBase *db,
+		      const gboolean bool)
+{
+  g_return_if_fail (db != NULL);
+
+  db->is_watched = bool;
+}
+
+static void
 database_notify_on_namespace (DataBase *db,
 			      const gchar *namespac)
 {
@@ -1057,6 +1069,9 @@ database_notify_on_namespace (DataBase *db,
 
   g_return_if_fail (entry != NULL);
 
+  if (db->is_watched == FALSE)
+    return;
+
   for (key = g_strdup (namespac);
        key[0] != 0;
        g_strrstr (key, "/")[0] = 0) {
@@ -1184,6 +1199,22 @@ gm_conf_save ()
   g_free (user_conf);
 }
 
+void
+gm_conf_watch ()
+{
+  DataBase *db = database_get_default ();
+
+  database_set_watched (db, TRUE);
+}
+
+void
+gm_conf_unwatch ()
+{
+  DataBase *db = database_get_default ();
+
+  database_set_watched (db, FALSE);
+}
+
 gpointer
 gm_conf_notifier_add (const gchar *namespac,
 		      GmConfNotifier func,
diff --git a/lib/gmconf/gmconf.h b/lib/gmconf/gmconf.h
index 1077c1c..79a9ffd 100644
--- a/lib/gmconf/gmconf.h
+++ b/lib/gmconf/gmconf.h
@@ -80,6 +80,12 @@ void gm_conf_init (); /* don't try anything before! */
 void gm_conf_shutdown (); /* don't try anything after! */
 void gm_conf_save (); /* to forcibly save */
 
+/* to accept/refuse that the notifiers get fired:
+ * the configuration is still readable/writable, but
+ * the changes aren't propagated to the gui */
+void gm_conf_watch ();
+void gm_conf_unwatch ();
+
 /* to set/unset notifiers */
 /* sets a notifier on namespac, calling func, with user_data*/
 gpointer gm_conf_notifier_add (const gchar *namespac, 
diff --git a/src/gui/main_window.cpp b/src/gui/main_window.cpp
index 42e5e26..f3c5f4e 100644
--- a/src/gui/main_window.cpp
+++ b/src/gui/main_window.cpp
@@ -4469,6 +4469,9 @@ main (int argc,
   }
 #endif
 
+  /* Init gm_conf */
+  gm_conf_watch ();
+
   Ekiga::Runtime::init ();
   engine_init (service_core, argc, argv);
 



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