aboutsummaryrefslogtreecommitdiff
path: root/src/status-provider-telepathy.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-09-10 13:58:24 -0500
committerTed Gould <ted@canonical.com>2009-09-10 13:58:24 -0500
commitff14ae64765101fc90581d5b927d68ce2b15297c (patch)
tree5019ad63074412eb30ca95345811868dcc7dd349 /src/status-provider-telepathy.c
parentd97e28df45374c687c60529b5e868e2910187571 (diff)
downloadayatana-indicator-session-ff14ae64765101fc90581d5b927d68ce2b15297c.tar.gz
ayatana-indicator-session-ff14ae64765101fc90581d5b927d68ce2b15297c.tar.bz2
ayatana-indicator-session-ff14ae64765101fc90581d5b927d68ce2b15297c.zip
Checking to see if we have the proxy already.
Diffstat (limited to 'src/status-provider-telepathy.c')
-rw-r--r--src/status-provider-telepathy.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/status-provider-telepathy.c b/src/status-provider-telepathy.c
index 4430a8e..58bc6ca 100644
--- a/src/status-provider-telepathy.c
+++ b/src/status-provider-telepathy.c
@@ -121,8 +121,14 @@ build_telepathy_proxy (StatusProviderTelepathy * self)
{
StatusProviderTelepathyPrivate * priv = STATUS_PROVIDER_TELEPATHY_GET_PRIVATE(self);
+ if (priv->proxy != NULL) {
+ g_debug("Hmm, being asked to build a proxy we alredy have.");
+ return;
+ }
+
GError * error = NULL;
+ /* Grabbing the session bus */
DBusGConnection * session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error);
if (session_bus == NULL) {
g_warning("Unable to connect to Session Bus: %s", error == NULL ? "No message" : error->message);
@@ -130,7 +136,7 @@ build_telepathy_proxy (StatusProviderTelepathy * self)
return;
}
- priv->proxy = NULL;
+ /* Get the proxy to Mission Control */
priv->proxy = dbus_g_proxy_new_for_name_owner(session_bus,
"org.freedesktop.Telepathy.MissionControl",
"/org/freedesktop/Telepathy/MissionControl",
@@ -138,10 +144,13 @@ build_telepathy_proxy (StatusProviderTelepathy * self)
&error);
if (priv->proxy != NULL) {
+ /* If it goes, we set the proxy to NULL */
g_object_add_weak_pointer (G_OBJECT(priv->proxy), (gpointer *)&priv->proxy);
+ /* And we clean up other variables associated */
g_signal_connect(G_OBJECT(priv->proxy), "destroy",
G_CALLBACK(proxy_destroy), self);
+ /* Set up the signal handler for watching when status changes. */
dbus_g_object_register_marshaller(_status_provider_telepathy_marshal_VOID__UINT_STRING,
G_TYPE_NONE,
G_TYPE_UINT,