From f5d1a92385d961ebd4751f6c9fa84e8ec37698b6 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 17 Apr 2009 12:47:16 +0100 Subject: tp_tube_constructor: get State property not priv->state is actually set --- libempathy/empathy-tp-tube.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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 #include +#include #include #include @@ -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; } -- cgit v1.2.3 From 5bd12dbfd7f41cbfdb8cfc7a783b756ce77da6e3 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 17 Apr 2009 13:58:20 +0100 Subject: add empathy_tp_tube_call_when_ready. Fixes bug #579735 --- libempathy/empathy-tp-tube.c | 137 +++++++++++++++++++++++++++++++++++++++++-- libempathy/empathy-tp-tube.h | 8 +++ 2 files changed, 140 insertions(+), 5 deletions(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index f9b374be5..746708fc4 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -60,12 +60,21 @@ free_empathy_tp_tube_accept_data (gpointer data) } +typedef struct { + EmpathyTpTubeReadyCb *callback; + gpointer user_data; + GDestroyNotify destroy; + GObject *weak_object; +} ReadyCbData; + + #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpTube) typedef struct { TpChannel *channel; EmpTubeChannelState state; gboolean ready; + GSList *ready_callbacks; } EmpathyTpTubePriv; enum @@ -165,6 +174,86 @@ tp_tube_get_property (GObject *object, } } +static void weak_object_notify (gpointer data, + GObject *old_object); + +static ReadyCbData * +ready_cb_data_new (EmpathyTpTube *self, + EmpathyTpTubeReadyCb *callback, + gpointer user_data, + GDestroyNotify destroy, + GObject *weak_object) +{ + ReadyCbData *d = g_slice_new0 (ReadyCbData); + d->callback = callback; + d->user_data = user_data; + d->destroy = destroy; + d->weak_object = weak_object; + + if (weak_object != NULL) + g_object_weak_ref (weak_object, weak_object_notify, self); + + return d; +} + +static void +ready_cb_data_free (ReadyCbData *data, + EmpathyTpTube *self) +{ + if (data->destroy != NULL) + data->destroy (data->user_data); + + if (data->weak_object != NULL) + g_object_weak_unref (data->weak_object, + weak_object_notify, self); + + g_slice_free (ReadyCbData, data); +} + +static void +weak_object_notify (gpointer data, + GObject *old_object) +{ + EmpathyTpTube *self = EMPATHY_TP_TUBE (data); + EmpathyTpTubePriv *priv = GET_PRIV (self); + GSList *l, *ln; + + for (l = priv->ready_callbacks ; l != NULL ; l = ln ) + { + ReadyCbData *d = (ReadyCbData *) l->data; + ln = g_slist_next (l); + + if (d->weak_object == old_object) + { + ready_cb_data_free (d, self); + priv->ready_callbacks = g_slist_delete_link (priv->ready_callbacks, + l); + } + } +} + + +static void +tube_is_ready (EmpathyTpTube *self, + const GError *error) +{ + EmpathyTpTubePriv *priv = GET_PRIV (self); + GSList *l; + + priv->ready = TRUE; + + for (l = priv->ready_callbacks ; l != NULL ; l = g_slist_next (l)) + { + ReadyCbData *data = (ReadyCbData *) l->data; + + data->callback (self, error, data->user_data, data->weak_object); + ready_cb_data_free (data, self); + } + + g_slist_free (priv->ready_callbacks); + priv->ready_callbacks = NULL; +} + static void got_tube_state_cb (TpProxy *proxy, const GValue *out_value, @@ -175,16 +264,17 @@ got_tube_state_cb (TpProxy *proxy, 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; + } + else + { + priv->state = g_value_get_uint (out_value); + g_object_notify (G_OBJECT (self), "state"); } - priv->state = g_value_get_uint (out_value); - g_object_notify (G_OBJECT (self), "state"); + tube_is_ready (self, error); } static GObject * @@ -218,7 +308,9 @@ tp_tube_constructor (GType type, static void tp_tube_finalize (GObject *object) { + EmpathyTpTube *self = EMPATHY_TP_TUBE (object); EmpathyTpTubePriv *priv = GET_PRIV (object); + GSList *l; DEBUG ("Finalizing: %p", object); @@ -231,6 +323,16 @@ tp_tube_finalize (GObject *object) g_object_unref (priv->channel); } + for (l = priv->ready_callbacks; l != NULL; l = g_slist_next (l)) + { + ReadyCbData *d = (ReadyCbData *) l->data; + + ready_cb_data_free (d, self); + } + + g_slist_free (priv->ready_callbacks); + priv->ready_callbacks = NULL; + G_OBJECT_CLASS (empathy_tp_tube_parent_class)->finalize (object); } @@ -455,3 +557,28 @@ empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, tp_g_value_slice_free (control_param); } + +void +empathy_tp_tube_call_when_ready (EmpathyTpTube *self, + EmpathyTpTubeReadyCb *callback, + gpointer user_data, + GDestroyNotify destroy, + GObject *weak_object) +{ + EmpathyTpTubePriv *priv = GET_PRIV (self); + + g_return_if_fail (self != NULL); + g_return_if_fail (callback != NULL); + + if (priv->ready) + { + callback (self, NULL, user_data, weak_object); + if (destroy != NULL) + destroy (user_data); + } + else + { + priv->ready_callbacks = g_slist_prepend (priv->ready_callbacks, + ready_cb_data_new (self, callback, user_data, destroy, weak_object)); + } +} diff --git a/libempathy/empathy-tp-tube.h b/libempathy/empathy-tp-tube.h index 8e63945e5..dd9ec4dcf 100644 --- a/libempathy/empathy-tp-tube.h +++ b/libempathy/empathy-tp-tube.h @@ -81,6 +81,14 @@ void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, TpSocketAddressType type, EmpatyTpTubeAcceptStreamTubeCb *callback, gpointer user_data); +typedef void (EmpathyTpTubeReadyCb) + (EmpathyTpTube *tube, const GError *error, gpointer user_data, + GObject *weak_object); + +void empathy_tp_tube_call_when_ready (EmpathyTpTube *tube, + EmpathyTpTubeReadyCb *callback, gpointer user_data, GDestroyNotify destroy, + GObject *weak_object); + G_END_DECLS #endif /* __EMPATHY_TP_TUBE_H__ */ -- cgit v1.2.3 From c8d23985b7754541cab512992294c19f5c87cfaa Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 17 Apr 2009 14:23:52 +0100 Subject: empathy-tube-handler: wait that tube is ready before announcing it --- libempathy/empathy-tube-handler.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/libempathy/empathy-tube-handler.c b/libempathy/empathy-tube-handler.c index 18cda18b3..43e19fde7 100644 --- a/libempathy/empathy-tube-handler.c +++ b/libempathy/empathy-tube-handler.c @@ -59,15 +59,38 @@ typedef struct gchar *channel; guint handle_type; guint handle; + EmpathyTpTube *tube; } IdleData; +static void +tube_ready_cb (EmpathyTpTube *tube, + const GError *error, + gpointer user_data, + GObject *weak_object) +{ + IdleData *idle_data = user_data; + + g_signal_emit (idle_data->thandler, signals[NEW_TUBE], 0, tube); +} + +static void +tube_ready_destroy_notify (gpointer data) +{ + IdleData *idle_data = data; + + g_object_unref (idle_data->tube); + g_free (idle_data->bus_name); + g_free (idle_data->connection); + g_free (idle_data->channel); + g_slice_free (IdleData, idle_data); +} + static gboolean tube_handler_handle_tube_idle_cb (gpointer data) { IdleData *idle_data = data; TpConnection *connection; TpChannel *channel; - EmpathyTpTube *tube; static TpDBusDaemon *daemon = NULL; DEBUG ("New tube to be handled"); @@ -82,16 +105,12 @@ tube_handler_handle_tube_idle_cb (gpointer data) idle_data->handle, NULL); tp_channel_run_until_ready (channel, NULL, NULL); - tube = empathy_tp_tube_new (channel); - g_signal_emit (idle_data->thandler, signals[NEW_TUBE], 0, tube); + idle_data->tube = empathy_tp_tube_new (channel); + empathy_tp_tube_call_when_ready (idle_data->tube, tube_ready_cb, idle_data, + tube_ready_destroy_notify, NULL); - g_object_unref (tube); g_object_unref (channel); g_object_unref (connection); - g_free (idle_data->bus_name); - g_free (idle_data->connection); - g_free (idle_data->channel); - g_slice_free (IdleData, idle_data); return FALSE; } -- cgit v1.2.3 From 869a8e72bfc0578b73e30cd90eb8e0ae0dd7f240 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 24 Apr 2009 16:45:51 +0100 Subject: document empathy_tp_tube_call_when_ready --- libempathy/empathy-tp-tube.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index 7d22f6b78..447e7b2bf 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -551,6 +551,33 @@ empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, tp_g_value_slice_free (control_param); } +/** + * EmpathyTpTubeReadyCb: + * @tube: an #EmpathyTpTube + * @error: %NULL on success, or the reason why the tube can't be ready + * @user_data: the @user_data passed to empathy_tp_tube_call_when_ready() + * @weak_object: the @weak_object passed to + * empathy_tp_tube_call_when_ready() + * + * Called as the result of empathy_tp_tube_call_when_ready(). If the + * tube's properties could be retrieved, + * @error is %NULL and @tube is considered to be ready. Otherwise, @error is + * non-%NULL and @tube is not ready. + */ + +/** + * empathy_tp_tube_call_when_ready: + * @tube: an #EmpathyTpTube + * @callback: called when the tube becomes ready + * @user_data: arbitrary user-supplied data passed to the callback + * @destroy: called to destroy @user_data + * @weak_object: object to reference weakly; if it is destroyed, @callback + * will not be called, but @destroy will still be called + * + * If @tube is ready for use, call @callback immediately, then return. + * Otherwise, arrange for @callback to be called when @tube becomes + * ready for use. + */ void empathy_tp_tube_call_when_ready (EmpathyTpTube *self, EmpathyTpTubeReadyCb *callback, @@ -558,7 +585,7 @@ empathy_tp_tube_call_when_ready (EmpathyTpTube *self, GDestroyNotify destroy, GObject *weak_object) { - EmpathyTpTubePriv *priv = GET_PRIV (self); +EmpathyTpTubePriv *priv = GET_PRIV (self); g_return_if_fail (self != NULL); g_return_if_fail (callback != NULL); -- cgit v1.2.3 From c2c648de9fcd4b7a78dd33f2d9502f08bc483eb7 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 24 Apr 2009 16:50:10 +0100 Subject: s/Empaty/Empathy --- libempathy/empathy-tp-tube.c | 6 +++--- libempathy/empathy-tp-tube.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index 447e7b2bf..8b41f7316 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -35,13 +35,13 @@ typedef struct { TpSocketAddressType type; - EmpatyTpTubeAcceptStreamTubeCb *callback; + EmpathyTpTubeAcceptStreamTubeCb *callback; gpointer user_data; } EmpathyTpTubeAcceptData; static EmpathyTpTubeAcceptData * new_empathy_tp_tube_accept_data (TpSocketAddressType type, - EmpatyTpTubeAcceptStreamTubeCb *callback, gpointer user_data) + EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data) { EmpathyTpTubeAcceptData *r; @@ -528,7 +528,7 @@ tp_tube_accept_stream_cb (TpProxy *proxy, void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, - TpSocketAddressType type, EmpatyTpTubeAcceptStreamTubeCb *callback, + TpSocketAddressType type, EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data) { EmpathyTpTubePriv *priv = GET_PRIV (tube); diff --git a/libempathy/empathy-tp-tube.h b/libempathy/empathy-tp-tube.h index dd9ec4dcf..004373090 100644 --- a/libempathy/empathy-tp-tube.h +++ b/libempathy/empathy-tp-tube.h @@ -73,12 +73,12 @@ EmpathyTpTube *empathy_tp_tube_new_stream_tube (EmpathyContact *contact, TpSocketAddressType type, const gchar *hostname, guint port, const gchar *service, GHashTable *parameters); -typedef void (EmpatyTpTubeAcceptStreamTubeCb) (EmpathyTpTube *tube, +typedef void (EmpathyTpTubeAcceptStreamTubeCb) (EmpathyTpTube *tube, const EmpathyTpTubeAddress *address, const GError *error, gpointer user_data); void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, - TpSocketAddressType type, EmpatyTpTubeAcceptStreamTubeCb *callback, + TpSocketAddressType type, EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data); typedef void (EmpathyTpTubeReadyCb) -- cgit v1.2.3 From 3960a24a5bbf6ac8ef4543ca6b1dd3f8bf7b7b37 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 24 Apr 2009 16:55:11 +0100 Subject: libempathy/empathy-tp-tube.[ch]: port to tp coding style --- libempathy/empathy-tp-tube.c | 72 +++++++++++++++++++++++--------------------- libempathy/empathy-tp-tube.h | 21 +++++++++---- 2 files changed, 52 insertions(+), 41 deletions(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index 8b41f7316..a66fce97b 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -41,7 +41,8 @@ typedef struct { static EmpathyTpTubeAcceptData * new_empathy_tp_tube_accept_data (TpSocketAddressType type, - EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data) + EmpathyTpTubeAcceptStreamTubeCb *callback, + gpointer user_data) { EmpathyTpTubeAcceptData *r; @@ -113,11 +114,11 @@ tp_tube_state_changed_cb (TpProxy *proxy, } static void -tp_tube_invalidated_cb (TpChannel *channel, - GQuark domain, - gint code, - gchar *message, - EmpathyTpTube *tube) +tp_tube_invalidated_cb (TpChannel *channel, + GQuark domain, + gint code, + gchar *message, + EmpathyTpTube *tube) { DEBUG ("Channel invalidated: %s", message); g_signal_emit (tube, signals[DESTROY], 0); @@ -125,9 +126,9 @@ tp_tube_invalidated_cb (TpChannel *channel, static void tp_tube_async_cb (TpChannel *channel, - const GError *error, - gpointer user_data, - GObject *tube) + const GError *error, + gpointer user_data, + GObject *tube) { if (error) DEBUG ("Error %s: %s", (gchar*) user_data, error->message); @@ -135,9 +136,9 @@ tp_tube_async_cb (TpChannel *channel, static void tp_tube_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { EmpathyTpTubePriv *priv = GET_PRIV (object); @@ -154,9 +155,9 @@ tp_tube_set_property (GObject *object, static void tp_tube_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { EmpathyTpTubePriv *priv = GET_PRIV (object); @@ -198,7 +199,7 @@ ready_cb_data_new (EmpathyTpTube *self, static void ready_cb_data_free (ReadyCbData *data, - EmpathyTpTube *self) + EmpathyTpTube *self) { if (data->destroy != NULL) data->destroy (data->user_data); @@ -235,7 +236,7 @@ weak_object_notify (gpointer data, static void tube_is_ready (EmpathyTpTube *self, - const GError *error) + const GError *error) { EmpathyTpTubePriv *priv = GET_PRIV (self); GSList *l; @@ -256,10 +257,10 @@ tube_is_ready (EmpathyTpTube *self, static void got_tube_state_cb (TpProxy *proxy, - const GValue *out_value, - const GError *error, - gpointer user_data, - GObject *weak_object) + 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); @@ -279,8 +280,8 @@ got_tube_state_cb (TpProxy *proxy, static GObject * tp_tube_constructor (GType type, - guint n_props, - GObjectConstructParam *props) + guint n_props, + GObjectConstructParam *props) { GObject *self; EmpathyTpTubePriv *priv; @@ -369,7 +370,7 @@ static void empathy_tp_tube_init (EmpathyTpTube *tube) { EmpathyTpTubePriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (tube, - EMPATHY_TYPE_TP_TUBE, EmpathyTpTubePriv); + EMPATHY_TYPE_TP_TUBE, EmpathyTpTubePriv); tube->priv = priv; } @@ -384,11 +385,11 @@ empathy_tp_tube_new (TpChannel *channel) EmpathyTpTube * empathy_tp_tube_new_stream_tube (EmpathyContact *contact, - TpSocketAddressType type, - const gchar *hostname, - guint port, - const gchar *service, - GHashTable *parameters) + TpSocketAddressType type, + const gchar *hostname, + guint port, + const gchar *service, + GHashTable *parameters) { TpConnection *connection; TpChannel *channel; @@ -491,10 +492,10 @@ OUT: static void tp_tube_accept_stream_cb (TpProxy *proxy, - const GValue *address, - const GError *error, - gpointer user_data, - GObject *weak_object) + const GValue *address, + const GError *error, + gpointer user_data, + GObject *weak_object) { EmpathyTpTube *tube = EMPATHY_TP_TUBE (weak_object); EmpathyTpTubeAcceptData *data = (EmpathyTpTubeAcceptData *)user_data; @@ -528,7 +529,8 @@ tp_tube_accept_stream_cb (TpProxy *proxy, void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, - TpSocketAddressType type, EmpathyTpTubeAcceptStreamTubeCb *callback, + TpSocketAddressType type, + EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data) { EmpathyTpTubePriv *priv = GET_PRIV (tube); @@ -585,7 +587,7 @@ empathy_tp_tube_call_when_ready (EmpathyTpTube *self, GDestroyNotify destroy, GObject *weak_object) { -EmpathyTpTubePriv *priv = GET_PRIV (self); + EmpathyTpTubePriv *priv = GET_PRIV (self); g_return_if_fail (self != NULL); g_return_if_fail (callback != NULL); diff --git a/libempathy/empathy-tp-tube.h b/libempathy/empathy-tp-tube.h index 004373090..79cffa1a2 100644 --- a/libempathy/empathy-tp-tube.h +++ b/libempathy/empathy-tp-tube.h @@ -70,23 +70,32 @@ struct _EmpathyTpTubeClass { GType empathy_tp_tube_get_type (void) G_GNUC_CONST; EmpathyTpTube *empathy_tp_tube_new (TpChannel *channel); EmpathyTpTube *empathy_tp_tube_new_stream_tube (EmpathyContact *contact, - TpSocketAddressType type, const gchar *hostname, guint port, - const gchar *service, GHashTable *parameters); + TpSocketAddressType type, + const gchar *hostname, + guint port, + const gchar *service, + GHashTable *parameters); typedef void (EmpathyTpTubeAcceptStreamTubeCb) (EmpathyTpTube *tube, - const EmpathyTpTubeAddress *address, const GError *error, + const EmpathyTpTubeAddress *address, + const GError *error, gpointer user_data); void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, - TpSocketAddressType type, EmpathyTpTubeAcceptStreamTubeCb *callback, + TpSocketAddressType type, + EmpathyTpTubeAcceptStreamTubeCb *callback, gpointer user_data); typedef void (EmpathyTpTubeReadyCb) - (EmpathyTpTube *tube, const GError *error, gpointer user_data, + (EmpathyTpTube *tube, + const GError *error, + gpointer user_data, GObject *weak_object); void empathy_tp_tube_call_when_ready (EmpathyTpTube *tube, - EmpathyTpTubeReadyCb *callback, gpointer user_data, GDestroyNotify destroy, + EmpathyTpTubeReadyCb *callback, + gpointer user_data, + GDestroyNotify destroy, GObject *weak_object); G_END_DECLS -- cgit v1.2.3 From d409796de148d0d2b126c0f5baba52479577dfe0 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 27 Apr 2009 11:11:10 +0100 Subject: document empathy-tp-tube --- libempathy/empathy-tp-tube.c | 56 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index a66fce97b..9502c3510 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -68,6 +68,14 @@ typedef struct { GObject *weak_object; } ReadyCbData; +/** + * SECTION:empathy-tp-tube + * @title:EmpathyTpTube + * @short_description: A wrapper around a Telepathy tube channel + * @include: libempathy/empathy-tp-tube.h + * + * #EmpathyTpTube is a convenient object wrapping a Telepathy tube channel. + */ #define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyTpTube) typedef struct @@ -347,15 +355,30 @@ empathy_tp_tube_class_init (EmpathyTpTubeClass *klass) object_class->set_property = tp_tube_set_property; object_class->get_property = tp_tube_get_property; + /** + * EmpathyTpTube:channel: + * + * The #TpChannel wrapped by the tube object. + */ g_object_class_install_property (object_class, PROP_CHANNEL, g_param_spec_object ("channel", "channel", "channel", TP_TYPE_CHANNEL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + /** + * EmpathyTpTube:state: + * + * The state of the tube. + */ g_object_class_install_property (object_class, PROP_STATE, g_param_spec_uint ("state", "state", "state", 0, NUM_EMP_TUBE_CHANNEL_STATES, 0, G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_STRINGS)); - + /** + * EmpathyTpTube::destroy: + * @self: the tube object + * + * Emitted when then tube has been invalidated. + */ signals[DESTROY] = g_signal_new ("destroy", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -375,6 +398,14 @@ empathy_tp_tube_init (EmpathyTpTube *tube) tube->priv = priv; } +/** + * empathy_tp_tube_new: + * @channel: a #TpChannel + * + * Creates a new #EmpathyTpTube. + * + * Return value: a new #EmpathyTpTube + */ EmpathyTpTube * empathy_tp_tube_new (TpChannel *channel) { @@ -383,6 +414,20 @@ empathy_tp_tube_new (TpChannel *channel) return g_object_new (EMPATHY_TYPE_TP_TUBE, "channel", channel, NULL); } +/** + * empathy_tp_tube_new_stream_tube: + * @contact: the #EmpathyContact to which the tube is offered + * @type: the type of the listening address of the local service. Either + * TP_SOCKET_ADDRESS_TYPE_IPV4 or TP_SOCKET_ADDRESS_TYPE_IPV6. + * @hostname: the address of the local service + * @port: the port of the local service + * @service: the service name of the tube + * @parameters: the parameters of the tube + * + * Creates and offers a new #EmpathyTpTube of ChannelType StreamTube. + * + * Return value: a new #EmpathyTpTube + */ EmpathyTpTube * empathy_tp_tube_new_stream_tube (EmpathyContact *contact, TpSocketAddressType type, @@ -527,6 +572,15 @@ tp_tube_accept_stream_cb (TpProxy *proxy, data->callback (tube, &eaddress, NULL, data->user_data); } +/** + * empathy_tp_tube_accept_stream_tube: + * @tube: an #EmpathyTpTube + * @type: the type of address the connection manager should listen on + * @callback: called when the tube has been accepted + * @user_data: arbitrary user-supplied data passed to the callback + * + * Accepts @tube of ChannelType StreamTube and call @callback once it's done. + */ void empathy_tp_tube_accept_stream_tube (EmpathyTpTube *tube, TpSocketAddressType type, -- cgit v1.2.3 From 265700bd18ddceae0c6a1b2c72c115af634cd1a0 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 27 Apr 2009 11:16:04 +0100 Subject: add '%' in front of constants --- libempathy/empathy-tp-tube.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libempathy/empathy-tp-tube.c b/libempathy/empathy-tp-tube.c index 9502c3510..b2ca9406d 100644 --- a/libempathy/empathy-tp-tube.c +++ b/libempathy/empathy-tp-tube.c @@ -418,7 +418,7 @@ empathy_tp_tube_new (TpChannel *channel) * empathy_tp_tube_new_stream_tube: * @contact: the #EmpathyContact to which the tube is offered * @type: the type of the listening address of the local service. Either - * TP_SOCKET_ADDRESS_TYPE_IPV4 or TP_SOCKET_ADDRESS_TYPE_IPV6. + * %TP_SOCKET_ADDRESS_TYPE_IPV4 or %TP_SOCKET_ADDRESS_TYPE_IPV6. * @hostname: the address of the local service * @port: the port of the local service * @service: the service name of the tube -- cgit v1.2.3