https://bugzilla.gnome.org/show_bug.cgi?id=683409
+#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)
#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"
+
struct _EmpathyWebcredentialsMonitorPriv
{
struct _EmpathyWebcredentialsMonitorPriv
{
static void
empathy_webcredentials_monitor_dispose (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;
void (*chain_up) (GObject *) =
((GObjectClass *) empathy_webcredentials_monitor_parent_class)->dispose;
+ g_clear_object (&self->priv->proxy);
+
g_type_class_add_private (klass, sizeof (EmpathyWebcredentialsMonitorPriv));
}
g_type_class_add_private (klass, sizeof (EmpathyWebcredentialsMonitorPriv));
}
+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);
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 *
}
EmpathyWebcredentialsMonitor *