This is a manual merge of branch drop split view intro trunk.
[modest] / src / hildon2 / modest-main-window.c
index 25e7e1d..efd2150 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, Nokia Corporation
+/* Copyright (c) 2006, 2008 Nokia Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -64,6 +64,8 @@
 #include "modest-osso-state-saving.h"
 #include "modest-text-utils.h"
 #include "modest-signal-mgr.h"
+#include <tny-gtk-folder-store-tree-model.h>
+#include <modest-accounts-window.h>
 
 #define MODEST_MAIN_WINDOW_ACTION_GROUP_ADDITIONS "ModestMainWindowActionAdditions"
 
@@ -77,10 +79,6 @@ static void modest_main_window_class_init  (ModestMainWindowClass *klass);
 static void modest_main_window_init        (ModestMainWindow *obj);
 static void modest_main_window_finalize    (GObject *obj);
 
-static gboolean modest_main_window_window_state_event (GtkWidget *widget, 
-                                                      GdkEventWindowState *event, 
-                                                      gpointer userdata);
-
 static void connect_signals (ModestMainWindow *self);
 
 static void modest_main_window_disconnect_signals (ModestWindow *self);
@@ -144,6 +142,10 @@ static void on_refresh_account_action_activated   (GtkAction *action,
 static void on_send_receive_csm_activated         (GtkMenuItem *item,
                                                   gpointer user_data);
 
+static void on_folder_view_row_activated (GtkTreeView *tree_view,
+                                         GtkTreePath *tree_path,
+                                         GtkTreeViewColumn *column,
+                                         gpointer userdata);
 static void on_msg_count_changed (ModestHeaderView *header_view,
                                  TnyFolder *folder,
                                  TnyFolderChange *change,
@@ -166,15 +168,13 @@ static void      on_folder_selection_changed (ModestFolderView *folder_view,
                                              TnyFolderStore *folder_store, 
                                              gboolean selected,
                                              ModestMainWindow *main_window);
-                                               
+
 static void set_at_least_one_account_visible(ModestMainWindow *self);
 
 static void on_updating_msg_list (ModestHeaderView *header_view,
                                  gboolean starting,
                                  gpointer user_data);
 
-static gboolean restore_paned_timeout_handler (gpointer *data);
-
 static gboolean show_opening_banner (gpointer user_data);
 
 static void on_window_destroy (GtkObject *widget,
@@ -186,8 +186,6 @@ static void on_window_hide (GObject    *gobject,
 
 typedef struct _ModestMainWindowPrivate ModestMainWindowPrivate;
 struct _ModestMainWindowPrivate {
-       GtkWidget *msg_paned;
-       GtkWidget *main_paned;
        GtkWidget *main_vbox;
        GtkWidget *contents_widget;
        GtkWidget *empty_view;
@@ -203,7 +201,7 @@ struct _ModestMainWindowPrivate {
        GtkWidget   *refresh_toolitem;
        ModestToolBarModes current_toolbar_mode;
 
-       /* Merge ids used to add/remove accounts to the ViewMenu*/
+       /* Merge ids used to add/remove accounts to the Accounts Menu*/
        GByteArray *merge_ids;
        GtkActionGroup *view_additions_group;
 
@@ -225,7 +223,6 @@ struct _ModestMainWindowPrivate {
        gboolean wait_for_settings;
 
        guint progress_bar_timeout;
-       guint restore_paned_timeout;
 
        /* Signal handler UIDs */
        GList *queue_err_signals;
@@ -269,8 +266,6 @@ static const GtkActionEntry modest_folder_view_action_entries [] = {
        { "FolderViewCSMRenameFolder", NULL, N_("mcen_me_user_renamefolder"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_rename_folder) },
        { "FolderViewCSMPasteMsgs", NULL, N_("mcen_me_inbox_paste"), NULL, NULL,  G_CALLBACK (modest_ui_actions_on_paste)},
        { "FolderViewCSMDeleteFolder", NULL, N_("mcen_me_inbox_delete"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_delete_folder) },
-       { "FolderViewCSMSearchMessages", NULL, N_("mcen_me_inbox_search"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_search_messages) },
-       { "FolderViewCSMHelp", NULL, N_("mcen_me_inbox_help"), NULL, NULL, G_CALLBACK (modest_ui_actions_on_csm_help) },
 };
 
 static const GtkActionEntry modest_header_view_action_entries [] = {
@@ -285,7 +280,6 @@ static const GtkActionEntry modest_header_view_action_entries [] = {
        { "HeaderViewCSMPaste",         NULL,  N_("mcen_me_inbox_paste"),       "<CTRL>V", NULL, G_CALLBACK (modest_ui_actions_on_paste) },
        { "HeaderViewCSMDelete",        NULL,  N_("mcen_me_inbox_delete"),      NULL,      NULL, G_CALLBACK (modest_ui_actions_on_delete_message) },
        { "HeaderViewCSMCancelSending", NULL,  N_("mcen_me_outbox_cancelsend"), NULL,      NULL, G_CALLBACK (modest_ui_actions_cancel_send) },
-       { "HeaderViewCSMHelp",          NULL,  N_("mcen_me_inbox_help"),        NULL,      NULL, G_CALLBACK (modest_ui_actions_on_help) },
 };
 
 static const GtkToggleActionEntry modest_main_window_toggle_action_entries [] = {
@@ -345,8 +339,6 @@ modest_main_window_init (ModestMainWindow *obj)
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(obj);
 
        priv->queue_err_signals = NULL;
-       priv->msg_paned    = NULL;
-       priv->main_paned   = NULL;      
        priv->main_vbox    = NULL;
        priv->header_view  = NULL;
        priv->folder_view  = NULL;
@@ -364,7 +356,6 @@ modest_main_window_init (ModestMainWindow *obj)
        priv->optimized_view  = FALSE;
        priv->send_receive_in_progress  = FALSE;
        priv->progress_bar_timeout = 0;
-       priv->restore_paned_timeout = 0;
        priv->sighandlers = NULL;
        priv->updating_banner = NULL;
        priv->updating_banner_timeout = 0;
@@ -428,11 +419,6 @@ modest_main_window_finalize (GObject *obj)
                priv->opening_banner = NULL;
        }
 
-       if (priv->restore_paned_timeout > 0) {
-               g_source_remove (priv->restore_paned_timeout);
-               priv->restore_paned_timeout = 0;
-       }
-       
        G_OBJECT_CLASS(parent_class)->finalize (obj);
 }
 
@@ -463,25 +449,6 @@ modest_main_window_get_child_widget (ModestMainWindow *self,
        return (widget && GTK_IS_WIDGET(widget)) ? GTK_WIDGET(widget) : NULL;
 }
 
-static gboolean 
-restore_paned_timeout_handler (gpointer *data)
-{
-       ModestMainWindow *main_window = MODEST_MAIN_WINDOW (data);
-       ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE (main_window);
-       ModestConf *conf;
-
-       /* Timeouts are outside the main lock */
-       gdk_threads_enter ();
-       if (GTK_WIDGET_VISIBLE (main_window)) {
-               conf = modest_runtime_get_conf ();
-               modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned),
-                                             MODEST_CONF_MAIN_PANED_KEY);
-       }
-       gdk_threads_leave ();
-
-       return FALSE;
-}
-
 
 static void
 restore_settings (ModestMainWindow *self, gboolean do_folder_view_too)
