aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-04-18 05:50:00 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-04-18 05:50:00 +0800
commita92c3b945d26bf8080adcda3286fbd7cb48de125 (patch)
tree864a2234845c70a00f62aa7cdfb743bafb91a34e
parentff728e13b1293c1a4ffa0bc5f772b544b5b780fd (diff)
downloadgsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar.gz
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar.bz2
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar.lz
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar.xz
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.tar.zst
gsoc2013-empathy-a92c3b945d26bf8080adcda3286fbd7cb48de125.zip
Always set urgency hint on p2p chat windows when receiving a message.
svn path=/trunk/; revision=962
-rw-r--r--libempathy-gtk/empathy-chat.c14
-rw-r--r--libempathy-gtk/empathy-chat.h1
-rw-r--r--libempathy/empathy-tp-chat.c24
-rw-r--r--libempathy/empathy-tp-chat.h1
-rw-r--r--src/empathy-chat-window.c8
5 files changed, 40 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index cdddf2d6c..3810e209b 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1754,6 +1754,20 @@ empathy_chat_get_remote_contact (EmpathyChat *chat)
return priv->remote_contact;
}
+guint
+empathy_chat_get_members_count (EmpathyChat *chat)
+{
+ EmpathyChatPriv *priv = GET_PRIV (chat);
+
+ g_return_val_if_fail (EMPATHY_IS_CHAT (chat), 0);
+
+ if (priv->tp_chat) {
+ return empathy_tp_chat_get_members_count (priv->tp_chat);
+ }
+
+ return 0;
+}
+
void
empathy_chat_clear (EmpathyChat *chat)
{
diff --git a/libempathy-gtk/empathy-chat.h b/libempathy-gtk/empathy-chat.h
index 49ce91723..2b5e64247 100644
--- a/libempathy-gtk/empathy-chat.h
+++ b/libempathy-gtk/empathy-chat.h
@@ -71,6 +71,7 @@ const gchar * empathy_chat_get_id (EmpathyChat *chat);
const gchar * empathy_chat_get_name (EmpathyChat *chat);
const gchar * empathy_chat_get_subject (EmpathyChat *chat);
EmpathyContact * empathy_chat_get_remote_contact (EmpathyChat *chat);
+guint empathy_chat_get_members_count (EmpathyChat *chat);
void empathy_chat_clear (EmpathyChat *chat);
void empathy_chat_scroll_down (EmpathyChat *chat);
void empathy_chat_cut (EmpathyChat *chat);
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 07d59cd84..430014759 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -54,7 +54,7 @@ struct _EmpathyTpChatPriv {
gboolean had_properties_list;
GPtrArray *properties;
gboolean ready;
- guint nb_members;
+ guint members_count;
};
typedef struct {
@@ -124,8 +124,8 @@ tp_chat_member_added_cb (EmpathyTpGroup *group,
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
- priv->nb_members++;
- if (priv->nb_members > 2 && priv->remote_contact) {
+ priv->members_count++;
+ if (priv->members_count > 2 && priv->remote_contact) {
/* We now have more than 2 members, this is not a p2p chat
* anymore. Remove the remote-contact as it makes no sense, the
* EmpathyContactList interface must be used now. */
@@ -133,7 +133,7 @@ tp_chat_member_added_cb (EmpathyTpGroup *group,
priv->remote_contact = NULL;
g_object_notify (G_OBJECT (chat), "remote-contact");
}
- if (priv->nb_members <= 2 && !priv->remote_contact &&
+ if (priv->members_count <= 2 && !priv->remote_contact &&
!empathy_contact_is_user (contact)) {
/* This is a p2p chat, if it's not ourself that means this is
* the remote contact with who we are chatting. This is to
@@ -158,8 +158,8 @@ tp_chat_member_removed_cb (EmpathyTpGroup *group,
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
- priv->nb_members--;
- if (priv->nb_members <= 2 && !priv->remote_contact) {
+ priv->members_count--;
+ if (priv->members_count <= 2 && !priv->remote_contact) {
GList *members, *l;
/* We are not a MUC anymore, get the remote contact back */
@@ -775,6 +775,8 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat)
G_CALLBACK (tp_chat_local_pending_cb),
chat);
empathy_run_until_ready (priv->group);
+ } else {
+ priv->members_count = 2;
}
if (tp_proxy_has_interface_by_id (priv->channel,
@@ -1146,6 +1148,16 @@ empathy_tp_chat_is_ready (EmpathyTpChat *chat)
return priv->ready;
}
+guint
+empathy_tp_chat_get_members_count (EmpathyTpChat *chat)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
+
+ g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), 0);
+
+ return priv->members_count;
+}
+
McAccount *
empathy_tp_chat_get_account (EmpathyTpChat *chat)
{
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index 27cbd557c..22ebee57a 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -59,6 +59,7 @@ const gchar * empathy_tp_chat_get_id (EmpathyTpChat *chat);
EmpathyContact*empathy_tp_chat_get_remote_contact (EmpathyTpChat *chat);
McAccount * empathy_tp_chat_get_account (EmpathyTpChat *chat);
gboolean empathy_tp_chat_is_ready (EmpathyTpChat *chat);
+guint empathy_tp_chat_get_members_count (EmpathyTpChat *chat);
void empathy_tp_chat_send (EmpathyTpChat *chat,
EmpathyMessage *message);
void empathy_tp_chat_set_state (EmpathyTpChat *chat,
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 9316d9868..b841506ba 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -757,12 +757,16 @@ chat_window_new_message_cb (EmpathyChat *chat,
priv = GET_PRIV (window);
has_focus = empathy_chat_window_has_focus (window);
-
+
if (has_focus && priv->current_chat == chat) {
return;
}
- needs_urgency = empathy_message_should_highlight (message);
+ if (empathy_chat_get_members_count (chat) > 2) {
+ needs_urgency = empathy_message_should_highlight (message);
+ } else {
+ needs_urgency = TRUE;
+ }
if (needs_urgency && !has_focus) {
chat_window_set_urgency_hint (window, TRUE);