diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-02 21:12:41 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-04-02 21:12:41 +0800 |
commit | 6165439156c260dd153c330069e1dd1955ffe444 (patch) | |
tree | 1c494687d53a57345fc5f19833ee8b125cd8ab37 /libempathy | |
parent | 094b72ebfbcc324f980378278e19206b20d5d15e (diff) | |
download | gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar.gz gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar.bz2 gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar.lz gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar.xz gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.tar.zst gsoc2013-empathy-6165439156c260dd153c330069e1dd1955ffe444.zip |
Add a 'ready' property telling if the object is ready to use.
svn path=/trunk/; revision=861
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-chat.c | 32 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.h | 1 |
2 files changed, 27 insertions, 6 deletions
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index c3f456faf..7068d6074 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -55,6 +55,7 @@ struct _EmpathyTpChatPriv { GSList *message_queue; gboolean had_properties_list; GPtrArray *properties; + gboolean ready; }; typedef struct { @@ -75,6 +76,7 @@ enum { PROP_CHANNEL, PROP_ACKNOWLEDGE, PROP_REMOTE_CONTACT, + PROP_READY, }; enum { @@ -652,6 +654,8 @@ empathy_tp_chat_set_property (EmpathyTpChat *chat, TpChatProperty *property; guint i; + g_return_if_fail (priv->ready); + for (i = 0; i < priv->properties->len; i++) { property = g_ptr_array_index (priv->properties, i); if (!tp_strdiff (property->name, name)) { @@ -699,6 +703,7 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat) empathy_debug (DEBUG_DOMAIN, "Channel ready"); + priv->ready = TRUE; if (tp_proxy_has_interface_by_id (priv->channel, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) { priv->group = empathy_tp_group_new (priv->account, priv->tp_chan); @@ -956,6 +961,13 @@ empathy_tp_chat_class_init (EmpathyTpChatClass *klass) "The remote contact if there is no group iface on the channel", EMPATHY_TYPE_CONTACT, G_PARAM_READABLE)); + g_object_class_install_property (object_class, + PROP_READY, + g_param_spec_boolean ("ready", + "Is the object ready", + "This object is can't be used until this becomes true", + FALSE, + G_PARAM_READABLE)); /* Signals */ signals[MESSAGE_RECEIVED] = @@ -1126,14 +1138,13 @@ void empathy_tp_chat_send (EmpathyTpChat *chat, EmpathyMessage *message) { - EmpathyTpChatPriv *priv; + EmpathyTpChatPriv *priv = GET_PRIV (chat); const gchar *message_body; EmpathyMessageType message_type; g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); g_return_if_fail (EMPATHY_IS_MESSAGE (message)); - - priv = GET_PRIV (chat); + g_return_if_fail (priv->ready); message_body = empathy_message_get_body (message); message_type = empathy_message_get_type (message); @@ -1151,11 +1162,10 @@ void empathy_tp_chat_set_state (EmpathyTpChat *chat, TpChannelChatState state) { - EmpathyTpChatPriv *priv; + EmpathyTpChatPriv *priv = GET_PRIV (chat); g_return_if_fail (EMPATHY_IS_TP_CHAT (chat)); - - priv = GET_PRIV (chat); + g_return_if_fail (priv->ready); empathy_debug (DEBUG_DOMAIN, "Set state: %d", state); tp_cli_channel_interface_chat_state_call_set_chat_state (priv->channel, -1, @@ -1192,3 +1202,13 @@ empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat) return priv->remote_contact; } +gboolean +empathy_tp_chat_is_ready (EmpathyTpChat *chat) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + + g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), FALSE); + + return priv->ready; +} + diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h index 3911e1dd1..3e196fadf 100644 --- a/libempathy/empathy-tp-chat.h +++ b/libempathy/empathy-tp-chat.h @@ -63,6 +63,7 @@ McAccount * empathy_tp_chat_get_account (EmpathyTpChat *chat); TpChan * empathy_tp_chat_get_channel (EmpathyTpChat *chat); const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat); EmpathyContact*empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat); +gboolean empathy_tp_chat_is_ready (EmpathyTpChat *chat); void empathy_tp_chat_send (EmpathyTpChat *chat, EmpathyMessage *message); void empathy_tp_chat_set_state (EmpathyTpChat *chat, |