@@ -503,13 +470,6 @@ restore_settings (ModestMainWindow *self, gboolean do_folder_view_too)
                modest_widget_memory_restore (conf, G_OBJECT(priv->folder_view),
                                      MODEST_CONF_FOLDER_VIEW_KEY);
 
-/*     modest_widget_memory_restore (conf, G_OBJECT(priv->main_paned), */
-/*                                   MODEST_CONF_MAIN_PANED_KEY); */
-
-       g_timeout_add (250, (GSourceFunc) restore_paned_timeout_handler, self);
-
-       /* We need to force a redraw here in order to get the right
-          position of the horizontal paned separator */
        gtk_widget_show (GTK_WIDGET (self));
 }
 
@@ -526,10 +486,6 @@ save_state (ModestWindow *window)
        
        modest_widget_memory_save (conf,G_OBJECT(self), 
                                   MODEST_CONF_MAIN_WINDOW_KEY);
-       /* Only save main paned position if we're in split mode */
-       if (priv->style == MODEST_MAIN_WINDOW_STYLE_SPLIT)
-               modest_widget_memory_save (conf, G_OBJECT(priv->main_paned), 
-                                          MODEST_CONF_MAIN_PANED_KEY);
        modest_widget_memory_save (conf, G_OBJECT(priv->folder_view), 
                                   MODEST_CONF_FOLDER_VIEW_KEY);
 }
@@ -553,7 +509,7 @@ tap_and_hold_query_cb (GtkWidget *widget, GdkEvent *event)
 
 static void
 update_menus (ModestMainWindow* self)
-{      
+{
        GSList *account_names, *iter, *accounts;
        ModestMainWindowPrivate *priv;
        ModestWindowPrivate *parent_priv;
@@ -645,10 +601,10 @@ update_menus (ModestMainWindow* self)
        /* Create a new action group */
        default_account = modest_account_mgr_get_default_account (mgr);
        active_account_name = modest_window_get_active_account (MODEST_WINDOW (self));
-       
+
        if (!active_account_name) 
                modest_window_set_active_account (MODEST_WINDOW (self), default_account);
-       
+
        priv->view_additions_group = gtk_action_group_new (MODEST_MAIN_WINDOW_ACTION_GROUP_ADDITIONS);
        radio_group = NULL;
        for (i = 0; i < num_accounts; i++) {
@@ -661,7 +617,7 @@ update_menus (ModestMainWindow* self)
                        continue;
                }
                account_name = modest_account_settings_get_account_name (settings);
-       
+
                if (default_account && account_name && 
                    !(strcmp (default_account, account_name) == 0)) {
                        display_name = g_strdup_printf (_("mcen_me_toolbar_sendreceive_default"), 
@@ -671,8 +627,8 @@ update_menus (ModestMainWindow* self)
                                                        modest_account_settings_get_display_name (settings));
                }
 
-               
-               
+
+
                /* Create action and add it to the action group. The
                   action name must be the account name, this way we
                   could know in the handlers the account to show */
@@ -707,7 +663,7 @@ update_menus (ModestMainWindow* self)
                        priv->merge_ids = g_byte_array_append (priv->merge_ids, &merge_id, 1);
                        gtk_ui_manager_add_ui (parent_priv->ui_manager,
                                               merge_id,
-                                              "/MenuBar/ViewMenu/ViewMenuAdditions",
+                                              "/MenuBar/AccountsMenu/AccountsMenuAdditions",
                                               item_name,
                                               account_name,
                                               GTK_UI_MANAGER_MENUITEM,
@@ -794,10 +750,10 @@ update_menus (ModestMainWindow* self)
 
                /* Get the item of the view menu */
                item_name = g_strconcat (account_name, "Menu", NULL);
-               path = g_strconcat ("/MenuBar/ViewMenu/ViewMenuAdditions/", item_name, NULL);
+               path = g_strconcat ("/MenuBar/AccountsMenu/AccountsMenuAdditions/", item_name, NULL);
                item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
                g_free(path);
-               
+
                if (item) {
                        GtkWidget *child = gtk_bin_get_child (GTK_BIN (item));
                        if (GTK_IS_LABEL (child)) {
@@ -807,10 +763,9 @@ update_menus (ModestMainWindow* self)
                                        gtk_label_set_markup (GTK_LABEL (child), bold_name);
                                        g_free (bold_name);
                                }
-                               gtk_label_set_ellipsize (GTK_LABEL (child),  PANGO_ELLIPSIZE_END);
                        }
                }
-                       
+
                /* Get the item of the tools menu */
                path = g_strconcat("/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions/", item_name, NULL);
                item = gtk_ui_manager_get_widget (parent_priv->ui_manager, path);
@@ -905,26 +860,6 @@ modest_main_window_cleanup_queue_error_signals (ModestMainWindow *self)
 
 
 static void
-_folder_view_csm_menu_activated (GtkWidget *widget, gpointer user_data)
-{
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW (user_data));
-
-       /* Update dimmed */
-       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW(user_data));
-}
-
-static void
-_header_view_csm_menu_activated (GtkWidget *widget, gpointer user_data)
-{
-       g_return_if_fail (MODEST_IS_MAIN_WINDOW (user_data));
-
-       /* Update visibility */
-
-       /* Update dimmed */
-       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW(user_data));
-}
-
-static void
 modest_main_window_disconnect_signals (ModestWindow *self)
 {      
        ModestMainWindowPrivate *priv;  
@@ -939,7 +874,6 @@ connect_signals (ModestMainWindow *self)
 {      
        ModestWindowPrivate *parent_priv;
        ModestMainWindowPrivate *priv;
-       GtkWidget *menu;
        
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
        parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
@@ -966,12 +900,11 @@ connect_signals (ModestMainWindow *self)
                                           G_CALLBACK (on_folder_view_focus_in), 
                                           self);
 
-       /* Folder view CSM */
-       menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/FolderViewCSM");
-       gtk_widget_tap_and_hold_setup (GTK_WIDGET (priv->folder_view), menu, NULL, 0);
-       priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers, G_OBJECT(priv->folder_view), "tap-and-hold",
-                                                      G_CALLBACK(_folder_view_csm_menu_activated),
+       /* folder view row activated */
+       priv->sighandlers = modest_signal_mgr_connect (priv->sighandlers, G_OBJECT(priv->folder_view), "row-activated",
+                                                      G_CALLBACK(on_folder_view_row_activated),
                                                       self);
+
        /* header view */
        priv->sighandlers = 
                modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(priv->header_view), "header_selected",
@@ -998,19 +931,7 @@ connect_signals (ModestMainWindow *self)
                                           G_CALLBACK (on_updating_msg_list), 
                                           self);
        
