aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-17 19:47:16 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-04-21 23:46:47 +0800
commitf5d1a92385d961ebd4751f6c9fa84e8ec37698b6 (patch)
treec8541ed0656138c23cae7dc21392e05765f0e814
parent4612cc1ae9a36749e3b6f78e669343b84a77448f (diff)
downloadgsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar.gz
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar.bz2
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar.lz
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar.xz
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.tar.zst
gsoc2013-empathy-f5d1a92385d961ebd4751f6c9fa84e8ec37698b6.zip
tp_tube_constructor: get State property not priv->state is actually set
-rw-r--r--libempathy/empathy-tp-tube.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c
index 64e45962d..f9b374be5 100644
--- a/libempathy/empathy-tp-tube.c
+++ b/libempathy/empathy-tp-tube.c
@@ -22,6 +22,7 @@
#include <config.h>
#include <telepathy-glib/connection.h>
+#include <telepathy-glib/proxy.h>
#include <telepathy-glib/util.h>
#include <extensions/extensions.h>
@@ -64,6 +65,7 @@ typedef struct
{
TpChannel *channel;
EmpTubeChannelState state;
+ gboolean ready;
} EmpathyTpTubePriv;
enum
@@ -91,6 +93,10 @@ tp_tube_state_changed_cb (TpProxy *proxy,
{
EmpathyTpTubePriv *priv = GET_PRIV (tube);
+ if (!priv->ready)
+ /* We didn't get the state yet */
+ return;
+
DEBUG ("Tube state changed");
priv->state = state;
@@ -159,6 +165,28 @@ tp_tube_get_property (GObject *object,
}
}
+static void
+got_tube_state_cb (TpProxy *proxy,
+ const GValue *out_value,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ EmpathyTpTube *self = EMPATHY_TP_TUBE (user_data);
+ EmpathyTpTubePriv *priv = GET_PRIV (self);
+
+ priv->ready = TRUE;
+
+ if (error != NULL)
+ {
+ DEBUG ("Error getting State property: %s", error->message);
+ return;
+ }
+
+ priv->state = g_value_get_uint (out_value);
+ g_object_notify (G_OBJECT (self), "state");
+}
+
static GObject *
tp_tube_constructor (GType type,
guint n_props,
@@ -174,10 +202,16 @@ tp_tube_constructor (GType type,
g_signal_connect (priv->channel, "invalidated",
G_CALLBACK (tp_tube_invalidated_cb), self);
+ priv->ready = FALSE;
+
emp_cli_channel_interface_tube_connect_to_tube_channel_state_changed (
TP_PROXY (priv->channel), tp_tube_state_changed_cb, NULL, NULL,
self, NULL);
+ tp_cli_dbus_properties_call_get (priv->channel, -1,
+ EMP_IFACE_CHANNEL_INTERFACE_TUBE, "State", got_tube_state_cb,
+ self, NULL, G_OBJECT (self));
+
return self;
}