aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:07:15 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-01-31 01:07:15 +0800
commita597d3012d2b09b0c453fab9725223137d42327f (patch)
treef4186734e220973e8b4dc783edaf63a6120ef216
parentaec95ff0ec211bb0c5d65e599033e9e60f18b29c (diff)
downloadgsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar.gz
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar.bz2
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar.lz
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar.xz
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.tar.zst
gsoc2013-empathy-a597d3012d2b09b0c453fab9725223137d42327f.zip
If the notification is not dismissed by the user, do not display other notifications for new incoming messages.
svn path=/trunk/; revision=2279
-rw-r--r--src/empathy-event-manager.c24
-rw-r--r--src/empathy-event-manager.h1
-rw-r--r--src/empathy-status-icon.c9
3 files changed, 31 insertions, 3 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 42eadf411..253067ff1 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -76,6 +76,7 @@ struct _EventPriv {
EmpathyEventManager *manager;
EventManagerApproval *approval;
EventFunc func;
+ gboolean inhibit;
gpointer user_data;
};
@@ -164,6 +165,7 @@ event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact,
event->public.icon_name = g_strdup (icon_name);
event->public.header = g_strdup (header);
event->public.message = g_strdup (message);
+ event->inhibit = FALSE;
event->func = func;
event->user_data = user_data;
event->manager = manager;
@@ -226,11 +228,18 @@ event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat,
TpChannel *channel;
EventPriv *event;
- /* update the event if it's referring to a chat which is already in the
+ /* try to update the event if it's referring to a chat which is already in the
* queue. */
event = event_lookup_by_approval (approval->manager, approval);
+ if (event != NULL && event->inhibit)
+ {
+ g_signal_handlers_disconnect_by_func (tp_chat,
+ event_manager_chat_message_received_cb, approval);
+ return;
+ }
+
sender = empathy_message_get_sender (message);
header = g_strdup_printf (_("New message from %s"),
empathy_contact_get_name (sender));
@@ -239,7 +248,7 @@ event_manager_chat_message_received_cb (EmpathyTpChat *tp_chat,
channel = empathy_tp_chat_get_channel (tp_chat);
if (event != NULL)
- event_update (approval->manager, event, EMPATHY_IMAGE_NEW_MESSAGE, header, msg);
+ event_update (approval->manager, event, EMPATHY_IMAGE_NEW_MESSAGE, header, msg);
else
event_manager_add (approval->manager, sender, EMPATHY_IMAGE_NEW_MESSAGE, header,
msg, approval, event_channel_process_func, NULL);
@@ -728,3 +737,14 @@ empathy_event_activate (EmpathyEvent *event_public)
else
event_remove (event);
}
+
+void
+empathy_event_inhibit_updates (EmpathyEvent *event_public)
+{
+ EventPriv *event = (EventPriv *) event_public;
+
+ g_return_if_fail (event_public != NULL);
+
+ event->inhibit = TRUE;
+}
+
diff --git a/src/empathy-event-manager.h b/src/empathy-event-manager.h
index 38de2c20b..42fd0c090 100644
--- a/src/empathy-event-manager.h
+++ b/src/empathy-event-manager.h
@@ -60,6 +60,7 @@ EmpathyEventManager *empathy_event_manager_dup_singleton (void);
EmpathyEvent * empathy_event_manager_get_top_event (EmpathyEventManager *manager);
GSList * empathy_event_manager_get_events (EmpathyEventManager *manager);
void empathy_event_activate (EmpathyEvent *event);
+void empathy_event_inhibit_updates (EmpathyEvent *event);
G_END_DECLS
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c
index 6635b91be..a1d3704ea 100644
--- a/src/empathy-status-icon.c
+++ b/src/empathy-status-icon.c
@@ -92,11 +92,18 @@ status_icon_notification_closed_cb (NotifyNotification *notification,
priv->notification = NULL;
}
+ if (!priv->event) {
+ return;
+ }
+
/* the notification has been closed by the user, see the
* DesktopNotification spec.
*/
- if (reason == 2 && priv->event) {
+ if (reason == 2) {
g_idle_add ((GSourceFunc) activate_event, priv->event);
+ } else {
+ /* inhibit other updates for this event */
+ empathy_event_inhibit_updates (priv->event);
}
}