aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-09-21 13:55:02 +0200
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-09-21 13:55:02 +0200
commit50bee91a9241f69c12e39ad8e5bf160060a923c1 (patch)
treed5d3b5caa7261bdb0f20c8bfc9aad2b3e8ee957d /src
parent8be5a9d3030f0d52c16997f569d373b34658b471 (diff)
downloadayatana-indicator-power-50bee91a9241f69c12e39ad8e5bf160060a923c1.tar.gz
ayatana-indicator-power-50bee91a9241f69c12e39ad8e5bf160060a923c1.tar.bz2
ayatana-indicator-power-50bee91a9241f69c12e39ad8e5bf160060a923c1.zip
Do not activate g-s-d, but just watch dbus for g-s-d to appear
Fixes https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/854717
Diffstat (limited to 'src')
-rw-r--r--src/indicator-power.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index 13f5ff7..275e871 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -79,6 +79,7 @@ struct _IndicatorPowerPrivate
GCancellable *proxy_cancel;
GDBusProxy *proxy;
+ guint watcher_id;
GVariant *devices;
GVariant *device;
@@ -783,6 +784,28 @@ service_proxy_cb (GObject *object,
}
static void
+gsd_appeared_callback (GDBusConnection *connection,
+ const gchar *name,
+ const gchar *name_owner,
+ gpointer user_data)
+{
+ IndicatorPower *self = INDICATOR_POWER (user_data);
+ IndicatorPowerPrivate *priv = self->priv;
+
+ priv->proxy_cancel = g_cancellable_new ();
+
+ g_dbus_proxy_new (connection,
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+ NULL,
+ name,
+ POWER_DBUS_PATH,
+ POWER_DBUS_INTERFACE,
+ priv->proxy_cancel,
+ service_proxy_cb,
+ self);
+}
+
+static void
indicator_power_init (IndicatorPower *self)
{
IndicatorPowerPrivate *priv;
@@ -796,17 +819,14 @@ indicator_power_init (IndicatorPower *self)
priv->menu = NULL;
priv->accessible_desc = NULL;
- priv->proxy_cancel = g_cancellable_new();
-
- g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- DBUS_SERVICE,
- POWER_DBUS_PATH,
- POWER_DBUS_INTERFACE,
- priv->proxy_cancel,
- service_proxy_cb,
- self);
+
+ priv->watcher_id = g_bus_watch_name (G_BUS_TYPE_SESSION,
+ DBUS_SERVICE,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ gsd_appeared_callback,
+ NULL,
+ self,
+ NULL);
/* GSettings */
priv->settings = g_settings_new ("com.canonical.indicator.power");