+static void
+status_icon_local_pending_cb (EmpathyContactManager *manager,
+ GossipContact *contact,
+ gchar *message,
+ EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv;
+ StatusIconEvent *event;
+ gchar *str;
+ GList *l;
+
+ priv = GET_PRIV (icon);
+
+ for (l = priv->events; l; l = l->next) {
+ if (gossip_contact_equal (contact, ((StatusIconEvent*)l->data)->user_data)) {
+ return;
+ }
+ }
+
+ str = g_strdup_printf (_("Subscription requested for %s\n"
+ "Message: %s"),
+ gossip_contact_get_name (contact),
+ message);
+
+ event = status_icon_event_new (icon, GTK_STOCK_DIALOG_QUESTION, str);
+ event->user_data = g_object_ref (contact);
+ event->func = status_icon_event_subscribe_cb;
+
+ g_free (str);
+}
+
+static void
+status_icon_event_subscribe_cb (StatusIconEvent *event)
+{
+ GossipContact *contact;
+
+ contact = GOSSIP_CONTACT (event->user_data);
+
+ g_object_unref (contact);
+}
+
+static StatusIconEvent *
+status_icon_event_new (EmpathyStatusIcon *icon,
+ const gchar *icon_name,
+ const gchar *message)
+{
+ EmpathyStatusIconPriv *priv;
+ StatusIconEvent *event;
+
+ priv = GET_PRIV (icon);
+
+ event = g_slice_new0 (StatusIconEvent);
+ event->icon_name = g_strdup (icon_name);
+ event->message = g_strdup (message);
+
+ priv->events = g_list_append (priv->events, event);
+ if (!priv->blink_timeout) {
+ priv->blink_timeout = g_timeout_add (BLINK_TIMEOUT,
+ (GSourceFunc) status_icon_event_timeout_cb,
+ icon);
+ status_icon_event_timeout_cb (icon);
+ }
+
+ return event;
+}
+
+static void
+status_icon_event_remove (EmpathyStatusIcon *icon,
+ StatusIconEvent *event)
+{
+ EmpathyStatusIconPriv *priv;
+
+ priv = GET_PRIV (icon);
+
+ if (event->func) {
+ event->func (event);
+ }
+ priv->events = g_list_remove (priv->events, event);
+ status_icon_event_free (event);
+ status_icon_update_tooltip (icon);
+
+ if (priv->events) {
+ return;
+ }
+
+ status_icon_set_from_state (icon);
+ priv->showing_state_icon = TRUE;
+
+ if (priv->blink_timeout) {
+ g_source_remove (priv->blink_timeout);
+ priv->blink_timeout = 0;
+
+ }
+}
+
+static gboolean
+status_icon_event_timeout_cb (EmpathyStatusIcon *icon)
+{
+ EmpathyStatusIconPriv *priv;
+
+ priv = GET_PRIV (icon);
+
+ priv->showing_state_icon = !priv->showing_state_icon;
+
+ if (priv->showing_state_icon) {
+ status_icon_set_from_state (icon);
+ } else {
+ StatusIconEvent *event;
+
+ event = priv->events->data;
+ gtk_status_icon_set_from_icon_name (priv->icon, event->icon_name);
+ }
+ status_icon_update_tooltip (icon);
+
+ return TRUE;
+}
+
+static void
+status_icon_event_free (StatusIconEvent *event)
+{
+ g_free (event->icon_name);
+ g_free (event->message);
+ g_slice_free (StatusIconEvent, event);
+}
+