aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/empathy-chat-manager.c2
-rw-r--r--src/empathy-main-window.c84
2 files changed, 85 insertions, 1 deletions
diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c
index 4ed26af30..e6ffaa0e9 100644
--- a/src/empathy-chat-manager.c
+++ b/src/empathy-chat-manager.c
@@ -148,7 +148,7 @@ process_tp_chat (EmpathyChatManager *self,
if (!tp_str_empty (id))
{
chat = empathy_chat_window_find_chat (account, id,
- empathy_tp_chat_is_sms_channel (tp_chat));
+ tp_text_channel_is_sms_channel ((TpTextChannel *) tp_chat));
}
if (chat != NULL)
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index 9cc65ba61..a9e76a286 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -432,11 +432,93 @@ main_window_auth_display (EmpathyMainWindow *window,
}
static void
+modify_event_count (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ EmpathyEvent *event,
+ gboolean increase)
+{
+ FolksIndividual *individual;
+ EmpathyContact *contact;
+ guint count;
+
+ gtk_tree_model_get (model, iter,
+ EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual,
+ EMPATHY_INDIVIDUAL_STORE_COL_EVENT_COUNT, &count,
+ -1);
+
+ if (individual == NULL)
+ return;
+
+ increase ? count++ : count--;
+
+ contact = empathy_contact_dup_from_folks_individual (individual);
+ if (contact == event->contact) {
+ gtk_tree_store_set (GTK_TREE_STORE (model), iter,
+ EMPATHY_INDIVIDUAL_STORE_COL_EVENT_COUNT, count, -1);
+ }
+
+ tp_clear_object (&contact);
+ g_object_unref (individual);
+}
+
+static gboolean
+increase_event_count_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ EmpathyEvent *event = user_data;
+
+ modify_event_count (model, iter, event, TRUE);
+
+ return FALSE;
+}
+
+static void
+increase_event_count (EmpathyMainWindow *self,
+ EmpathyEvent *event)
+{
+ EmpathyMainWindowPriv *priv = GET_PRIV (self);
+ GtkTreeModel *model;
+
+ model = GTK_TREE_MODEL (priv->individual_store);
+
+ gtk_tree_model_foreach (model, increase_event_count_foreach, event);
+}
+
+static gboolean
+decrease_event_count_foreach (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
+{
+ EmpathyEvent *event = user_data;
+
+ modify_event_count (model, iter, event, FALSE);
+
+ return FALSE;
+}
+
+static void
+decrease_event_count (EmpathyMainWindow *self,
+ EmpathyEvent *event)
+{
+ EmpathyMainWindowPriv *priv = GET_PRIV (self);
+ GtkTreeModel *model;
+
+ model = GTK_TREE_MODEL (priv->individual_store);
+
+ gtk_tree_model_foreach (model, decrease_event_count_foreach, event);
+}
+
+static void
main_window_event_added_cb (EmpathyEventManager *manager,
EmpathyEvent *event,
EmpathyMainWindow *window)
{
if (event->contact) {
+ increase_event_count (window, event);
+
main_window_flash_start (window);
} else if (event->type == EMPATHY_EVENT_TYPE_AUTH) {
main_window_auth_display (window, event);
@@ -460,6 +542,8 @@ main_window_event_removed_cb (EmpathyEventManager *manager,
return;
}
+ decrease_event_count (window, event);
+
data.on = FALSE;
data.event = event;
data.window = window;