- if (g_list_length (URI_list) == 0)
- return;
-
-#ifdef MODEST_HAVE_HILDON_NOTIFY
- /* For any other case issue a notification */
- HildonNotification *notification;
- ModestMsgNotificationData *data;
- gint notif_id;
- gchar *from;
- TnyAccountStore *acc_store;
- TnyAccount *account;
-
- data = (ModestMsgNotificationData *) URI_list->data;
-
- /* String is changed in-place. There is no need to
- actually dup the data->from string but we just do
- it in order not to modify the original contents */
- from = g_strdup (data->from);
- modest_text_utils_get_display_address (from);
-
- /* Create notification */
- notification = hildon_notification_new (from,
- data->subject,
- "qgn_list_messagin",
- MODEST_NOTIFICATION_CATEGORY);
- g_free (from);
-
- /* Add DBus action */
- hildon_notification_add_dbus_action(notification,
- "default",
- "Cancel",
- MODEST_DBUS_SERVICE,
- MODEST_DBUS_OBJECT,
- MODEST_DBUS_IFACE,
- MODEST_DBUS_METHOD_OPEN_MESSAGE,
- G_TYPE_STRING, data->uri,
- -1);
-
- /* Set the led pattern */
- if (data->time)
- notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (notification),
- "time", data->time);
-
- notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (notification),
- "dialog-type", 4);
- notify_notification_set_hint_string(NOTIFY_NOTIFICATION (notification),
- "led-pattern",
- MODEST_NEW_MAIL_LIGHTING_PATTERN);
-
- /* Make the notification persistent */
- notify_notification_set_hint_byte (NOTIFY_NOTIFICATION (notification),
- "persistent", TRUE);
-
- /* Set the number of new notifications */
- notify_notification_set_hint_int32 (NOTIFY_NOTIFICATION (notification),
- "amount", g_list_length (URI_list));
-
- /* Set the account of the headers */
- acc_store = (TnyAccountStore *) modest_runtime_get_account_store ();
- account = tny_account_store_find_account (acc_store, data->uri);
- if (account) {
- const gchar *acc_name;
- acc_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (account);
- notify_notification_set_hint_string(NOTIFY_NOTIFICATION (notification),
- "email-account",
- acc_name);
- g_object_unref (account);
- }
-
- if (notify_notification_show (NOTIFY_NOTIFICATION (notification), NULL)) {
- GSList *notifications_list = NULL;
-
- /* Get previous notifications ids */
- notifications_list = modest_conf_get_list (modest_runtime_get_conf (),
- MODEST_CONF_NOTIFICATION_IDS,
- MODEST_CONF_VALUE_INT, NULL);
-
- /* Save id in the list */
- g_object_get(G_OBJECT (notification), "id", ¬if_id, NULL);
- notifications_list = g_slist_prepend (notifications_list, GINT_TO_POINTER(notif_id));
-
- /* We don't listen for the "closed" signal, because we
- don't care about if the notification was removed or
- not to store the list in gconf */
-
- /* Save the ids */
- modest_conf_set_list (modest_runtime_get_conf (), MODEST_CONF_NOTIFICATION_IDS,
- notifications_list, MODEST_CONF_VALUE_INT, NULL);
-
- g_slist_free (notifications_list);
- } else {
- g_warning ("Failed to send notification");
- }
-
-#endif /*MODEST_HAVE_HILDON_NOTIFY*/