diff options
author | Ryan Lortie <desrt@desrt.ca> | 2013-12-01 21:52:07 -0500 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2013-12-01 23:38:11 -0500 |
commit | 23acd17586c03d33f730bde47dc1e32e0aed85fe (patch) | |
tree | fa8baedb6adb6718af66aeb4cb4602441533eeb0 | |
parent | df3f799729212374364e90494a2f279a91f1e282 (diff) | |
download | dconf-23acd17586c03d33f730bde47dc1e32e0aed85fe.tar.gz |
engine: add ability to have non-dbus sources
Add the (theoretical) ability to have a non-writable source that is not
associated with a D-Bus instance by adding checks to ensure the bus type
is not equal to G_BUS_TYPE_NONE before performing D-Bus match rule
operations from the engine.
We don't perform checks before any other D-Bus operations because the
only other operation is a write and we only expect to support
non-writable sources in this manner.
-rw-r--r-- | engine/dconf-engine.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c index 50a461b..0810961 100644 --- a/engine/dconf-engine.c +++ b/engine/dconf-engine.c @@ -818,10 +818,11 @@ dconf_engine_watch_fast (DConfEngine *engine, ow->pending = engine->n_sources; for (i = 0; i < engine->n_sources; i++) - dconf_engine_dbus_call_async_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", - "/org/freedesktop/DBus", "org.freedesktop.DBus", "AddMatch", - dconf_engine_make_match_rule (engine->sources[i], path), - &ow->handle, NULL); + if (engine->sources[i]->bus_type) + dconf_engine_dbus_call_async_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", + "/org/freedesktop/DBus", "org.freedesktop.DBus", "AddMatch", + dconf_engine_make_match_rule (engine->sources[i], path), + &ow->handle, NULL); } void @@ -831,9 +832,10 @@ dconf_engine_unwatch_fast (DConfEngine *engine, gint i; for (i = 0; i < engine->n_sources; i++) - dconf_engine_dbus_call_async_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", - "/org/freedesktop/DBus", "org.freedesktop.DBus", "RemoveMatch", - dconf_engine_make_match_rule (engine->sources[i], path), NULL, NULL); + if (engine->sources[i]->bus_type) + dconf_engine_dbus_call_async_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", + "/org/freedesktop/DBus", "org.freedesktop.DBus", "RemoveMatch", + dconf_engine_make_match_rule (engine->sources[i], path), NULL, NULL); } static void @@ -851,17 +853,18 @@ dconf_engine_handle_match_rule_sync (DConfEngine *engine, */ for (i = 0; i < engine->n_sources; i++) - { - GVariant *result; + if (engine->sources[i]->bus_type) + { + GVariant *result; - result = dconf_engine_dbus_call_sync_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", - "/org/freedesktop/DBus", "org.freedesktop.DBus", method_name, - dconf_engine_make_match_rule (engine->sources[i], path), - G_VARIANT_TYPE_UNIT, NULL); + result = dconf_engine_dbus_call_sync_func (engine->sources[i]->bus_type, "org.freedesktop.DBus", + "/org/freedesktop/DBus", "org.freedesktop.DBus", method_name, + dconf_engine_make_match_rule (engine->sources[i], path), + G_VARIANT_TYPE_UNIT, NULL); - if (result) - g_variant_unref (result); - } + if (result) + g_variant_unref (result); + } } void |