Show the protocol logical id when a message retrieving fails
[modest] / src / modest-ui-actions.c
index 021a1bb..b998952 100644 (file)
@@ -223,14 +223,38 @@ modest_ui_actions_run_account_setup_wizard (ModestWindow *win)
        wizard = GTK_WINDOW (modest_platform_get_account_settings_wizard ());
        modest_window_mgr_set_modal (modest_runtime_get_window_mgr(), GTK_WINDOW (wizard), (GtkWindow *) win);
 
+#ifndef MODEST_TOOLKIT_HILDON2
        /* always present a main window in the background 
         * we do it here, so we cannot end up with two wizards (as this
         * function might be called in modest_window_mgr_get_main_window as well */
-       if (!win) 
+       if (!win)
                win = modest_window_mgr_get_main_window (modest_runtime_get_window_mgr(),
                                                         TRUE);  /* create if not existent */
+#else
+       if (!win) {
+               GList *window_list;
+               ModestWindowMgr *mgr;
+
+               mgr = modest_runtime_get_window_mgr ();
+
+               window_list = modest_window_mgr_get_window_list (mgr);
+               if (window_list == NULL) {
+                       win = MODEST_WINDOW (modest_accounts_window_new ());
+                       modest_window_mgr_register_window (mgr, win, NULL);
+                       gtk_widget_show_all (GTK_WIDGET (win));
 
-       gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
+                       win = MODEST_WINDOW (modest_folder_window_new (NULL));
+                       modest_window_mgr_register_window (mgr, win, NULL);
+
+                       gtk_widget_show_all (GTK_WIDGET (win));
+               } else {
+                       g_list_free (window_list);
+               }
+       }
+#endif
+
+       if (win)
+               gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win));
 
        /* make sure the mainwindow is visible. We need to present the
           wizard again to give it the focus back. show_all are needed
@@ -881,14 +905,30 @@ modest_ui_actions_msg_retrieval_check (ModestMailOperation *mail_op,
 
                if (error && ((error->code == TNY_SERVICE_ERROR_NO_SUCH_MESSAGE) ||
                              error->code == TNY_SERVICE_ERROR_MESSAGE_NOT_AVAILABLE)) {
-                       gchar *subject, *msg;
+                       gchar *subject, *msg, *format = NULL;
+                       TnyAccount *account;
                        subject = tny_header_dup_subject (header);
                        if (!subject)
-                               subject = g_strdup (_("mail_va_no_subject"));;
-                       msg = g_strdup_printf (_("emev_ni_ui_imap_message_not_available_in_server"),
-                                              subject);
+                               subject = g_strdup (_("mail_va_no_subject"));
+
+                       account = modest_mail_operation_get_account (mail_op);
+                       if (account) {
+                               ModestProtocol *protocol;
+                               ModestProtocolType proto;
+                               proto = modest_tny_account_get_protocol_type (account);
+                               protocol = modest_protocol_registry_get_protocol_by_type (modest_runtime_get_protocol_registry (), proto);
+                               if (protocol)
+                                       format = modest_protocol_get_translation (protocol, MODEST_PROTOCOL_TRANSLATION_MSG_NOT_AVAILABLE);
+                               g_object_unref (account);
+                       }
+
+                       if (!format)
+                               format = g_strdup (_("emev_ni_ui_imap_message_not_available_in_server"));
+
+                       msg = g_strdup_printf (format, subject);
                        modest_platform_run_information_dialog (NULL, msg, FALSE);
                        g_free (msg);
+                       g_free (format);
                        g_free (subject);
                }
 
@@ -995,7 +1035,6 @@ get_info_from_header (TnyHeader *header, gboolean *is_draft, gboolean *can_open)
                                           outbox which is not in
                                           failed state */
                                        *can_open = FALSE;
-                                       g_object_unref(traccount);
                                 }
 #endif
                        }
@@ -1434,7 +1473,7 @@ open_msg_from_header (TnyHeader *header, GtkTreeRowReference *rowref, ModestWind
        GtkWidget *header_view = NULL;
        OpenMsgHelper *helper;
        ModestWindow *window;
-               
+
        g_return_if_fail (header != NULL && rowref != NULL);
 
        mgr = modest_runtime_get_window_mgr ();
@@ -1451,7 +1490,7 @@ open_msg_from_header (TnyHeader *header, GtkTreeRowReference *rowref, ModestWind
 
        window = NULL;
        found = modest_window_mgr_find_registered_header (mgr, header, &window);
-               
+
        /* Do not open again the message and present the
           window to the user */
        if (found) {
@@ -3357,22 +3396,12 @@ modest_ui_actions_create_folder(GtkWidget *parent_window,
        TnyFolderStore *parent_folder;
 
 #ifdef MODEST_TOOLKIT_HILDON2
-       const gchar *active_account;
-       TnyAccount *account;
        ModestTnyAccountStore *acc_store;
 
-       /* In hildon 2.2 we use the current account as default parent */
        acc_store = modest_runtime_get_account_store ();
-       active_account = modest_window_get_active_account (MODEST_WINDOW (parent_window));
-       if (active_account) {
-               account = modest_tny_account_store_get_server_account (acc_store,
-                                                                      active_account,
-                                                                      TNY_ACCOUNT_TYPE_STORE);
-               parent_folder = TNY_FOLDER_STORE (account);
-       } else {
-               parent_folder = (TnyFolderStore *) 
-                       modest_tny_account_store_get_local_folders_account (acc_store);
-       }
+
+       parent_folder = (TnyFolderStore *) 
+               modest_tny_account_store_get_local_folders_account (acc_store);
 #else
        parent_folder = modest_folder_view_get_selected (MODEST_FOLDER_VIEW(folder_view));
 #endif
@@ -3429,7 +3458,7 @@ modest_ui_actions_rename_folder_error_handler (ModestMailOperation *mail_op,
                   message is opened for example */
                message = _("emev_ni_internal_error");
        } else {
-               message = _("emev_ib_ui_imap_unable_to_rename");
+               message = _CS("ckdg_ib_unable_to_remove");
        }
 
        /* We don't set a parent for the dialog because the dialog
@@ -5654,6 +5683,10 @@ modest_ui_actions_on_folder_window_move_to (GtkWidget *folder_view,
            !MODEST_IS_TNY_LOCAL_FOLDERS_ACCOUNT (dst_folder) &&
            !modest_tny_account_is_memory_card_account (TNY_ACCOUNT (dst_folder))) {
                do_xfer = FALSE;
+               /* Show an error */
+               modest_platform_run_information_dialog (win,
+                                                       _("mail_in_ui_folder_move_target_error"),
+                                                       FALSE);
        } else if (!TNY_IS_FOLDER (src_folder)) {
                g_warning ("%s: src_folder is not a TnyFolder.\n", __FUNCTION__);
                do_xfer = FALSE;
@@ -5662,7 +5695,7 @@ modest_ui_actions_on_folder_window_move_to (GtkWidget *folder_view,
        if (do_xfer) {
                MoveFolderInfo *info = g_new0 (MoveFolderInfo, 1);
                DoubleConnectionInfo *connect_info = g_slice_new (DoubleConnectionInfo);
-               
+
                info->src_folder = g_object_ref (src_folder);
                info->dst_folder = g_object_ref (dst_folder);
                info->delete_original = TRUE;
@@ -5676,6 +5709,7 @@ modest_ui_actions_on_folder_window_move_to (GtkWidget *folder_view,
                                                           TNY_FOLDER_STORE (src_folder), 
                                                           connect_info);
        }
+
        /* Frees */
        g_object_unref (src_folder);
 }