{ "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_paste)},
{ "FolderViewCSMDeleteFolder", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_folder) },
{ "FolderViewCSMSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
- { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_help) },
+ { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_csm_help) },
};
static const GtkActionEntry modest_header_view_action_entries [] = {
call this function before */
modest_main_window_disconnect_signals (MODEST_WINDOW (obj));
modest_main_window_cleanup_queue_error_signals ((ModestMainWindow *) obj);
+
+ if (priv->empty_view) {
+ g_object_unref (priv->empty_view);
+ priv->empty_view = NULL;
+ }
+
+ if (priv->header_view) {
+ g_object_unref (priv->header_view);
+ priv->header_view = NULL;
+ }
g_slist_free (priv->progress_widgets);
"account_changed",
G_CALLBACK (on_account_changed),
self);
-
- priv->sighandlers =
- modest_signal_mgr_connect (priv->sighandlers,
- G_OBJECT (modest_runtime_get_account_store()),
- "password_requested",
- G_CALLBACK (modest_ui_actions_on_password_requested),
- self);
}
static void
}
}
+typedef struct
+{
+ GtkWidget *folder_win;
+ gulong handler_id;
+} ShowHelper;
+
static void
modest_main_window_on_show (GtkWidget *self, gpointer user_data)
{
- GtkWidget *folder_win = (GtkWidget *) user_data;
+ ShowHelper *helper = (ShowHelper *) user_data;
+ GtkWidget *folder_win = helper->folder_win;
ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
modest_account_mgr_free_account_names (accounts);
update_menus (MODEST_MAIN_WINDOW (self));
}
+
+ /* Never call this function again (NOTE that it could happen
+ as we hide the main window instead of closing it while
+ there are operations ongoing) and free the helper */
+ g_signal_handler_disconnect (self, helper->handler_id);
+ g_slice_free (ShowHelper, helper);
}
static void
ModestConf *conf = NULL;
GtkAction *action = NULL;
GdkPixbuf *window_icon;
+ ShowHelper *helper;
self = MODEST_MAIN_WINDOW(g_object_new(MODEST_TYPE_MAIN_WINDOW, NULL));
priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
/* header view */
priv->header_view =
MODEST_HEADER_VIEW (modest_header_view_new (NULL, MODEST_HEADER_VIEW_STYLE_DETAILS));
+ g_object_ref (priv->header_view);
if (!priv->header_view)
g_printerr ("modest: cannot instantiate header view\n");
modest_header_view_set_style (priv->header_view, MODEST_HEADER_VIEW_STYLE_TWOLINES);
/* Empty view */
priv->empty_view = create_empty_view ();
gtk_widget_show (priv->empty_view);
+ g_object_ref (priv->empty_view);
/* Create scrolled windows */
folder_win = gtk_scrolled_window_new (NULL, NULL);
g_signal_connect (G_OBJECT(app), "notify::is-topmost",
G_CALLBACK (on_hildon_program_is_topmost_notify), self);
- g_signal_connect (G_OBJECT(self), "show",
- G_CALLBACK (modest_main_window_on_show), folder_win);
-
+ /* Connect to "show" action. We delay the creation of some
+ elements until that moment */
+ helper = g_slice_new0 (ShowHelper);
+ helper->folder_win = folder_win;
+ helper->handler_id = g_signal_connect (G_OBJECT(self), "show",
+ G_CALLBACK (modest_main_window_on_show),
+ helper);
+
/* Set window icon */
window_icon = modest_platform_get_icon (MODEST_APP_ICON, MODEST_ICON_SIZE_BIG);
if (window_icon) {
if (selected_headers > 1) {
hildon_banner_show_information (NULL, NULL, _("mcen_ib_select_one_message"));
return TRUE;
+ } else {
+ GtkTreePath * cursor_path;
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (widget), &cursor_path, NULL);
+ if (cursor_path == NULL) {
+ GtkTreeSelection *selection;
+ GList *list;
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget));
+ list = gtk_tree_selection_get_selected_rows (selection, NULL);
+
+ if (list != NULL)
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (widget), (GtkTreePath *) list->data, NULL, FALSE);
+ g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+ g_list_free (list);
+ }
}
}
} else if (MODEST_IS_FOLDER_VIEW (widget) && event->keyval == GDK_Right)
details widget */
GtkWidget *content = gtk_bin_get_child (GTK_BIN (priv->contents_widget));
if (content) {
- if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS)
- g_object_ref (content);
- else if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY) {
- g_object_ref (priv->empty_view);
+ if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY) {
gtk_container_remove (GTK_CONTAINER (content), priv->empty_view);
}
modest_folder_view_set_account_id_of_visible_server_account
(priv->folder_view,
modest_server_account_settings_get_account_name (store_settings));
+ modest_folder_view_select_first_inbox_or_local (priv->folder_view);
modest_window_set_active_account (MODEST_WINDOW (self), account_name);
+
action = gtk_action_group_get_action (priv->view_additions_group, account_name);
if (action != NULL) {
if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
}
}
- modest_folder_view_select_first_inbox_or_local (priv->folder_view);
-
-
/* Free */
if (settings) {
g_object_unref (store_settings);
{
g_return_if_fail (MODEST_IS_MAIN_WINDOW (gobject));
- if (!GTK_WIDGET_VISIBLE (gobject))
+ if (!GTK_WIDGET_VISIBLE (gobject)) {
+ TnyFolderStore *folder_store;
+ ModestMainWindowPrivate *priv;
+
+ /* Remove the currently shown banners */
remove_banners (MODEST_MAIN_WINDOW (gobject));
+
+ /* Force the folder view to sync the currently selected folder
+ to save the read/unread status and to expunge messages */
+ priv = MODEST_MAIN_WINDOW_GET_PRIVATE (gobject);
+ folder_store = modest_folder_view_get_selected (priv->folder_view);
+ if (TNY_IS_FOLDER (folder_store)) {
+ ModestMailOperation *mail_op;
+
+ mail_op = modest_mail_operation_new (NULL);
+ modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (),
+ mail_op);
+ modest_mail_operation_sync_folder (mail_op, TNY_FOLDER (folder_store), FALSE);
+ g_object_unref (mail_op);
+ g_object_unref (folder_store);
+ }
+ }
}
static void