[dconf/wip/varlib: 7/12] engine: add ability to have non-dbus sources
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf/wip/varlib: 7/12] engine: add ability to have non-dbus sources
- Date: Fri, 6 Dec 2013 20:34:26 +0000 (UTC)
commit 23acd17586c03d33f730bde47dc1e32e0aed85fe
Author: Ryan Lortie <desrt desrt ca>
Date: Sun Dec 1 21:52:07 2013 -0500
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.
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]