diff options
author | Ryan Lortie <desrt@desrt.ca> | 2011-09-11 15:09:52 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2011-09-11 15:09:52 -0400 |
commit | 44d56d869d2236ef1d177bd1ab33d65ae23d7e2e (patch) | |
tree | e4e56f05c6238dc29af96a02cab6b3e1cd4b41eb | |
parent | 3ecf9aab99ff201ba66e7d7f6e79accbd6797660 (diff) | |
download | dconf-44d56d869d2236ef1d177bd1ab33d65ae23d7e2e.tar.gz |
Remove "service func" logic
This was required to support the case where the dconf client was unable
to determine the cache directory for itself. Since we now use the XDG
runtime directory, this is redundant.
-rw-r--r-- | client/dconf-client.vala | 13 | ||||
-rw-r--r-- | client/engine.vapi | 1 | ||||
-rw-r--r-- | common/dconf-shmdir.c | 17 | ||||
-rw-r--r-- | dbus-1/dconf-dbus-1.c | 8 | ||||
-rw-r--r-- | engine/dconf-engine.c | 49 | ||||
-rw-r--r-- | engine/dconf-engine.h | 6 | ||||
-rw-r--r-- | gsettings/dconfsettingsbackend.c | 14 |
7 files changed, 4 insertions, 104 deletions
diff --git a/client/dconf-client.vala b/client/dconf-client.vala index 8c011ae..472e544 100644 --- a/client/dconf-client.vala +++ b/client/dconf-client.vala @@ -342,17 +342,6 @@ namespace DConf { return true; } - static Variant? service_func (EngineMessage dcem) { - try { - assert (dcem.bus_types[0] == 'e'); - var connection = Bus.get_sync (BusType.SESSION, null); - return connection.call_sync (dcem.bus_name, dcem.object_path, dcem.interface_name, dcem.method_name, - dcem.parameters[0], dcem.reply_type, DBusCallFlags.NONE, -1, null); - } catch { - return null; - } - } - /** * dconf_client_new: * @profile: the dconf profile to use, or %NULL @@ -369,8 +358,6 @@ namespace DConf { * ~/.config/dconf/user. **/ public Client (string? profile = null, owned WatchFunc? watch_func = null) { - Engine.set_service_func (service_func); - engine = new Engine (profile); this.watch_func = watch_func; } diff --git a/client/engine.vapi b/client/engine.vapi index 8ed9c92..d90063c 100644 --- a/client/engine.vapi +++ b/client/engine.vapi @@ -11,7 +11,6 @@ namespace DConf { internal GLib.Variant? read_no_default (string key); internal EngineMessage set_locked (string key, bool locked); internal string[] list (string dir, void*junk = null); - internal static void set_service_func (ServiceFunc func); internal EngineMessage watch (string name); internal EngineMessage unwatch (string name); } diff --git a/common/dconf-shmdir.c b/common/dconf-shmdir.c index cb40e11..eed90e5 100644 --- a/common/dconf-shmdir.c +++ b/common/dconf-shmdir.c @@ -26,21 +26,10 @@ dconf_shmdir_from_environment (void) { gchar *result; - result = g_strdup (g_getenv ("DCONF_SESSION_DIR")); - - if (result == NULL) - { - result = g_build_filename (g_get_user_runtime_dir (), "dconf", NULL); - - if (g_mkdir_with_parents (result, 0700) != 0) - { - g_free (result); - result = NULL; - } - } - - + result = g_build_filename (g_get_user_runtime_dir (), "dconf", NULL); + if (!g_mkdir_with_parents (result, 0700) != 0) + g_critical ("unable to create '%s'; dconf will not work properly.", result); return result; } diff --git a/dbus-1/dconf-dbus-1.c b/dbus-1/dconf-dbus-1.c index fefdbab..421ea12 100644 --- a/dbus-1/dconf-dbus-1.c +++ b/dbus-1/dconf-dbus-1.c @@ -620,12 +620,6 @@ dconf_dbus_client_has_pending (DConfDBusClient *dcdbc) return dcdbc->outstanding != NULL; } -static GVariant * -dconf_dbus_client_service_func (DConfEngineMessage *dcem) -{ - g_assert_not_reached (); -} - static DBusHandlerResult dconf_dbus_client_filter (DBusConnection *connection, DBusMessage *message, @@ -686,8 +680,6 @@ dconf_dbus_client_new (const gchar *profile, if (system == NULL) system = dbus_bus_get (DBUS_BUS_SYSTEM, NULL); - dconf_engine_set_service_func (dconf_dbus_client_service_func); - dcdbc = g_slice_new (DConfDBusClient); dcdbc->engine = dconf_engine_new (profile); dcdbc->system_bus = dbus_connection_ref (system); diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c index 21105da..b83954d 100644 --- a/engine/dconf-engine.c +++ b/engine/dconf-engine.c @@ -31,8 +31,6 @@ #include <fcntl.h> #include <sys/mman.h> -static DConfEngineServiceFunc dconf_engine_service_func; - void dconf_engine_message_destroy (DConfEngineMessage *dcem) { @@ -58,12 +56,6 @@ dconf_engine_message_copy (DConfEngineMessage *orig, copy->parameters[i] = NULL; } -void -dconf_engine_set_service_func (DConfEngineServiceFunc func) -{ - dconf_engine_service_func = func; -} - static const gchar * dconf_engine_get_session_dir (void) { @@ -73,47 +65,6 @@ dconf_engine_get_session_dir (void) if (g_once_init_enter (&initialised)) { session_dir = dconf_shmdir_from_environment (); - - if (session_dir == NULL) - { - DConfEngineMessage dcem; - GVariant *parameters[2]; - GVariant *result; - - dcem.bus_types = "e"; - dcem.bus_name = "ca.desrt.dconf"; - dcem.object_path = "/ca/desrt/dconf/Writer"; - dcem.interface_name = "org.freedesktop.DBus.Properties"; - dcem.method_name = "Get"; - dcem.reply_type = G_VARIANT_TYPE ("(v)"); - parameters[0] = g_variant_new ("(ss)", - "ca.desrt.dconf.WriterInfo", - "ShmDirectory"); - parameters[1] = NULL; - dcem.parameters = parameters; - - result = dconf_engine_service_func (&dcem); - - g_variant_unref (parameters[0]); - - if (result != NULL) - { - GVariant *str; - - g_variant_get (result, "(v)", &str); - - if (g_variant_is_of_type (str, G_VARIANT_TYPE_STRING)) - session_dir = g_variant_dup_string (str, NULL); - else - g_critical ("dconf service sent invalid reply"); - - g_variant_unref (result); - g_variant_unref (str); - } - else - g_critical ("Unable to contact dconf service"); - } - g_once_init_leave (&initialised, 1); } diff --git a/engine/dconf-engine.h b/engine/dconf-engine.h index 98333fb..75c0474 100644 --- a/engine/dconf-engine.h +++ b/engine/dconf-engine.h @@ -69,7 +69,6 @@ typedef struct const GVariantType *reply_type; } DConfEngineMessage; -typedef GVariant * (*DConfEngineServiceFunc) (DConfEngineMessage *message); G_GNUC_INTERNAL void dconf_engine_message_copy (DConfEngineMessage *orig, DConfEngineMessage *copy); @@ -77,12 +76,9 @@ G_GNUC_INTERNAL void dconf_engine_message_destroy (DConfEngineMessage *message); G_GNUC_INTERNAL -void dconf_engine_set_service_func (DConfEngineServiceFunc func); -G_GNUC_INTERNAL DConfEngine * dconf_engine_new (const gchar *profile); G_GNUC_INTERNAL -DConfEngine * dconf_engine_new_for_db (DConfEngineServiceFunc *service, - const gchar *db_name); +DConfEngine * dconf_engine_new_for_db (const gchar *db_name); G_GNUC_INTERNAL guint64 dconf_engine_get_state (DConfEngine *engine); diff --git a/gsettings/dconfsettingsbackend.c b/gsettings/dconfsettingsbackend.c index a20225b..dc035ab 100644 --- a/gsettings/dconfsettingsbackend.c +++ b/gsettings/dconfsettingsbackend.c @@ -659,23 +659,9 @@ dconf_settings_backend_sync (GSettingsBackend *backend) g_static_mutex_unlock (&dcsb->lock); } -static GVariant * -dconf_settings_backend_service_func (DConfEngineMessage *dcem) -{ - g_assert (dcem->bus_types[0] == 'e'); - - return g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, - NULL, NULL), - dcem->bus_name, dcem->object_path, - dcem->interface_name, dcem->method_name, - dcem->parameters[0], dcem->reply_type, - 0, -1, NULL, NULL); -} - static void dconf_settings_backend_init (DConfSettingsBackend *dcsb) { - dconf_engine_set_service_func (dconf_settings_backend_service_func); dcsb->engine = dconf_engine_new (NULL); } |