diff options
author | Frédéric Péters <fpeters@0d.be> | 2009-06-16 15:46:06 +0800 |
---|---|---|
committer | Frédéric Péters <fpeters@0d.be> | 2009-06-23 18:08:50 +0800 |
commit | 9b0797d859e999bf28145ed77aa13b3970b2a9a3 (patch) | |
tree | 7f81de1ca0f0868298a8ac5a3ecee059830c5027 /src | |
parent | a51deb704aa36bc8b6d02be102f90b666397ff16 (diff) | |
download | gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar.gz gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar.bz2 gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar.lz gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar.xz gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.tar.zst gsoc2013-empathy-9b0797d859e999bf28145ed77aa13b3970b2a9a3.zip |
Support for notification-only events
Add a "must_ack" attribute to events, set if there is no function
associated to the event, and add a timeout on such events to have them
removed automatically.
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-event-manager.c | 13 | ||||
-rw-r--r-- | src/empathy-event-manager.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 1a4ce0d65..0b842e369 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -249,6 +249,13 @@ event_remove (EventPriv *event) event_free (event); } +static gboolean +autoremove_event_timeout_cb (EventPriv *event) +{ + event_remove (event); + return FALSE; +} + static void event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact, const gchar *icon_name, const gchar *header, const gchar *message, @@ -262,6 +269,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->public.must_ack = (func != NULL); event->inhibit = FALSE; event->func = func; event->user_data = user_data; @@ -271,6 +279,11 @@ event_manager_add (EmpathyEventManager *manager, EmpathyContact *contact, DEBUG ("Adding event %p", event); priv->events = g_slist_prepend (priv->events, event); g_signal_emit (event->manager, signals[EVENT_ADDED], 0, event); + + if (!event->public.must_ack) + { + g_timeout_add_seconds (2, (GSourceFunc)autoremove_event_timeout_cb, event); + } } static void diff --git a/src/empathy-event-manager.h b/src/empathy-event-manager.h index 42fd0c090..af73c8ea7 100644 --- a/src/empathy-event-manager.h +++ b/src/empathy-event-manager.h @@ -53,6 +53,7 @@ typedef struct { gchar *icon_name; gchar *header; gchar *message; + gboolean must_ack; } EmpathyEvent; GType empathy_event_manager_get_type (void) G_GNUC_CONST; |