diff options
author | Rob Bradford <rob@linux.intel.com> | 2011-06-20 13:18:48 +0100 |
---|---|---|
committer | Ross Burton <ross@linux.intel.com> | 2011-06-28 15:25:45 +0100 |
commit | e385c02d09ef078609a16a0291e07f6e399739be (patch) | |
tree | 2afc6bbfc09bad9d8b235d59fa04f7543754e7be | |
parent | 3e42f8c0a91e1cc1d2251a33fbf2525ed2dead45 (diff) | |
download | gconf-e385c02d09ef078609a16a0291e07f6e399739be.tar.gz |
gconf-database: Add conditional DBUS code
-rw-r--r-- | gconf/gconf-database.c | 57 | ||||
-rw-r--r-- | 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 82d90e85..81c1b0e2 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 a48bbb39..2d91fdc1 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; |