From 86b051a7fee204872253635064ac260c014864c7 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 30 Jan 2009 17:06:31 +0000 Subject: show notification on new event svn path=/trunk/; revision=2268 --- src/empathy-status-icon.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index 86fe27a4f..2dba6e076 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -27,6 +27,8 @@ #include #include +#include + #include #include #include @@ -63,6 +65,8 @@ typedef struct { GtkWidget *show_window_item; GtkWidget *message_item; GtkWidget *status_item; + + NotifyNotification *notification; } EmpathyStatusIconPriv; G_DEFINE_TYPE (EmpathyStatusIcon, empathy_status_icon, G_TYPE_OBJECT); @@ -113,6 +117,17 @@ status_icon_blink_timeout_cb (EmpathyStatusIcon *icon) return TRUE; } +static void +notify_call_cb (NotifyNotification * notification, + gchar *action_id, + gpointer data) +{ + if (strcmp (action_id, "accept") == 0) + g_print ("ACCEPTED"); + else + g_print ("REJECTED"); +} + static void status_icon_event_added_cb (EmpathyEventManager *manager, EmpathyEvent *event, @@ -137,6 +152,17 @@ status_icon_event_added_cb (EmpathyEventManager *manager, (GSourceFunc) status_icon_blink_timeout_cb, icon); } + + if (!priv->event) + return; + priv->notification = + notify_notification_new_with_status_icon (priv->event->message, + "Accept incoming call?", priv->event->icon_name, priv->icon); + notify_notification_add_action (priv->notification, + "accept", "Accept", notify_call_cb, icon, NULL); + notify_notification_add_action (priv->notification, + "reject", "Reject", notify_call_cb, icon, NULL); + notify_notification_show (priv->notification, NULL); } static void -- cgit v1.2.3