diff options
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r-- | libempathy-gtk/empathy-chat.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index d4e025f8d..3e8a9c70b 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -172,6 +172,7 @@ enum { PROP_REMOTE_CONTACT, PROP_SHOW_CONTACTS, PROP_SMS_CHANNEL, + PROP_N_MESSAGES_SENDING, }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -214,6 +215,10 @@ chat_get_property (GObject *object, case PROP_SMS_CHANNEL: g_value_set_boolean (value, priv->sms_channel); break; + case PROP_N_MESSAGES_SENDING: + g_value_set_uint (value, + empathy_chat_get_n_messages_sending (chat)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -2992,6 +2997,14 @@ empathy_chat_class_init (EmpathyChatClass *klass) FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (object_class, + PROP_N_MESSAGES_SENDING, + g_param_spec_uint ("n-messages-sending", + "Num Messages Sending", + "The number of messages being sent", + 0, G_MAXUINT, 0, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + signals[COMPOSING] = g_signal_new ("composing", G_OBJECT_CLASS_TYPE (object_class), @@ -3497,6 +3510,12 @@ chat_sms_channel_changed_cb (EmpathyChat *self) g_object_notify (G_OBJECT (self), "sms-channel"); } +static void +chat_n_messages_sending_changed_cb (EmpathyChat *self) +{ + g_object_notify (G_OBJECT (self), "n-messages-sending"); +} + void empathy_chat_set_tp_chat (EmpathyChat *chat, EmpathyTpChat *tp_chat) @@ -3549,6 +3568,9 @@ empathy_chat_set_tp_chat (EmpathyChat *chat, g_signal_connect_swapped (tp_chat, "notify::sms-channel", G_CALLBACK (chat_sms_channel_changed_cb), chat); + g_signal_connect_swapped (tp_chat, "notify::n-messages-sending", + G_CALLBACK (chat_n_messages_sending_changed_cb), + chat); /* Get initial value of properties */ properties = empathy_tp_chat_get_properties (priv->tp_chat); @@ -3873,3 +3895,25 @@ empathy_chat_is_sms_channel (EmpathyChat *self) return priv->sms_channel; } + +guint +empathy_chat_get_n_messages_sending (EmpathyChat *self) +{ + EmpathyChatPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_CHAT (self), 0); + + priv = GET_PRIV (self); + + if (priv->tp_chat == NULL) { + return 0; + } else { + guint n_messages; + + g_object_get (priv->tp_chat, + "n-messages-sending", &n_messages, + NULL); + + return n_messages; + } +} |