- /* Get previous notifications ids */
- notifications_list = modest_conf_get_list (modest_runtime_get_conf (),
- MODEST_CONF_NOTIFICATION_IDS,
- MODEST_CONF_VALUE_INT, NULL);
-
- iter = URI_list;
- while (iter) {
- ModestMsgNotificationData *data;
- gboolean first_notification = TRUE;
- gint notif_id;
- gchar *from;
-
- data = (ModestMsgNotificationData *) iter->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);
-
- notification = hildon_notification_new (from,
- data->subject,
- "qgn_list_messagin",
- MODEST_NOTIFICATION_CATEGORY);
- g_free (from);
-
- 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);
-
- /* Play sound if the user wants. Show the LED
- pattern. Show and play just one */
- if (G_UNLIKELY (first_notification)) {
- TnyAccountStore *acc_store;
- TnyAccount *account;
-
- first_notification = FALSE;
-
- /* Set the led pattern and make the notification persistent */
- 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);
- notify_notification_set_hint_byte (NOTIFY_NOTIFICATION (notification),
- "persistent", TRUE);
-
- /* 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);
- }
+ 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);
+ }