X-Git-Url: http://git.maemo.org/git/?p=modest;a=blobdiff_plain;f=src%2Fmodest-ui-actions.c;h=7dba80572a9507d5c8d996d992b7f181ebf5f928;hp=3232958ab1a1dfba2f6f7c2b160e7cd81e29a462;hb=152ee6945dc5142b5e63f2a6ac6efc2dbb94df0c;hpb=7f13d34b4550c4dd99cd4e0bf10707f2e8b6bb41 diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index 3232958..7dba805 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -143,11 +143,11 @@ static gboolean download_uncached_messages (TnyList *header_list, GtkWindow *win); -static gint +/*static gint msgs_move_to_confirmation (GtkWindow *win, TnyFolder *dest_folder, gboolean delete, - TnyList *headers); + TnyList *headers);*/ /* Show the account creation wizard dialog. @@ -164,9 +164,17 @@ modest_run_account_setup_wizard (ModestWindow *win) g_return_val_if_fail (MODEST_IS_WINDOW(win), FALSE); - wizard = modest_easysetup_wizard_dialog_new (); + wizard = modest_easysetup_wizard_dialog_new_or_present (); + + /* 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; + } + gtk_window_set_transient_for (GTK_WINDOW (wizard), GTK_WINDOW (win)); - + /* Don't make this a modal window, because secondary windows will then * be unusable, freezing the UI: */ /* gtk_window_set_modal (GTK_WINDOW (wizard), TRUE); */ @@ -395,7 +403,6 @@ modest_ui_actions_on_delete_message (GtkAction *action, ModestWindow *win) tny_list_get_length(header_list)), desc); /* Confirmation dialog */ - printf("DEBUG: %s\n", __FUNCTION__); response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win), message); @@ -1721,15 +1728,6 @@ modest_ui_actions_on_header_selected (ModestHeaderView *header_view, if (!gtk_widget_is_focus (GTK_WIDGET(header_view))) gtk_widget_grab_focus (GTK_WIDGET(header_view)); - /* Update Main window title */ - if (gtk_widget_is_focus (GTK_WIDGET(header_view))) { - const gchar *subject = tny_header_get_subject (header); - if (subject && strlen(subject) > 0) - gtk_window_set_title (GTK_WINDOW (main_window), subject); - else - gtk_window_set_title (GTK_WINDOW (main_window), _("mail_va_no_subject")); - } - /* Update toolbar dimming state */ modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (main_window)); } @@ -1783,8 +1781,8 @@ folder_refreshed_cb (ModestMailOperation *mail_op, ModestMainWindow *win = NULL; GtkWidget *header_view; TnyFolder *current_folder; - gboolean folder_empty = TRUE; - gboolean all_marked_as_deleted = TRUE; + gboolean folder_empty = FALSE; + gboolean all_marked_as_deleted = FALSE; g_return_if_fail (TNY_IS_FOLDER (folder)); @@ -2090,7 +2088,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) gchar *from = modest_account_mgr_get_from_string (account_mgr, account_name); - modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent")); +/* modest_platform_information_banner (NULL, NULL, _("mcen_ib_outbox_waiting_to_be_sent")); */ /* Create the mail operation */ ModestMailOperation *mail_operation = modest_mail_operation_new (MODEST_MAIL_OPERATION_TYPE_SEND, G_OBJECT(edit_window)); @@ -2424,10 +2422,14 @@ modest_ui_actions_on_rename_folder (GtkAction *action, gchar *folder_name; gint response; const gchar *current_name; + TnyFolderStore *parent; current_name = tny_folder_get_name (TNY_FOLDER (folder)); - response = modest_platform_run_rename_folder_dialog (GTK_WINDOW (main_window), NULL, - current_name, &folder_name); + parent = tny_folder_get_folder_store (TNY_FOLDER (folder)); + response = modest_platform_run_rename_folder_dialog (GTK_WINDOW (main_window), + parent, current_name, + &folder_name); + g_object_unref (parent); if (response == GTK_RESPONSE_ACCEPT && strlen (folder_name) > 0) { ModestMailOperation *mail_op; @@ -2437,6 +2439,7 @@ modest_ui_actions_on_rename_folder (GtkAction *action, G_OBJECT(main_window), modest_ui_actions_rename_folder_error_handler, main_window); + modest_mail_operation_queue_add (modest_runtime_get_mail_operation_queue (), mail_op); @@ -3416,6 +3419,7 @@ 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); @@ -3423,13 +3427,14 @@ create_move_to_dialog (GtkWindow *win, 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)) - gtk_tree_view_set_model (GTK_TREE_VIEW (*tree_view), - gtk_tree_view_get_model (GTK_TREE_VIEW (folder_view))); - else + if (MODEST_IS_FOLDER_VIEW (folder_view)) { + modest_folder_view_copy_model (MODEST_FOLDER_VIEW(folder_view), + MODEST_FOLDER_VIEW(*tree_view)); + } else modest_folder_view_update_model (MODEST_FOLDER_VIEW (*tree_view), TNY_ACCOUNT_STORE (modest_runtime_get_account_store ())); + /* Hide special folders */ modest_folder_view_show_non_move_folders (MODEST_FOLDER_VIEW (*tree_view), FALSE); gtk_container_add (GTK_CONTAINER (scroll), *tree_view); @@ -3448,6 +3453,7 @@ create_move_to_dialog (GtkWindow *win, * Returns TRUE if at least one of the headers of the list belongs to * a message that has been fully retrieved. */ +#if 0 /* no longer in use. delete in 2007.10 */ static gboolean has_retrieved_msgs (TnyList *list) { @@ -3476,6 +3482,8 @@ has_retrieved_msgs (TnyList *list) return found; } +#endif /* 0 */ + /* * Shows a confirmation dialog to the user when we're moving messages @@ -3483,7 +3491,7 @@ has_retrieved_msgs (TnyList *list) * response. If it's other kind of movement the it always returns * GTK_RESPONSE_OK */ -static gint +gint msgs_move_to_confirmation (GtkWindow *win, TnyFolder *dest_folder, gboolean delete, @@ -3493,11 +3501,24 @@ msgs_move_to_confirmation (GtkWindow *win, /* If the destination is a local folder (or MMC folder )*/ if (!modest_tny_folder_is_remote_folder (dest_folder)) { -/* if (modest_tny_folder_is_local_folder (dest_folder)) { */ + + gboolean is_online; + TnyDevice *device; + TnyFolder *src_folder = NULL; TnyIterator *iter = NULL; TnyHeader *header = NULL; + /* get the device */ + + device = modest_runtime_get_device (); + if (device) + is_online = tny_device_is_online (device); + else { + g_warning ("failed to get tny device"); /* should not happend */ + is_online = FALSE; + } + /* Get source folder */ iter = tny_list_create_iterator (headers); header = TNY_HEADER (tny_iterator_get_current (iter)); @@ -3513,23 +3534,15 @@ msgs_move_to_confirmation (GtkWindow *win, return GTK_RESPONSE_CANCEL; /* If the source is a remote folder */ -/* if (!modest_tny_folder_is_local_folder (src_folder)) { */ - if (modest_tny_folder_is_remote_folder (src_folder)) { + if (!is_online && modest_tny_folder_is_remote_folder (src_folder)) { + const gchar *message = NULL; - gboolean cached = has_retrieved_msgs (headers); - if (cached) - message = ngettext ("mcen_nc_move_retrieve", "mcen_nc_move_retrieves", - tny_list_get_length (headers)); - else - message = ngettext ("mcen_nc_move_header", "mcen_nc_move_headers", - tny_list_get_length (headers)); - - if (cached && !delete) - response = GTK_RESPONSE_OK; - else - response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win), - (const gchar *) message); - } + message = ngettext ("mcen_nc_get_msg", "mcen_nc_get_msgs", + tny_list_get_length (headers)); + response = modest_platform_run_confirmation_dialog (GTK_WINDOW (win), + (const gchar *) message); + } else + response = GTK_RESPONSE_OK; g_object_unref (src_folder); } @@ -3767,8 +3780,12 @@ modest_ui_actions_xfer_messages_from_move_to (TnyFolderStore *dst_folder, dst_account = tny_folder_get_account (TNY_FOLDER (dst_folder)); proto_str = tny_account_get_proto (dst_account); - dst_is_pop = (modest_protocol_info_get_transport_store_protocol (proto_str) == - MODEST_PROTOCOL_STORE_POP); + + /* tinymail will return NULL for local folders it seems */ + dst_is_pop = proto_str && + (modest_protocol_info_get_transport_store_protocol (proto_str) == + MODEST_PROTOCOL_STORE_POP); + g_object_unref (dst_account); /* Get selected headers */ @@ -3812,7 +3829,6 @@ modest_ui_actions_xfer_messages_from_move_to (TnyFolderStore *dst_folder, g_object_unref (headers); } - /* * UI handler for the "Move to" action when invoked from the * ModestMainWindow