X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmodest-ui-actions.c;h=8bde5cac7ea207646790114ba35ba81215943836;hb=a5f1624b5d7a4e153fd1e324f993917ec4492122;hp=e7b2b93d63b5c58bf9fa99b4d21dc756a2fd5319;hpb=3c4863031d94dbf7323f38f560486df580e475f9;p=modest diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index e7b2b93..8bde5ca 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -1544,7 +1544,7 @@ open_msg_from_header (TnyHeader *header, GtkTreeRowReference *rowref, ModestWind OpenMsgHelper *helper; ModestWindow *window; - g_return_if_fail (header != NULL && rowref != NULL); + g_return_if_fail (header != NULL && rowref != NULL && gtk_tree_row_reference_valid (rowref)); mgr = modest_runtime_get_window_mgr (); @@ -2151,6 +2151,40 @@ modest_ui_actions_on_sort (GtkAction *action, modest_utils_run_sort_dialog (GTK_WINDOW (window), MODEST_SORT_HEADERS); } +static gboolean +idle_refresh_folder (gpointer source) +{ + ModestHeaderView *header_view = NULL; + + /* If the window still exists */ + if (!GTK_IS_WIDGET (source) || + !GTK_WIDGET_VISIBLE (source)) + return FALSE; + + /* Refresh the current view */ +#ifdef MODEST_TOOLKIT_HILDON2 + if (MODEST_IS_HEADER_WINDOW (source)) + header_view = modest_header_window_get_header_view ((ModestHeaderWindow *) source); +#else + if (MODEST_IS_MAIN_WINDOW (source)) + header_view = modest_main_window_get_child_widget ((ModestMainWindow *) source, + MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW); +#endif + if (header_view) { + TnyFolder *folder = modest_header_view_get_folder (header_view); + if (folder) { + /* We must clear first, because otherwise set_folder will ignore + the change as the folders are the same */ + modest_header_view_clear (header_view); + modest_header_view_set_folder (header_view, folder, TRUE, + (ModestWindow *) source, NULL, NULL); + g_object_unref (folder); + } + } + + return FALSE; +} + static void update_account_cb (ModestMailOperation *self, TnyList *new_headers, @@ -2209,29 +2243,13 @@ update_account_cb (ModestMailOperation *self, } if (source) { - ModestHeaderView *header_view = NULL; - - /* Refresh the current view */ -#ifdef MODEST_TOOLKIT_HILDON2 - if (MODEST_IS_HEADER_WINDOW (source)) - header_view = modest_header_window_get_header_view ((ModestHeaderWindow *) source); -#else - if (MODEST_IS_MAIN_WINDOW (source)) - header_view = modest_main_window_get_child_widget ((ModestMainWindow *) source, - MODEST_MAIN_WINDOW_WIDGET_TYPE_HEADER_VIEW); -#endif - if (header_view) { - TnyFolder *folder = modest_header_view_get_folder (header_view); - if (folder) { - /* We must clear first, because otherwise set_folder will ignore - the change as the folders are the same */ - modest_header_view_clear (header_view); - modest_header_view_set_folder (header_view, folder, TRUE, - (ModestWindow *) source, NULL, NULL); - g_object_unref (folder); - } - } - + /* Refresh the current folder in an idle. We do this + in order to avoid refresh cancelations if the + currently viewed folder is the inbox */ + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, + idle_refresh_folder, + g_object_ref (source), + g_object_unref); g_object_unref (source); } } @@ -3127,12 +3145,6 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) data = modest_msg_edit_window_get_msg_data (edit_window); - if (data->subject == NULL || data->subject[0] == '\0') { - /* Empty subject -> no send */ - modest_msg_edit_window_free_msg_data (edit_window, data); - return FALSE; - } - recipients = g_strconcat (data->to?data->to:"", data->cc?data->cc:"", data->bcc?data->bcc:"", @@ -3168,7 +3180,7 @@ modest_ui_actions_on_send (GtkWidget *widget, ModestMsgEditWindow *edit_window) } /* Get the currently-active transport account for this modest account: */ - if (strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) != 0) { + if (account_name && strcmp (account_name, MODEST_LOCAL_FOLDERS_ACCOUNT_ID) != 0) { transport_account = TNY_TRANSPORT_ACCOUNT(modest_tny_account_store_get_server_account (modest_runtime_get_account_store (), @@ -3471,7 +3483,7 @@ do_create_folder_performer (gboolean canceled, /* This happens if we have selected the outbox folder as the parent */ - if (err->code == TNY_SERVICE_ERROR_UNKNOWN && + if (err && err->code == TNY_SERVICE_ERROR_UNKNOWN && TNY_IS_MERGE_FOLDER (helper->parent)) { /* Show an error and retry */ modest_platform_information_banner ((GtkWidget *) parent_window,