+ TnyIterator *iter;
+ 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);
+
+ iter = tny_list_create_iterator (header_list);
+ while (!tny_iterator_is_done (iter)) {
+ gchar *url = NULL, *display_address = NULL, *summary = NULL;
+ const gchar *display_date;
+ TnyHeader *header = TNY_HEADER (tny_iterator_get_current (iter));
+ TnyFolder *folder = tny_header_get_folder (header);
+ gboolean first_notification = TRUE;
+ gint notif_id;
+
+ /* constant string, don't free */
+ display_date = modest_text_utils_get_display_date (tny_header_get_date_received (header));
+
+ display_address = g_strdup(tny_header_get_from (header));
+ modest_text_utils_get_display_address (display_address); /* string is changed in-place */
+
+ summary = g_strdup_printf ("%s - %s", display_date, display_address);
+ notification = hildon_notification_new (summary,
+ tny_header_get_subject (header),
+ "qgn_list_messagin",
+ "email.arrive");
+ /* Create the message URL */
+ url = g_strdup_printf ("%s/%s", tny_folder_get_url_string (folder),
+ tny_header_get_uid (header));
+
+ 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, url,
+ -1);
+
+ /* Play sound if the user wants. Show the LED
+ pattern. Show and play just one */
+ if (G_UNLIKELY (first_notification)) {
+ first_notification = FALSE;
+ if (modest_conf_get_bool (modest_runtime_get_conf (),
+ MODEST_CONF_PLAY_SOUND_MSG_ARRIVE,
+ NULL)) {
+ notify_notification_set_hint_string(NOTIFY_NOTIFICATION (notification),
+ "sound-file", "/usr/share/sounds/ui-new_email.wav");
+ }