aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-05 16:47:41 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-07 15:14:13 +0800
commit15813f2b1708d9ec01e593a2f19ca4e5592e8052 (patch)
treeb603f9d55a3d852c20b162fdb29d34c0c275dcc8
parentbe4231bfd2bd06d23a2ddf9c5910444eb2541f5d (diff)
downloadgsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar.gz
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar.bz2
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar.lz
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar.xz
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.tar.zst
gsoc2013-empathy-15813f2b1708d9ec01e593a2f19ca4e5592e8052.zip
webcredentials-monitor: get a proxy on the D-Bus object
https://bugzilla.gnome.org/show_bug.cgi?id=683409
-rw-r--r--ubuntu-online-accounts/mc-plugin/empathy-webcredentials-monitor.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/ubuntu-online-accounts/mc-plugin/empathy-webcredentials-monitor.c b/ubuntu-online-accounts/mc-plugin/empathy-webcredentials-monitor.c
index e8911bc47..7e061368f 100644
--- a/ubuntu-online-accounts/mc-plugin/empathy-webcredentials-monitor.c
+++ b/ubuntu-online-accounts/mc-plugin/empathy-webcredentials-monitor.c
@@ -1,9 +1,17 @@
#include "config.h"
+#include <gio/gio.h>
+
+#include <telepathy-glib/telepathy-glib.h>
+
#include "empathy-webcredentials-monitor.h"
G_DEFINE_TYPE (EmpathyWebcredentialsMonitor, empathy_webcredentials_monitor, G_TYPE_OBJECT)
+#define WEBCRED_BUS_NAME "com.canonical.indicators.webcredentials"
+#define WEBCRED_PATH "/com/canonical/indicators/webcredentials"
+#define WEBCRED_IFACE "com.canonical.indicators.webcredentials"
+
enum
{
FIRST_PROP = 1,
@@ -21,7 +29,7 @@ static guint signals[LAST_SIGNAL];
struct _EmpathyWebcredentialsMonitorPriv
{
- gpointer badger;
+ GDBusProxy *proxy;
};
static void
@@ -69,10 +77,12 @@ empathy_webcredentials_monitor_constructed (GObject *object)
static void
empathy_webcredentials_monitor_dispose (GObject *object)
{
- //EmpathyWebcredentialsMonitor *self = EMPATHY_WEBCREDENTIALS_MONITOR (object);
+ EmpathyWebcredentialsMonitor *self = EMPATHY_WEBCREDENTIALS_MONITOR (object);
void (*chain_up) (GObject *) =
((GObjectClass *) empathy_webcredentials_monitor_parent_class)->dispose;
+ g_clear_object (&self->priv->proxy);
+
chain_up (object);
}
@@ -102,10 +112,40 @@ empathy_webcredentials_monitor_class_init (
}
static void
+proxy_new_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ EmpathyWebcredentialsMonitor *self;
+ TpWeakRef *wr = user_data;
+ GError *error = NULL;
+
+ self = tp_weak_ref_dup_object (wr);
+ if (self == NULL)
+ goto out;
+
+ self->priv->proxy = g_dbus_proxy_new_for_bus_finish (result, &error);
+ if (self->priv->proxy == NULL)
+ {
+ g_debug ("Failed to create webcredentials proxy: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+out:
+ tp_weak_ref_destroy (wr);
+ g_clear_object (&self);
+}
+
+static void
empathy_webcredentials_monitor_init (EmpathyWebcredentialsMonitor *self)
{
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
EMPATHY_TYPE_WEBCREDENTIALS_MONITOR, EmpathyWebcredentialsMonitorPriv);
+
+ g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, NULL,
+ WEBCRED_BUS_NAME, WEBCRED_PATH, WEBCRED_IFACE,
+ NULL, proxy_new_cb, tp_weak_ref_new (self, NULL, NULL));
}
EmpathyWebcredentialsMonitor *