-       /* Header view CSM */
-       menu = gtk_ui_manager_get_widget (parent_priv->ui_manager, "/HeaderViewCSM");
-       gtk_widget_tap_and_hold_setup (GTK_WIDGET (priv->header_view), menu, NULL, 0);
-       priv->sighandlers = 
-               modest_signal_mgr_connect (priv->sighandlers,G_OBJECT(priv->header_view), "tap-and-hold",
-                                          G_CALLBACK(_header_view_csm_menu_activated),
-                                          self);
-       
        /* window */
-       priv->sighandlers = 
-               modest_signal_mgr_connect (priv->sighandlers,G_OBJECT (self), "window-state-event",
-                                          G_CALLBACK (modest_main_window_window_state_event),
-                                          NULL);
        /* we don't register this in sighandlers, as it should be run after disconnecting all signals,
         * in destroy stage */
        g_signal_connect (G_OBJECT (self), "destroy", G_CALLBACK (on_window_destroy), NULL);
@@ -1104,7 +1025,6 @@ on_hildon_program_is_topmost_notify(GObject *self,
 
 typedef struct
 {
-       GtkWidget *folder_win;
        gulong handler_id;
 } ShowHelper;
 
@@ -1112,11 +1032,12 @@ static void
 modest_main_window_on_show (GtkWidget *self, gpointer user_data)
 {
        ShowHelper *helper = (ShowHelper *) user_data;
-       GtkWidget *folder_win = helper->folder_win;
        ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-       
+
        priv->folder_view = MODEST_FOLDER_VIEW (modest_platform_create_folder_view (NULL));
-       wrap_in_scrolled_window (folder_win, GTK_WIDGET(priv->folder_view));
+       modest_main_window_set_contents_style (MODEST_MAIN_WINDOW (self), 
+                                              MODEST_MAIN_WINDOW_CONTENTS_STYLE_FOLDERS);
+       gtk_tree_view_expand_all (GTK_TREE_VIEW (priv->folder_view));
 
        gtk_widget_show (GTK_WIDGET (priv->folder_view));
 
@@ -1127,21 +1048,21 @@ modest_main_window_on_show (GtkWidget *self, gpointer user_data)
        tny_account_store_view_set_account_store (TNY_ACCOUNT_STORE_VIEW (priv->folder_view),
                                                  TNY_ACCOUNT_STORE (modest_runtime_get_account_store ()));
 
-       /* Load previous osso state, for instance if we are being restored from 
+       /* Load previous osso state, for instance if we are being restored from
         * hibernation:  */
        modest_osso_load_state ();
 
-       /* Restore window & widget settings */  
+       /* Restore window & widget settings */
        priv->wait_for_settings = TRUE;
        restore_settings (MODEST_MAIN_WINDOW(self), TRUE);
        priv->wait_for_settings = FALSE;
 
        /* Check if accounts exist and show the account wizard if not */
-       gboolean accounts_exist = 
+       gboolean accounts_exist =
                modest_account_mgr_has_accounts(modest_runtime_get_account_mgr(), TRUE);
 
        if (!accounts_exist) {
-               /* This is necessary to have the main window shown behind the dialog 
+               /* This is necessary to have the main window shown behind the dialog
                It's an ugly hack... jschmid */
                gtk_widget_show_all(GTK_WIDGET(self));
                modest_ui_actions_on_accounts (NULL, MODEST_WINDOW(self));
@@ -1175,7 +1096,6 @@ modest_main_window_new (void)
        ModestMainWindow *self = NULL;  
        ModestMainWindowPrivate *priv = NULL;
        ModestWindowPrivate *parent_priv = NULL;
-       GtkWidget *folder_win = NULL;
        ModestDimmingRulesGroup *menu_rules_group = NULL;
        ModestDimmingRulesGroup *toolbar_rules_group = NULL;
        GtkActionGroup *action_group = NULL;
@@ -1214,11 +1134,6 @@ modest_main_window_new (void)
                                      self);
 
        gtk_action_group_add_toggle_actions (action_group,
-                                            modest_toggle_action_entries,
-                                            G_N_ELEMENTS (modest_toggle_action_entries),
-                                            self);
-
-       gtk_action_group_add_toggle_actions (action_group,
                                             modest_main_window_toggle_action_entries,
                                             G_N_ELEMENTS (modest_main_window_toggle_action_entries),
                                             self);
@@ -1285,25 +1200,15 @@ modest_main_window_new (void)
        g_object_ref (priv->empty_view);
                 
        /* Create scrolled windows */
-       folder_win = gtk_scrolled_window_new (NULL, NULL);
        priv->contents_widget = gtk_scrolled_window_new (NULL, NULL);
-       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (folder_win),
-                                       GTK_POLICY_NEVER,
-                                       GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->contents_widget),
                                        GTK_POLICY_NEVER,
                                        GTK_POLICY_AUTOMATIC);
        /* gtk_widget_show (priv->contents_widget); */
 
