[gconf/port-to-dbus: 17/23] gconf-database: Add conditional DBUS code



commit e385c02d09ef078609a16a0291e07f6e399739be
Author: Rob Bradford <rob linux intel com>
Date:   Mon Jun 20 13:18:48 2011 +0100

    gconf-database: Add conditional DBUS code

 gconf/gconf-database.c |   57 ++++++++++++++++++++++++++++++++++++++++++++++++
 gconf/gconf-database.h |   10 ++++++++
 2 files changed, 67 insertions(+), 0 deletions(-)
---
diff --git a/gconf/gconf-database.c b/gconf/gconf-database.c
index 82d90e8..81c1b0e 100644
--- a/gconf/gconf-database.c
+++ b/gconf/gconf-database.c
@@ -19,10 +19,16 @@
 
 #include <config.h>
 #include "gconf-database.h"
+#ifdef HAVE_DBUS
+#include "gconf-database-dbus.h"
+#endif
 #include "gconf-listeners.h"
 #include "gconf-sources.h"
 #include "gconf-locale.h"
 #include "gconfd.h"
+#ifdef HAVE_DBUS
+#include "gconfd-dbus.h"
+#endif
 #include <string.h>
 #include <unistd.h>
 #include <time.h>
@@ -815,6 +821,9 @@ gconf_database_new (GConfSources  *sources)
     }
 #endif
 
+#ifdef HAVE_DBUS
+  gconf_database_dbus_setup (db);
+#endif
 
   db->listeners = gconf_listeners_new();
 
@@ -862,6 +871,10 @@ gconf_database_free (GConfDatabase *db)
   CORBA_exception_free (&ev);
 #endif
 
+#ifdef HAVE_DBUS
+  gconf_database_dbus_teardown (db);
+#endif
+
   if (db->listeners != NULL)
     {
       gboolean need_sync = FALSE;
@@ -1078,6 +1091,15 @@ source_notify_cb (GConfSource   *source,
       CORBA_free (cvalue);
 #endif
 
+#ifdef HAVE_DBUS
+      gconf_database_dbus_notify_listeners (db,
+					    NULL,
+					    location,
+					    value,
+					    is_default,
+					    is_writable,
+					    FALSE);
+#endif
       gconf_value_free (value);
     }
 }
@@ -1392,6 +1414,15 @@ gconf_database_set   (GConfDatabase      *db,
 				       TRUE,
 				       TRUE);
 #endif
+#ifdef HAVE_DBUS
+      gconf_database_dbus_notify_listeners (db,
+					    modified_sources,
+					    key,
+					    value,
+					    FALSE,
+					    TRUE,
+					    TRUE);
+#endif
     }
 }
 
@@ -1476,6 +1507,19 @@ gconf_database_unset (GConfDatabase      *db,
       CORBA_free(val);
 #endif
 
+#ifdef HAVE_DBUS
+      gconf_database_schedule_sync(db);
+
+      gconf_database_dbus_notify_listeners(db,
+					   modified_sources,
+					   key,
+					   def_value,
+					   TRUE,
+					   is_writable,
+					   TRUE);
+      if (def_value)
+	      gconf_value_free(def_value);
+#endif
     }
 }
 
@@ -1573,6 +1617,19 @@ gconf_database_recursive_unset (GConfDatabase      *db,
       
       CORBA_free (val);
 #endif
+#ifdef HAVE_DBUS
+      gconf_database_schedule_sync (db);
+      
+      gconf_database_dbus_notify_listeners (db,
+					    notify->modified_sources,
+					    notify->key,
+					    new_value,
+					    is_default,
+					    is_writable,
+					    TRUE);
+      if (new_value)
+	      gconf_value_free (new_value);
+#endif
 
       g_free (notify->key);
       g_free (notify);
diff --git a/gconf/gconf-database.h b/gconf/gconf-database.h
index a48bbb3..2d91fdc 100644
--- a/gconf/gconf-database.h
+++ b/gconf/gconf-database.h
@@ -32,6 +32,9 @@ G_BEGIN_DECLS
 #include "gconf-sources.h"
 #include "gconf-internals.h"
 
+#ifdef HAVE_DBUS
+#include <dbus/dbus.h>
+#endif
 
 #include "gconf-locale.h"
 
@@ -47,7 +50,14 @@ struct _GConfDatabase
   ConfigDatabase objref;
 #endif
 
+#ifdef HAVE_DBUS
+  char           *object_path;
   
+  /* Information about clients that want notification. */
+  GHashTable     *notifications;
+  GHashTable     *listening_clients;
+#endif
+
   GConfListeners* listeners;
   GConfSources* sources;
 



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