diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-31 01:06:41 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2009-01-31 01:06:41 +0800 |
commit | 625c9210bd3be0e427f88475cc27948da50075da (patch) | |
tree | d0f7faa4951e10a7cd0804cf6dd7e1279e51c2f9 /src | |
parent | 6fd56eb46489ac3ce7f1191d6e15da2d5e2b9af8 (diff) | |
download | gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar.gz gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar.bz2 gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar.lz gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar.xz gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.tar.zst gsoc2013-empathy-625c9210bd3be0e427f88475cc27948da50075da.zip |
generify notification; add idle activation of event
svn path=/trunk/; revision=2270
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-status-icon.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/src/empathy-status-icon.c b/src/empathy-status-icon.c index 2dba6e076..254a1b863 100644 --- a/src/empathy-status-icon.c +++ b/src/empathy-status-icon.c @@ -65,12 +65,40 @@ 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); +static gboolean +status_icon_idle_event_activate (gpointer data) +{ + EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data); + EmpathyStatusIconPriv *priv = GET_PRIV (icon); + + if (priv->event) { + empathy_event_activate (priv->event); + } + + return FALSE; +} + +static void +status_icon_notification_cb (NotifyNotification *notification, + gchar *action_id, + gpointer data) +{ + EmpathyStatusIcon *icon = EMPATHY_STATUS_ICON (data); + + g_idle_add (status_icon_idle_event_activate, icon); +} + +static void +status_icon_notification_closed_cb (NotifyNotification *notification, + gpointer user_data) +{ + g_object_unref (notification); +} + static void status_icon_update_tooltip (EmpathyStatusIcon *icon) { @@ -116,18 +144,6 @@ 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, @@ -155,14 +171,16 @@ status_icon_event_added_cb (EmpathyEventManager *manager, 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); + NotifyNotification *notification = notify_notification_new_with_status_icon ("Incoming Something", priv->event->message, priv->event->icon_name, priv->icon); + notify_notification_add_action (notification, + "activate", + "Activate", + status_icon_notification_cb, + icon, NULL); + notify_notification_set_timeout (notification, + NOTIFY_EXPIRES_NEVER); + g_signal_connect (G_OBJECT (notification), "closed", G_CALLBACK (status_icon_notification_closed_cb), NULL); + notify_notification_show (notification, NULL); } static void |