-       /* paned */
-       priv->main_paned = gtk_hpaned_new ();
-       gtk_paned_pack1 (GTK_PANED(priv->main_paned), folder_win, TRUE, TRUE);
-       gtk_paned_pack2 (GTK_PANED(priv->main_paned), priv->contents_widget, TRUE, TRUE);
-       gtk_tree_view_columns_autosize (GTK_TREE_VIEW(priv->header_view));
-
        /* putting it all together... */
        priv->main_vbox = gtk_vbox_new (FALSE, 6);
-       gtk_box_pack_start (GTK_BOX(priv->main_vbox), priv->main_paned, TRUE, TRUE,0);
+       gtk_box_pack_start (GTK_BOX(priv->main_vbox), priv->contents_widget, TRUE, TRUE,0);
        gtk_widget_show (priv->main_vbox);
        
        gtk_container_add (GTK_CONTAINER(self), priv->main_vbox);
@@ -1317,7 +1222,6 @@ modest_main_window_new (void)
        /* Connect to "show" action. We delay the creation of some
           elements until that moment */
        helper = g_slice_new0 (ShowHelper);
-       helper->folder_win = folder_win;
        helper->handler_id = g_signal_connect (G_OBJECT(self), "show",
                                               G_CALLBACK (modest_main_window_on_show), 
                                               helper);
@@ -1348,115 +1252,18 @@ void
 modest_main_window_set_style (ModestMainWindow *self, 
                              ModestMainWindowStyle style)
 {
-       ModestMainWindowPrivate *priv;
-       ModestWindowPrivate *parent_priv;
-       GtkAction *action;
-       gboolean active;
-       GtkTreeSelection *sel;
-       GList *rows, *list;
-       
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
 
-       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-       parent_priv = MODEST_WINDOW_GET_PRIVATE(self);
-
-       /* no change -> nothing to do */
-       if (priv->style == style)
-               return;
-
-       /* Get toggle button and update the state if needed. This will
-         happen only when the set_style is not invoked from the UI,
-         for example when it's called from widget memory */
-       action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/ToolBar/ToggleFolders");
-       active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
-       if ((active && style == MODEST_MAIN_WINDOW_STYLE_SIMPLE) ||
-          (!active && style == MODEST_MAIN_WINDOW_STYLE_SPLIT)) {
-              g_signal_handlers_block_by_func (action, modest_ui_actions_toggle_folders_view, self);
-              gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !active);
-              g_signal_handlers_unblock_by_func (action, modest_ui_actions_toggle_folders_view, self);
-       }
-
-       /* We need to store the selection because it's lost when the
-         widget is reparented */
-       sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->header_view));
-       rows = gtk_tree_selection_get_selected_rows (sel, NULL);
-
-       priv->style = style;
-       switch (style) {
-       case MODEST_MAIN_WINDOW_STYLE_SIMPLE:
-
-               if (!priv->wait_for_settings)
-                       modest_widget_memory_save (modest_runtime_get_conf (), G_OBJECT (priv->main_paned),
-                                                  MODEST_CONF_MAIN_PANED_KEY);
-               /* Remove main paned */
-               g_object_ref (priv->main_paned);
-               gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
-
-               /* Reparent the contents widget to the main vbox */
-               gtk_widget_reparent (priv->contents_widget, priv->main_vbox);
-
-               break;
-       case MODEST_MAIN_WINDOW_STYLE_SPLIT:
-               /* Remove header view */
-               g_object_ref (priv->contents_widget);
-               gtk_container_remove (GTK_CONTAINER (priv->main_vbox), priv->contents_widget);
-
-               /* Reparent the main paned */
-               gtk_paned_add2 (GTK_PANED (priv->main_paned), priv->contents_widget);
-               gtk_container_add (GTK_CONTAINER (priv->main_vbox), priv->main_paned);
-
-               g_timeout_add (500, (GSourceFunc) restore_paned_timeout_handler, self);
-
-               break;
-       default:
-               g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
-               g_list_free (rows);
-               g_return_if_reached ();
-       }
-
-       /* Reselect the previously selected folders. We disable the
-          dimming rules execution during that time because there is
-          no need to work out it again and it could take a lot of
-          time if all the headers are selected */
-       list = rows;
-       modest_window_disable_dimming (MODEST_WINDOW (self));
-       while (list) {
-               gtk_tree_selection_select_path (sel, (GtkTreePath *) list->data);
-               list = g_list_next (list);
-       }
-       modest_window_enable_dimming (MODEST_WINDOW (self));
-
-       /* Free */
-       g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL);
-       g_list_free (rows);
-
-       /* Let header view grab the focus if it's being shown */
-       if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS) {
-               gtk_widget_grab_focus (GTK_WIDGET (priv->header_view));
-       } else {
-               if (priv->style == MODEST_MAIN_WINDOW_STYLE_SPLIT)
-                       gtk_widget_grab_focus (GTK_WIDGET (priv->folder_view));
-               else
-                       gtk_widget_grab_focus (GTK_WIDGET (priv->contents_widget));
-       }
-
-       /* Check dimming rules */
-        modest_ui_actions_check_toolbar_dimming_rules (MODEST_WINDOW (self));
-       modest_ui_actions_check_menu_dimming_rules (MODEST_WINDOW (self));
-
-       /* Show changes */
-       gtk_widget_show_all (GTK_WIDGET (priv->main_vbox));
+       /* We only provide simple style */
+       return;
 }
 
 ModestMainWindowStyle
 modest_main_window_get_style (ModestMainWindow *self)
 {
-       ModestMainWindowPrivate *priv;
-
        g_return_val_if_fail (MODEST_IS_MAIN_WINDOW (self), -1);
 
-       priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-       return priv->style;
+       return MODEST_MAIN_WINDOW_STYLE_SIMPLE;
 }
 
 static void
