[empathy: 1/10] tp_tube_constructor: get State property not priv->state is actually set
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Subject: [empathy: 1/10] tp_tube_constructor: get State property not priv->state is actually set
- Date: Mon, 27 Apr 2009 06:16:52 -0400 (EDT)
commit f5d1a92385d961ebd4751f6c9fa84e8ec37698b6
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Fri Apr 17 12:47:16 2009 +0100
tp_tube_constructor: get State property not priv->state is actually set
---
libempathy/empathy-tp-tube.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c
index 64e4596..f9b374b 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]