From 1e530c28e3b72cdb130594a8c46c6db462f49af4 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 14 Oct 2014 14:07:50 -0500 Subject: make service's bus connection a property so that IndicatorPowerTesting can listen for it and export an object before the name is acquired --- src/service.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') 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", -- cgit v1.2.3