X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-ui-actions.c;h=f9da90a6ce76bf03012272075a2be04602fb2ead;hp=7dba80572a9507d5c8d996d992b7f181ebf5f928;hb=1c8928c2d9bf74d0df67eacf38aaf4947800dfb5;hpb=152ee6945dc5142b5e63f2a6ac6efc2dbb94df0c diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 7dba805..f9da90a 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -139,15 +139,14 @@ static void _on_send_receive_progress_changed (ModestMailOperation *mail_op ModestMailOperationState *state, gpointer user_data); -static gboolean -download_uncached_messages (TnyList *header_list, GtkWindow *win); +static gboolean download_uncached_messages (TnyList *header_list, + GtkWindow *win); -/*static gint -msgs_move_to_confirmation (GtkWindow *win, - TnyFolder *dest_folder, - gboolean delete, - TnyList *headers);*/ +/* static gint msgs_move_to_confirmation (GtkWindow *win, */ +/* TnyFolder *dest_folder, */ +/* gboolean delete, */ +/* TnyList *headers); */ /* Show the account creation wizard dialog. @@ -157,22 +156,36 @@ gboolean modest_run_account_setup_wizard (ModestWindow *win) { gboolean result = FALSE; - ModestEasysetupWizardDialog *wizard; + GtkDialog *wizard; - if (!win) - win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr ()); - - g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE); + wizard = modest_window_mgr_get_easysetup_dialog + (modest_runtime_get_window_mgr()); + if (wizard) { + /* old wizard is active already; present it and + * act as if the user cancelled the non-existing + * new one + */ + printf ("wizard already active\n"); + return FALSE; + } else { + /* there is no such wizard yet */ + wizard = GTK_DIALOG(modest_easysetup_wizard_dialog_new ()); + modest_window_mgr_set_easysetup_dialog + (modest_runtime_get_window_mgr(), GTK_DIALOG(wizard)); + } + - wizard = modest_easysetup_wizard_dialog_new_or_present (); + /* always present a main window in the background + * we do it here, so we cannot end up with to wizards (as this + * function might be called in modest_window_mgr_get_main_window as well */ + if (!win) + win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr()); - /* if wizard == NULL it means there is already a easy setup thingy running; - * in that case, don't do anything here; the call above will present it instead */ - if (!wizard) { - g_message ("%s: easysetup wizard already running", __FUNCTION__); - return FALSE; - } + /* make sure the mainwindow is visible */ + gtk_widget_show_all (GTK_WIDGET(win)); + gtk_window_present (GTK_WINDOW(win)); + gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win)); /* Don't make this a modal window, because secondary windows will then @@ -189,6 +202,10 @@ modest_run_account_setup_wizard (ModestWindow *win) gtk_widget_destroy (GTK_WIDGET (wizard)); + /* clear it from the window mgr */ + modest_window_mgr_set_easysetup_dialog + (modest_runtime_get_window_mgr(), NULL); + return result; } @@ -933,13 +950,23 @@ _modest_ui_actions_open (TnyList *headers, ModestWindow *win) TnyList *not_opened_headers = NULL; TnyHeaderFlags flags = 0; + g_return_if_fail (headers != NULL); + + /* Check that only one message is selected for opening */ + if (tny_list_get_length (headers) != 1) { + modest_platform_run_information_dialog ((win) ? GTK_WINDOW (win) : NULL, + _("mcen_ib_select_one_message")); + return; + } + + /* Look if we already have a message view for each header. If true, then remove the header from the list of headers to open */ mgr = modest_runtime_get_window_mgr (); iter = tny_list_create_iterator (headers); not_opened_headers = tny_simple_list_new (); - + while (!tny_iterator_is_done (iter)) { ModestWindow *window = NULL; @@ -1744,8 +1771,10 @@ modest_ui_actions_on_header_activated (ModestHeaderView *header_view, if (!header) return; - headers = tny_simple_list_new (); - tny_list_prepend (headers, G_OBJECT (header)); + +/* headers = tny_simple_list_new (); */ +/* tny_list_prepend (headers, G_OBJECT (header)); */ + headers = modest_header_view_get_selected_headers (header_view); _modest_ui_actions_open (headers, MODEST_WINDOW (main_window)); @@ -1903,17 +1932,18 @@ modest_ui_actions_on_item_not_found (ModestHeaderView *header_view,ModestItemTyp dialog = gtk_message_dialog_new (GTK_WINDOW (win), GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, - GTK_BUTTONS_OK, + GTK_BUTTONS_NONE, _("The %s you selected cannot be found"), item); + gtk_dialog_add_button (GTK_DIALOG (dialog),_("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT); gtk_dialog_run (GTK_DIALOG(dialog)); } else { dialog = gtk_dialog_new_with_buttons (_("Connection requested"), GTK_WINDOW (win), GTK_DIALOG_MODAL, - GTK_STOCK_CANCEL, + _("mcen_bd_dialog_cancel"), GTK_RESPONSE_REJECT, - GTK_STOCK_OK, + _("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT, NULL); txt = g_strdup_printf (_("This %s is not available in offline mode.\n" @@ -2597,9 +2627,9 @@ modest_ui_actions_on_password_requested (TnyAccountStore *account_store, GtkWidget *dialog = gtk_dialog_new_with_buttons (_("mail_ti_password_protected"), NULL, GTK_DIALOG_MODAL, - GTK_STOCK_OK, + _("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT, - GTK_STOCK_CANCEL, + _("mcen_bd_dialog_cancel"), GTK_RESPONSE_REJECT, NULL); #else @@ -3404,12 +3434,12 @@ create_move_to_dialog (GtkWindow *win, GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR | GTK_DIALOG_DESTROY_WITH_PARENT, NULL); - gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); + gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_ok"), GTK_RESPONSE_ACCEPT); /* We do this manually so GTK+ does not associate a response ID for * the button. */ - new_button = gtk_button_new_from_stock (GTK_STOCK_NEW); + new_button = gtk_button_new_from_stock (_("mcen_bd_new")); gtk_box_pack_end (GTK_BOX (GTK_DIALOG (dialog)->action_area), new_button, FALSE, FALSE, 0); - gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); + gtk_dialog_add_button (GTK_DIALOG (dialog), _("mcen_bd_dialog_cancel"), GTK_RESPONSE_REJECT); /* Create scrolled window */ scroll = gtk_scrolled_window_new (NULL, NULL); @@ -3419,21 +3449,48 @@ create_move_to_dialog (GtkWindow *win, /* Create folder view */ *tree_view = modest_platform_create_folder_view (NULL); -/* *tree_view = modest_folder_view_new (NULL); */ - g_signal_connect (G_OBJECT (new_button), "clicked", G_CALLBACK(create_move_to_dialog_on_new_folder), *tree_view); + g_signal_connect (G_OBJECT (new_button), + "clicked", + G_CALLBACK(create_move_to_dialog_on_new_folder), + *tree_view); /* It could happen that we're trying to move a message from a window (msg window for example) after the main window was closed, so we can not just get the model of the folder view */ if (MODEST_IS_FOLDER_VIEW (folder_view)) { + const gchar *visible_id = NULL; + modest_folder_view_copy_model (MODEST_FOLDER_VIEW(folder_view), MODEST_FOLDER_VIEW(*tree_view)); - } else + + visible_id = + modest_folder_view_get_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(folder_view)); + + /* Show the same account than the one that is shown in the main window */ + modest_folder_view_set_account_id_of_visible_server_account (MODEST_FOLDER_VIEW(*tree_view), + visible_id); + } else { + const gchar *active_account_name = NULL; + ModestAccountMgr *mgr = NULL; + ModestAccountData *acc_data = NULL; + modest_folder_view_update_model (MODEST_FOLDER_VIEW (*tree_view), TNY_ACCOUNT_STORE (modest_runtime_get_account_store ())); + active_account_name = modest_window_get_active_account (MODEST_WINDOW (win)); + mgr = modest_runtime_get_account_mgr (); + acc_data = modest_account_mgr_get_account_data (mgr, active_account_name); + + /* Set the new visible & active account */ + if (acc_data && acc_data->store_account) { + modest_folder_view_set_account_id_of_visible_server_account (MODEST_FOLDER_VIEW (*tree_view), + acc_data->store_account->account_name); + modest_account_mgr_free_account_data (mgr, acc_data); + } + } + /* Hide special folders */ modest_folder_view_show_non_move_folders (MODEST_FOLDER_VIEW (*tree_view), FALSE); @@ -3859,6 +3916,7 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, /* Get folder or messages to transfer */ if (gtk_widget_is_focus (folder_view)) { + GtkTreeSelection *sel; /* Allow only to transfer folders to the local root folder */ if (TNY_IS_ACCOUNT (dst_folder) && @@ -3866,7 +3924,9 @@ modest_ui_actions_on_main_window_move_to (GtkAction *action, goto end; /* Clean folder on header view before moving it */ - modest_header_view_clear (MODEST_HEADER_VIEW (header_view)); +/* modest_header_view_clear (MODEST_HEADER_VIEW (header_view)); */ + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_view)); + gtk_tree_selection_unselect_all (sel); if (TNY_IS_FOLDER (src_folder)) { mail_op =