@@ -1506,37 +1313,6 @@ toolbar_resize (ModestMainWindow *self)
                
 }
 
-
-
-static gboolean
-modest_main_window_window_state_event (GtkWidget *widget, GdkEventWindowState *event, gpointer userdata)
-{
-       if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) {
-               ModestWindowPrivate *parent_priv;
-               ModestWindowMgr *mgr;
-               gboolean is_fullscreen;
-               GtkAction *fs_toggle_action;
-               gboolean active;
-               
-               mgr = modest_runtime_get_window_mgr ();
-               
-               is_fullscreen = modest_window_mgr_get_fullscreen_mode (mgr);
-
-               parent_priv = MODEST_WINDOW_GET_PRIVATE (widget);
-               
-               fs_toggle_action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/MenuBar/ViewMenu/ViewToggleFullscreenMenu");
-               active = (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (fs_toggle_action)))?1:0;
-               if (is_fullscreen != active) {
-                       gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (fs_toggle_action), is_fullscreen);
-               }
-
-               toolbar_resize (MODEST_MAIN_WINDOW (widget));
-       }
-
-       return FALSE;
-
-}
-
 static void 
 modest_main_window_show_toolbar (ModestWindow *self,
                                 gboolean show_toolbar)
@@ -1655,13 +1431,9 @@ on_account_changed (TnyAccountStore *account_store,
        /* Transport accounts and local ones (MMC and the Local
           folders account do now cause menu changes */
        if (TNY_IS_STORE_ACCOUNT (account)) {
-               /* We need to refresh the details widget because it could have changed */
-               if (modest_main_window_get_contents_style(win) == MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS)
-                       modest_main_window_set_contents_style (win, MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS);
-
                /* Update the menus as well, name could change */
                if (modest_tny_folder_store_is_remote (TNY_FOLDER_STORE (account)))
-                       update_menus (MODEST_MAIN_WINDOW (user_data));
+                       update_menus (MODEST_MAIN_WINDOW (win));
        }
 }
 
@@ -1760,14 +1532,6 @@ on_inner_widgets_key_pressed (GtkWidget *widget,
        return FALSE;
 }
 
-static void
-set_alignment (GtkWidget *widget,
-              gpointer data)
-{
-       gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.0);
-       gtk_misc_set_padding (GTK_MISC (widget), 0, 0);
-}
-
 static GtkWidget *
 create_empty_view (void)
 {
@@ -1782,258 +1546,6 @@ create_empty_view (void)
        return GTK_WIDGET(align);
 }
 
