aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-04-28 13:28:08 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-05 15:24:17 +0800
commit4f37d474725cd006eb627e10349e0361ce9a7b29 (patch)
tree3faaaf277e1a6af445391cac49f950d38018d5c2 /libempathy-gtk
parent1f46d6c5aa319ea7b81c29dcd08a0c7eb40d5789 (diff)
downloadgsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar.gz
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar.bz2
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar.lz
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar.xz
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.tar.zst
gsoc2013-empathy-4f37d474725cd006eb627e10349e0361ce9a7b29.zip
[chat] expose this property in EmpathyChat
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-chat.c44
-rw-r--r--libempathy-gtk/empathy-chat.h2
2 files changed, 46 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;
+ }
+}
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 8da8004ec..a5c0148a1 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -96,6 +96,8 @@ void empathy_chat_messages_read (EmpathyChat *self);
gboolean empathy_chat_is_composing (EmpathyChat *chat);
gboolean empathy_chat_is_sms_channel (EmpathyChat *self);
+guint empathy_chat_get_n_messages_sending (EmpathyChat *self);
+
G_END_DECLS
#endif /* __EMPATHY_CHAT_H__ */