or folders from that account (fixes NB#140276).
mgr = modest_runtime_get_window_mgr ();
window = (GtkWidget *) modest_window_mgr_show_initial_window (mgr);
- if (window) {
- modest_platform_remove_new_mail_notifications (FALSE);
- } else {
- g_printerr ("modest: failed to get main window instance\n");
- }
}
gdk_threads_leave (); /* CHECKED */
void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals)
+modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name)
{
g_warning ("NOT IMPLEMENTED %s", __FUNCTION__);
}
HildonWindowStack *stack;
gboolean nested_msg = FALSE;
ModestWindow *current_top;
+ const gchar *acc_name;
g_return_val_if_fail (MODEST_IS_HILDON2_WINDOW_MGR (self), FALSE);
g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE);
*handler_id = g_signal_connect (window, "delete-event", G_CALLBACK (on_window_destroy), self);
g_hash_table_insert (priv->destroy_handlers, window, handler_id);
+ if (!MODEST_IS_MSG_EDIT_WINDOW (window) &&
+ !MODEST_IS_ACCOUNTS_WINDOW (window)) {
+ acc_name = modest_window_get_active_account (window);
+
+ if (acc_name) {
+ modest_platform_remove_new_mail_notifications (FALSE, acc_name);
+ }
+ }
+
/* Show toolbar always */
modest_window_show_toolbar (window, TRUE);
/* Stop blinking if the screen becomes on */
if (priv->display_state == OSSO_DISPLAY_ON)
- modest_platform_remove_new_mail_notifications (TRUE);
+ modest_platform_remove_new_mail_notifications (TRUE, NULL);
}
static gboolean
hildon_program_set_can_hibernate (app, FALSE);
/* Remove new mail visual notifications */
- modest_platform_remove_new_mail_notifications (TRUE);
+ modest_platform_remove_new_mail_notifications (TRUE, NULL);
} else {
/* Allow hibernation if the program has gone to the background: */
/* Stop blinking if the screen becomes on */
if (priv->display_state == OSSO_DISPLAY_ON)
- modest_platform_remove_new_mail_notifications (TRUE);
+ modest_platform_remove_new_mail_notifications (TRUE, NULL);
}
ModestWindow *
gchar *from;
TnyAccountStore *acc_store;
TnyAccount *account;
+ gchar *acc_name;
data = (ModestMsgNotificationData *) URI_list->data;
/* Set the account of the headers */
acc_store = (TnyAccountStore *) modest_runtime_get_account_store ();
account = tny_account_store_find_account (acc_store, data->uri);
+ acc_name = NULL;
if (account) {
- const gchar *acc_name;
- acc_name =
- modest_tny_account_get_parent_modest_account_name_for_server_account (account);
+ acc_name = g_strdup (modest_tny_account_get_parent_modest_account_name_for_server_account (account));
notify_notification_set_hint_string(NOTIFY_NOTIFICATION (notification),
"email-account",
acc_name);
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);
+ if (acc_name) {
+ notifications_list = modest_account_mgr_get_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ MODEST_CONF_VALUE_INT, FALSE);
+ }
/* Save id in the list */
g_object_get(G_OBJECT (notification), "id", ¬if_id, NULL);
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);
-
+ if (acc_name)
+ modest_account_mgr_set_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ notifications_list, MODEST_CONF_VALUE_INT, FALSE);
+
g_slist_free (notifications_list);
} else {
g_warning ("Failed to send notification");
}
+ g_free (acc_name);
#endif /*MODEST_HAVE_HILDON_NOTIFY*/
}
void
-modest_platform_remove_new_mail_notifications (gboolean only_visuals)
+modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name)
{
if (only_visuals) {
#ifdef MODEST_HAVE_MCE
GSList *notif_list = NULL;
/* Get previous notifications ids */
- notif_list = modest_conf_get_list (modest_runtime_get_conf (),
- MODEST_CONF_NOTIFICATION_IDS,
- MODEST_CONF_VALUE_INT, NULL);
+ notif_list = modest_account_mgr_get_list (modest_runtime_get_account_mgr (),
+ acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ MODEST_CONF_VALUE_INT, FALSE);
while (notif_list) {
gint notif_id;
}
/* Save the ids */
- modest_conf_set_list (modest_runtime_get_conf (), MODEST_CONF_NOTIFICATION_IDS,
- notif_list, MODEST_CONF_VALUE_INT, NULL);
+ modest_account_mgr_set_list (modest_runtime_get_account_mgr (), acc_name,
+ MODEST_ACCOUNT_NOTIFICATION_IDS,
+ notif_list, MODEST_CONF_VALUE_INT, FALSE);
g_slist_free (notif_list);
gchar * modest_account_mgr_get_string (ModestAccountMgr *self, const gchar *name,
const gchar *key, gboolean server_account);
+GSList * modest_account_mgr_get_list (ModestAccountMgr *self, const gchar *name,
+ const gchar *key, ModestConfValueType list_type,
+ gboolean server_account);
+gboolean modest_account_mgr_set_list (ModestAccountMgr *self,
+ const gchar *name,
+ const gchar *key,
+ GSList *val,
+ ModestConfValueType list_type,
+ gboolean server_account);
G_END_DECLS
#endif /* __MODEST_ACCOUNT_MGR_H__ */
/* Notification ids */
#define MODEST_CONF_NOTIFICATION_IDS (modest_defs_namespace ("/notification_ids")) /* list of ints */
+#define MODEST_ACCOUNT_NOTIFICATION_IDS "notification_ids" /* list of ints */
#ifdef MODEST_TOOLKIT_HILDON2
#define MODEST_EXAMPLE_EMAIL_ADDRESS _("mcen_va_example_email_address")
retval = 1;
goto cleanup;
}
- /* Remove new mail notifications if exist */
- modest_platform_remove_new_mail_notifications (FALSE);
}
gtk_main ();
/**
* modest_platform_remove_new_mail_notifications:
* @only_visuals: remove only the visual notifications (like LEDs)
+ * @acc_name: account to remove notifications
*
* Removes all the active new mail notifications
**/
-void modest_platform_remove_new_mail_notifications (gboolean only_visuals);
+void modest_platform_remove_new_mail_notifications (gboolean only_visuals, const gchar *acc_name);
/* ModestConnectedPerformer:
* @canceled: whether or not the user canceled
distinguish if the notification belongs to
this account or not, so for safety reasons
we remove them all */
- modest_platform_remove_new_mail_notifications (FALSE);
+ modest_platform_remove_new_mail_notifications (FALSE, account_name);
} else {
g_warning ("%s: modest_account_mgr_remove_account() failed.\n", __FUNCTION__);
}