* Removed the code that checks the message count before refreshing, the message...
authorSergio Villar Senin <svillar@igalia.com>
Thu, 14 Jun 2007 06:52:13 +0000 (06:52 +0000)
committerSergio Villar Senin <svillar@igalia.com>
Thu, 14 Jun 2007 06:52:13 +0000 (06:52 +0000)
* The first INBOX folder is now selected again when starting the application

pmo-trunk-r2219

src/modest-ui-actions.c
src/modest-widget-memory.c
src/widgets/modest-folder-view.c

index a215936..2658dcd 100644 (file)
@@ -1248,10 +1248,9 @@ folder_refreshed_cb (const GObject *obj,
                modest_main_window_set_contents_style (win,
                                                       MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
        } else {
-               modest_main_window_set_contents_style (win,
-                                                      MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
-
-               /* Restore configuration */
+               /* Restore configuration. There is no need to set the
+                  contents style to headers because it was already
+                  being done in folder_selection_changed */
                modest_widget_memory_restore (modest_runtime_get_conf (), 
                                              G_OBJECT(header_view),
                                              MODEST_CONF_HEADER_VIEW_KEY);
@@ -1291,23 +1290,24 @@ modest_ui_actions_on_folder_selection_changed (ModestFolderView *folder_view,
                                g_object_unref (account);
                        }
 
-                       if (tny_folder_get_all_count (TNY_FOLDER(folder_store)) == 0) 
-                               modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
-                       else
-                               modest_main_window_set_contents_style (main_window, MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
-
+                       /* Set the header view, we could change it to
+                          the empty view after the refresh */
+                       modest_main_window_set_contents_style (main_window, 
+                                                              MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
                        
                        modest_widget_memory_save (modest_runtime_get_conf(),
                                                   G_OBJECT(header_view),
                                                   MODEST_CONF_HEADER_VIEW_KEY);
-                       /* Set folder on header view */
+
+                       /* Set folder on header view. This function
+                          will call tny_folder_refresh_async so we
+                          pass a callback that will be called when
+                          finished. We use that callback to set the
+                          empty view if there are no messages */
                        modest_header_view_set_folder (MODEST_HEADER_VIEW(header_view),
                                                       TNY_FOLDER (folder_store),
                                                       folder_refreshed_cb,
                                                       main_window);
-                       modest_widget_memory_restore (modest_runtime_get_conf(),
-                                                     G_OBJECT(header_view),
-                                                     MODEST_CONF_HEADER_VIEW_KEY);
                } else {
                        /* Update the active account */
                        modest_window_set_active_account (MODEST_WINDOW (main_window), NULL);
index 1607ab7..794f7e8 100644 (file)
@@ -450,9 +450,6 @@ restore_settings_folder_view (ModestConf *conf,
 
        g_free (key);
 
-       /* Select the first INBOX folder */
-       modest_folder_view_select_first_inbox_or_local (folder_view);
-
        return TRUE;
 }
 
index d95c3a6..6107645 100644 (file)
@@ -803,6 +803,9 @@ modest_folder_view_update_model (ModestFolderView *self,
                g_object_unref (filter_model);
                        
        g_object_unref (sortable);
+
+       /* Select the first inbox or the local account if not found */
+       modest_folder_view_select_first_inbox_or_local (self);
                        
        return TRUE;
 }