diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2014-10-14 14:07:50 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2014-10-14 14:07:50 -0500 |
commit | 1e530c28e3b72cdb130594a8c46c6db462f49af4 (patch) | |
tree | 667f05aff95b4f9ce957af8673971bd2fbaa3f84 /src | |
parent | c07c186a14b2d72f4f48b77058c9597e91328707 (diff) | |
download | ayatana-indicator-power-1e530c28e3b72cdb130594a8c46c6db462f49af4.tar.gz ayatana-indicator-power-1e530c28e3b72cdb130594a8c46c6db462f49af4.tar.bz2 ayatana-indicator-power-1e530c28e3b72cdb130594a8c46c6db462f49af4.zip |
make service's bus connection a property so that IndicatorPowerTesting can listen for it and export an object before the name is acquired
Diffstat (limited to 'src')
-rw-r--r-- | src/service.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c index 32cec38..6bae06e 100644 --- a/src/service.c +++ b/src/service.c @@ -51,6 +51,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; enum { PROP_0, + PROP_BUS, PROP_DEVICE_PROVIDER, LAST_PROP }; @@ -839,6 +840,7 @@ on_bus_acquired (GDBusConnection * connection, g_debug ("bus acquired: %s", name); p->conn = g_object_ref (G_OBJECT (connection)); + g_object_notify_by_pspec (G_OBJECT(self), properties[PROP_BUS]); /* export the battery properties */ indicator_power_notifier_set_bus (p->notifier, connection); @@ -977,6 +979,10 @@ my_get_property (GObject * o, switch (property_id) { + case PROP_BUS: + g_value_set_object (value, p->conn); + break; + case PROP_DEVICE_PROVIDER: g_value_set_object (value, p->device_provider); break; @@ -1113,6 +1119,13 @@ indicator_power_service_class_init (IndicatorPowerServiceClass * klass) properties[PROP_0] = NULL; + properties[PROP_BUS] = g_param_spec_object ( + "bus", + "Bus", + "GDBusConnection for exporting menus/actions", + G_TYPE_OBJECT, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + properties[PROP_DEVICE_PROVIDER] = g_param_spec_object ( "device-provider", "Device Provider", |