-/*
- * Free the returned string
- */
-static gchar *
-get_gray_color_markup (GtkWidget *styled_widget)
-{
-       gchar *gray_color_markup = NULL;
-#ifndef MODEST_HAVE_HILDON0_WIDGETS
-       /* Obtain the secondary text color. We need a realized widget, that's why 
-          we get styled_widget from outside */
-       GdkColor color;
-       if (gtk_style_lookup_color (styled_widget->style, "SecondaryTextColor", &color)) 
-               gray_color_markup = modest_text_utils_get_color_string (&color);
-#endif /*MODEST_HAVE_HILDON0_WIDGETS*/
-       
-       if (!gray_color_markup) 
-               gray_color_markup = g_strdup ("#BBBBBB");
-
-       return gray_color_markup;
-}
-
-/*
- * Free the returned string
- */
-static gchar*
-create_device_name_visual_string (const gchar *device_name,
-                                 const gchar *gray_color_markup)
-{
-       gchar *tmp, *label;
-
-       /* We have to use "" to fill the %s of the translation. We can
-          not just use the device name because the device name is
-          shown in a different color, so it could not be included
-          into the <span> tag */
-       tmp = g_strdup_printf (_("mcen_fi_localroot_description"), "");
-       label = g_markup_printf_escaped ("<span color='%s'>%s</span>%s", 
-                                        gray_color_markup, 
-                                        tmp, 
-                                        device_name);
-       g_free (tmp);
-
-       return label;
-}
-
-typedef struct
-{
-       GtkWidget *count_label;
-       GtkWidget *msg_count_label;
-       GtkWidget *size_label;
-       gchar *color_markup;
-} DetailsWidgets;
-
-static gchar *
-create_uint_label (const gchar *markup,
-                  const gchar *name,
-                  guint count)
-{
-       return g_markup_printf_escaped ("<span color='%s'>%s:</span> %d", markup, name, count);
-}
-
-static gchar *
-create_gchar_label (const gchar *markup,
-                   const gchar *name,
-                   gchar *count)
-{
-       return g_markup_printf_escaped ("<span color='%s'>%s:</span> %s", markup, name, count);
-}
-
-static void
-update_folder_stats_status_cb (ModestFolderStats stats,
-                              gpointer user_data)
-{
-       DetailsWidgets *widgets = (DetailsWidgets *) user_data;
-       gchar *label, *tmp;
-
-       label = create_uint_label (widgets->color_markup, _("mcen_fi_rootfolder_folders"), stats.folders);
-       gtk_label_set_markup (GTK_LABEL (widgets->count_label), label);
-       g_free (label);
-
-       label = create_uint_label (widgets->color_markup, _("mcen_fi_rootfolder_messages"), stats.msg_count);
-       gtk_label_set_markup (GTK_LABEL (widgets->msg_count_label), label);
-       g_free (label);
-
-       if (widgets->size_label) {
-               tmp = modest_text_utils_get_display_size (stats.local_size);
-               label = create_gchar_label (widgets->color_markup, _("mcen_fi_rootfolder_size"), tmp);
-               gtk_label_set_markup (GTK_LABEL (widgets->size_label), label);
-               g_free (label);
-               g_free (tmp);
-       }
-}
-
-static void
-update_folder_stats_cb (ModestFolderStats stats,
-                       gpointer user_data)
-{
-       DetailsWidgets *widgets = (DetailsWidgets *) user_data;
-
-       /* refresh data */
-       update_folder_stats_status_cb (stats, user_data);
-
-       /* frees. Note that the widgets could have been destroyed but
-          we still keep a reference */
-       g_free (widgets->color_markup);
-       if (widgets->count_label)
-               g_object_unref (widgets->count_label);
-       if (widgets->msg_count_label)
-               g_object_unref (widgets->msg_count_label);
-       if (widgets->size_label)
-       g_object_unref (widgets->size_label);
-       g_slice_free (DetailsWidgets, widgets);
-}
-
-static GtkWidget *
-create_details_widget (GtkWidget *styled_widget, TnyAccount *account)
-{
-       /* TODO: Clean up this function. It's a mess, with lots of copy/paste. murrayc. */
-       
-       GtkWidget *vbox;
-       GtkWidget *label_w;
-       gchar *label;
-       gchar *gray_color_markup;
-       DetailsWidgets *widgets;
-
-       vbox = gtk_vbox_new (FALSE, 0);
-       widgets = g_slice_new0 (DetailsWidgets);
-
-       gray_color_markup = get_gray_color_markup (styled_widget);
-       widgets->color_markup = g_strdup (gray_color_markup);
-
-       /* Account description: */
-       if (modest_tny_account_is_virtual_local_folders (account)
-               || (modest_tny_account_is_memory_card_account (account))) {
-       
-               /* Get device name */
-               gchar *device_name = NULL;
-               if (modest_tny_account_is_virtual_local_folders (account))
-                       device_name = modest_conf_get_string (modest_runtime_get_conf(),
-                                                     MODEST_CONF_DEVICE_NAME, NULL);
-               else
-                       device_name = g_strdup (tny_account_get_name (account));
-
-               label = create_device_name_visual_string ((const gchar *) device_name, 
-                                                         (const gchar *) gray_color_markup);
-               label_w = gtk_label_new (NULL);
-               gtk_label_set_markup (GTK_LABEL (label_w), label);
-               gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-               gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-               g_free (device_name);
-               g_free (label);
-       } else {
-               if(!strcmp (tny_account_get_id (account), MODEST_MMC_ACCOUNT_ID)) {
-                       gtk_box_pack_start (GTK_BOX (vbox), 
-                               gtk_label_new (tny_account_get_name (account)), 
-                               FALSE, FALSE, 0);
-               } else {
-                       /* Other accounts, such as IMAP and POP: */
-                       
-                       GString *proto;
-                       gchar *tmp;
-       
-                       /* Put proto in uppercase */
-                       proto = g_string_new (tny_account_get_proto (account));
-                       proto = g_string_ascii_up (proto);
-                       
-                       /* note: mcen_fi_localroot_description is something like "%s account"
-                        * however, we should display "%s account: %s"... therefore, ugly tmp */
-                       tmp   = g_strdup_printf (_("mcen_fi_remoteroot_account"),proto->str);
-                       label = g_markup_printf_escaped ("<span color='%s'>%s:</span> %s", 
-                                                        gray_color_markup, tmp, tny_account_get_name (account));
-                       g_free (tmp);
-
-                       label_w = gtk_label_new (NULL);
-                       gtk_label_set_markup (GTK_LABEL (label_w), label);
-                       gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-                       gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-                       g_string_free (proto, TRUE);
-                       g_free (label);
-               }
-       }
-
-       /* Message count */
-       TnyFolderStore *folder_store = TNY_FOLDER_STORE (account);
-       label = create_uint_label (gray_color_markup, _("mcen_fi_rootfolder_messages"), 0);
-       label_w = gtk_label_new (NULL);
-       gtk_label_set_markup (GTK_LABEL (label_w), label);
-       gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-       gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-       g_free (label);
-
-       widgets->msg_count_label = g_object_ref (label_w);
-
-       /* Folder count */
-       label = create_uint_label (gray_color_markup, _("mcen_fi_rootfolder_folders"), 0);
-       label_w = gtk_label_new (NULL);
-       gtk_label_set_markup (GTK_LABEL (label_w), label);
-       gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-       gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-       g_free (label);
-
-       widgets->count_label = g_object_ref (label_w);
-
-       /* Size / Date */
-       if (modest_tny_account_is_virtual_local_folders (account)
-               || modest_tny_account_is_memory_card_account (account)) {
-
-               label = create_gchar_label (gray_color_markup, _("mcen_fi_rootfolder_size"), "0");
-               
-               label_w = gtk_label_new (NULL);
-               gtk_label_set_markup (GTK_LABEL (label_w), label);
-               gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-               gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-               g_free (label);
-
-               widgets->size_label = g_object_ref (label_w);
-
-       } else if (TNY_IS_ACCOUNT(folder_store)) {
-               TnyAccount *account = TNY_ACCOUNT(folder_store);
-               
-               time_t last_updated;
-               const gchar *last_updated_string;
-               /* Get last updated from configuration */
-               last_updated = modest_account_mgr_get_last_updated (modest_runtime_get_account_mgr (), 
-                                                                   tny_account_get_id (account));
-
-               if (last_updated > 0) 
-                       last_updated_string = modest_text_utils_get_display_date(last_updated);
-               else
-                       last_updated_string = g_strdup (_("mcen_va_never"));
-
-               label = g_markup_printf_escaped ("<span color='%s'>%s:</span> %s", 
-                                                gray_color_markup, _("mcen_ti_lastupdated"), last_updated_string);
-               label_w = gtk_label_new (NULL);
-               gtk_label_set_markup (GTK_LABEL (label_w), label);
-               gtk_label_set_ellipsize (GTK_LABEL (label_w),  PANGO_ELLIPSIZE_END);
-               gtk_box_pack_start (GTK_BOX (vbox), label_w, FALSE, FALSE, 0);
-               g_free (label);
-       }
-
-       g_free (gray_color_markup);
-
-       /* Refresh folder stats asynchronously */
-       modest_tny_folder_store_get_folder_stats (TNY_FOLDER_STORE (account),
-                                                 update_folder_stats_cb,
-                                                 update_folder_stats_status_cb,
-                                                 widgets);
-
-       /* Set alignment */
-       gtk_container_foreach (GTK_CONTAINER (vbox), (GtkCallback) set_alignment, NULL);
-
-       return vbox;
-}
 
 gboolean
 modest_main_window_send_receive_in_progress (ModestMainWindow *self)
