aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2009-01-31 01:06:41 +0800
committerxclaesse <xclaesse@4ee84921-47dd-4033-b63a-18d7a039a3e4>2009-01-31 01:06:41 +0800
commitffbd3119fda2d2fadfc75940e1b4722a912555ae (patch)
treed0f7faa4951e10a7cd0804cf6dd7e1279e51c2f9
parent9723fc74578697402b224e3579a7911a4ecba253 (diff)
downloadgsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar.gz
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar.bz2
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar.lz
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar.xz
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.tar.zst
gsoc2013-empathy-ffbd3119fda2d2fadfc75940e1b4722a912555ae.zip
generify notification; add idle activation of event
git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@2270 4ee84921-47dd-4033-b63a-18d7a039a3e4
-rw-r--r--src/empathy-status-icon.c62
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