aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-10-29 21:58:48 -0500
committerTed Gould <ted@canonical.com>2009-10-29 21:58:48 -0500
commita9e61b6f6196c06f79791de768e426b3e6539cec (patch)
treeb7054bd82f7cb9f74c79e75e5eb74cd92aab2bc1
parent02ce4f5c45f255c4058f1f2c8d5545569b498e64 (diff)
downloadlibayatana-indicator-a9e61b6f6196c06f79791de768e426b3e6539cec.tar.gz
libayatana-indicator-a9e61b6f6196c06f79791de768e426b3e6539cec.tar.bz2
libayatana-indicator-a9e61b6f6196c06f79791de768e426b3e6539cec.zip
A service proxy, and then calling watch.
-rw-r--r--libindicator/indicator-service-manager.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index 011f9c6..321b026 100644
--- a/libindicator/indicator-service-manager.c
+++ b/libindicator/indicator-service-manager.c
@@ -6,12 +6,15 @@
#include <dbus/dbus-glib-lowlevel.h>
#include "indicator-service-manager.h"
+#include "indicator-service-client.h"
+#include "dbus-shared.h"
/* Private Stuff */
typedef struct _IndicatorServiceManagerPrivate IndicatorServiceManagerPrivate;
struct _IndicatorServiceManagerPrivate {
gchar * name;
DBusGProxy * dbus_proxy;
+ DBusGProxy * service_proxy;
};
/* Signals Stuff */
@@ -99,6 +102,7 @@ indicator_service_manager_init (IndicatorServiceManager *self)
/* Get the private variables in a decent state */
priv->name = NULL;
priv->dbus_proxy = NULL;
+ priv->service_proxy = NULL;
/* Start talkin' dbus */
GError * error = NULL;
@@ -133,6 +137,11 @@ indicator_service_manager_dispose (GObject *object)
priv->dbus_proxy = NULL;
}
+ if (priv->service_proxy != NULL) {
+ g_object_unref(G_OBJECT(priv->service_proxy));
+ priv->service_proxy = NULL;
+ }
+
G_OBJECT_CLASS (indicator_service_manager_parent_class)->dispose (object);
return;
}
@@ -211,6 +220,20 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe
}
static void
+watch_cb (DBusGProxy * proxy, gint version, GError * error, gpointer user_data)
+{
+ IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data);
+
+ if (error != NULL) {
+ g_error("Unable to set watch on '%s': '%s'", priv->name, error->message);
+ g_error_free(error);
+ return;
+ }
+
+ return;
+}
+
+static void
start_service_cb (DBusGProxy * proxy, guint status, GError * error, gpointer user_data)
{
IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data);
@@ -225,6 +248,24 @@ start_service_cb (DBusGProxy * proxy, guint status, GError * error, gpointer use
return;
}
+ /* Woot! it's running. Let's do it some more. */
+ DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
+ if (error != NULL) {
+ g_error("Unable to get session bus: %s", error->message);
+ g_error_free(error);
+ return;
+ }
+
+ priv->service_proxy = dbus_g_proxy_new_for_name_owner(session_bus,
+ priv->name,
+ INDICATOR_SERVICE_OBJECT,
+ INDICATOR_SERVICE_INTERFACE,
+ &error);
+
+ org_ayatana_indicator_service_watch_async(priv->service_proxy,
+ watch_cb,
+ user_data);
+
return;
}