@@ -2073,19 +1585,19 @@ modest_main_window_notify_send_receive_completed (ModestMainWindow *self)
        GtkAction *action = NULL;
        GtkWidget *widget = NULL;
        ModestMainWindowPrivate *priv = NULL;
-               
+
        g_return_if_fail (MODEST_IS_MAIN_WINDOW (self));
        priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
 
        priv->send_receive_in_progress  = FALSE;
 
-        action = modest_window_get_action (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");        
+        action = modest_window_get_action (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveAllMenu");
        gtk_action_set_sensitive (action, TRUE);
 /*         action = modest_window_get_action (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsSendReceiveCancelSendingMenu");    */
 /*     gtk_action_set_sensitive (action, TRUE); */
-        widget = modest_window_get_action_widget (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions");      
+        widget = modest_window_get_action_widget (MODEST_WINDOW(self), "/MenuBar/ToolsMenu/ToolsSendReceiveMainMenu/ToolsMenuAdditions");
        gtk_widget_set_sensitive (widget, TRUE);
-} 
+}
 
 
 static void
@@ -2129,13 +1641,16 @@ on_msg_count_changed (ModestHeaderView *header_view,
        folder_empty = folder_empty || all_marked_as_deleted;
 
        /* Set contents style of headers view */
-       if (folder_empty)  {
-               modest_main_window_set_contents_style (main_window,
-                                                      MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
-               gtk_widget_grab_focus (GTK_WIDGET (priv->folder_view));
-       } else {
-               modest_main_window_set_contents_style (main_window,
-                                                      MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
+       if (priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY ||
+           priv->contents_style == MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS) {
+               if (folder_empty)  {
+                       modest_main_window_set_contents_style (main_window,
+                                                              MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY);
+                       gtk_widget_grab_focus (GTK_WIDGET (priv->folder_view));
+               } else {
+                       modest_main_window_set_contents_style (main_window,
+                                                              MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
+               }
        }
 
        if (refilter)
@@ -2174,36 +1689,22 @@ modest_main_window_set_contents_style (ModestMainWindow *self,
        priv->contents_style = style;
 
        switch (priv->contents_style) {
+       case MODEST_MAIN_WINDOW_CONTENTS_STYLE_FOLDERS:
+               wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET (priv->folder_view));
+               modest_maemo_set_thumbable_scrollbar (GTK_SCROLLED_WINDOW(priv->contents_widget),
+                                                     TRUE);
+               gtk_widget_grab_focus (GTK_WIDGET (priv->folder_view));
+               break;
        case MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS:
                wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET (priv->header_view));
                modest_maemo_set_thumbable_scrollbar (GTK_SCROLLED_WINDOW(priv->contents_widget),
                                                      TRUE);
-               if (priv->style == MODEST_MAIN_WINDOW_STYLE_SIMPLE)
-                       gtk_widget_grab_focus (GTK_WIDGET (priv->header_view));
+               gtk_widget_grab_focus (GTK_WIDGET (priv->header_view));
+               gtk_widget_show (GTK_WIDGET (priv->header_view));
                break;
        case MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS:
-       {
-               /* if we're started without main win, there may not be a folder
-                * view. this fixes a GLib-Critical */
-               if (priv->folder_view) {
-                       TnyFolderStore *selected_folderstore = 
-                               modest_folder_view_get_selected (priv->folder_view);
-                       if (TNY_IS_ACCOUNT (selected_folderstore)) {    
-                               priv->details_widget = create_details_widget (GTK_WIDGET (self),
-                                                               TNY_ACCOUNT (selected_folderstore));
-                               
-                               wrap_in_scrolled_window (priv->contents_widget, 
-                                                        priv->details_widget);
-                       }
-                       if (selected_folderstore)
-                               g_object_unref (selected_folderstore);
-                       modest_maemo_set_thumbable_scrollbar (GTK_SCROLLED_WINDOW(priv->contents_widget),
-                                                             FALSE);
-               }
-               if (priv->style == MODEST_MAIN_WINDOW_STYLE_SIMPLE)
-                       gtk_widget_grab_focus (GTK_WIDGET (priv->details_widget));
+               g_message ("This view is not supported in Fremantle style");
                break;
-       }
        case MODEST_MAIN_WINDOW_CONTENTS_STYLE_EMPTY:
                wrap_in_scrolled_window (priv->contents_widget, GTK_WIDGET (priv->empty_view));
                modest_maemo_set_thumbable_scrollbar (GTK_SCROLLED_WINDOW(priv->contents_widget),
@@ -2238,43 +1739,10 @@ on_configuration_key_changed (ModestConf* conf,
                              ModestConfNotificationId id, 
                              ModestMainWindow *self)
 {
-       ModestMainWindowPrivate *priv = MODEST_MAIN_WINDOW_GET_PRIVATE(self);
-       TnyAccount *account = NULL;
+       /* TODO: remove this handler. Now we don't support details view, 
+        *  so this must be removed */
 
-       if (!key || strcmp (key, MODEST_CONF_DEVICE_NAME))
-               return;
-
-       if (priv->contents_style != MODEST_MAIN_WINDOW_CONTENTS_STYLE_DETAILS)
-               return;
-
-       if (priv->folder_view) 
-               account = (TnyAccount *) modest_folder_view_get_selected (priv->folder_view);
-
-       if (account && TNY_IS_ACCOUNT (account) &&
-           strcmp (tny_account_get_id (account), MODEST_LOCAL_FOLDERS_ACCOUNT_ID) == 0) {
-               GList *children;
-               GtkLabel *label;
-               const gchar *device_name;
-               gchar *new_text, *gray_color_markup;
-               
-               /* Get label */
-               children = gtk_container_get_children (GTK_CONTAINER (priv->details_widget));
-               label = GTK_LABEL (children->data);
-               
-               device_name = modest_conf_get_string (modest_runtime_get_conf(),
-                                                     MODEST_CONF_DEVICE_NAME, NULL);
-
-               gray_color_markup = get_gray_color_markup (GTK_WIDGET (self));          
-               new_text = create_device_name_visual_string (device_name, gray_color_markup);
-               
-               gtk_label_set_markup (label, new_text);
-               gtk_widget_show (GTK_WIDGET (label));
-               
-               g_free (gray_color_markup);
-               g_free (new_text);
-               g_list_free (children);
-       }
-       g_object_unref (account);
+       return;
 }
 
 static gboolean
@@ -2624,6 +2092,21 @@ set_account_visible(ModestMainWindow *self, const gchar *acc_name)
        ModestAccountSettings *settings;
        ModestServerAccountSettings *store_settings = NULL;
 
+/*     GtkWidget *folder_window; */
+
+/*     folder_window = GTK_WIDGET (modest_folder_window_new (NULL)); */
+/*     modest_window_mgr_register_window (modest_runtime_get_window_mgr (),  */
+/*                                        MODEST_WINDOW (folder_window), */
+/*                                        MODEST_WINDOW (self)); */
+/*     gtk_widget_show (folder_window); */
+       GtkWidget *accounts_window;
+
+       accounts_window = GTK_WIDGET (modest_accounts_window_new ());
+       modest_window_mgr_register_window (modest_runtime_get_window_mgr (),
+                                          MODEST_WINDOW (accounts_window),
+                                          MODEST_WINDOW (self));
+       gtk_widget_show (accounts_window);
+
        /* Get account data */
        mgr = modest_runtime_get_account_mgr ();
        settings = modest_account_mgr_load_account_settings (mgr, acc_name);
@@ -2642,6 +2125,8 @@ set_account_visible(ModestMainWindow *self, const gchar *acc_name)
                modest_folder_view_select_first_inbox_or_local (priv->folder_view);
                modest_window_set_active_account (MODEST_WINDOW (self), account_name);
 
+/*             modest_folder_window_set_account (MODEST_FOLDER_WINDOW (folder_window), acc_name); */
+
                action = gtk_action_group_get_action (priv->view_additions_group, account_name);
                if (action != NULL) {
                        if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) {
@@ -2657,6 +2142,7 @@ set_account_visible(ModestMainWindow *self, const gchar *acc_name)
                g_object_unref (store_settings);
                g_object_unref (settings);
        }
+
 }
 
 /* Make sure that at least one account is "viewed": */
@@ -2837,9 +2323,6 @@ on_folder_selection_changed (ModestFolderView *folder_view,
        action = gtk_ui_manager_get_action (parent_priv->ui_manager, "/HeaderViewCSM/HeaderViewCSMDelete");
        gtk_action_set_visible (action, show_delete);
 
-       /* We finally call to the ui actions handler, after updating properly
-        * the header view CSM */
-       modest_ui_actions_on_folder_selection_changed (folder_view, folder_store, selected, main_window);
 }
 
 gboolean 
@@ -2948,6 +2431,46 @@ on_updating_msg_list (ModestHeaderView *header_view,
        }
 }
 
+static void on_folder_view_row_activated (GtkTreeView *tree_view,
+                                         GtkTreePath *tree_path,
+                                         GtkTreeViewColumn *column,
+                                         gpointer userdata)
+{
+       GtkTreeModel  *model;
+       GtkTreeIter iter;
+       TnyFolderStore *folder_store = NULL;
+       ModestMainWindow *self = (ModestMainWindow *) userdata;
+       ModestMainWindowPrivate *priv = NULL;
+
+       g_return_if_fail (MODEST_IS_MAIN_WINDOW(self));
+       priv = MODEST_MAIN_WINDOW_GET_PRIVATE (self);
+
+       model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
+
+       if (gtk_tree_model_get_iter (model, &iter, tree_path)) {
+               gtk_tree_model_get (model, &iter,
+                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder_store,
+                                   -1);
+               if (folder_store && TNY_IS_FOLDER (folder_store)) {
+                       modest_header_view_set_folder (MODEST_HEADER_VIEW (priv->header_view), 
+                                                      TNY_FOLDER (folder_store), TRUE, MODEST_WINDOW (self),
+                                                      NULL, NULL);
+                       modest_main_window_set_contents_style (MODEST_MAIN_WINDOW (self),
+                                                              MODEST_MAIN_WINDOW_CONTENTS_STYLE_HEADERS);
+                       modest_widget_memory_restore (modest_runtime_get_conf (), 
+                                                     G_OBJECT(priv->header_view),
+                                                     MODEST_CONF_HEADER_VIEW_KEY);
+                       on_msg_count_changed (MODEST_HEADER_VIEW (priv->header_view), TNY_FOLDER (folder_store), NULL, self);
+               }
+
+               if (folder_store)
+                       g_object_unref (folder_store);
+       }
+
+       g_message ("FOLDER VIEW CELL ACTIVATED");
+       
+}
+
 gboolean
 modest_main_window_screen_is_on (ModestMainWindow *self)
 {