* Refactor sorting of folder view to make it support properly fremantle
authorJose Dapena Paz <jdapena@igalia.com>
Tue, 25 Nov 2008 12:08:05 +0000 (12:08 +0000)
committerJose Dapena Paz <jdapena@igalia.com>
Tue, 25 Nov 2008 12:08:05 +0000 (12:08 +0000)
  style sort.
* Use the new list store for fremantle (allowing plain representation of
  folders).

pmo-drop-split-view-r6396

src/widgets/modest-folder-view.c

index aaa7cc0..232959f 100644 (file)
 #include <gdk/gdkkeysyms.h>
 #include <tny-account-store-view.h>
 #include <tny-gtk-account-list-model.h>
+#ifdef MODEST_TOOLKIT_HILDON2
+#include <tny-gtk-folder-list-store.h>
+#else
 #include <tny-gtk-folder-store-tree-model.h>
+#endif
 #include <tny-gtk-header-list-model.h>
 #include <tny-folder.h>
 #include <tny-folder-store-observer.h>
@@ -66,6 +70,28 @@ const GtkTargetEntry folder_view_drag_types[] =
        { GTK_TREE_PATH_AS_STRING_LIST, GTK_TARGET_SAME_APP, MODEST_HEADER_ROW }
 };
 
+/* Default icon sizes for Fremantle style are different */
+#ifdef MODEST_TOOLKIT_HILDON2
+#define FOLDER_ICON_SIZE MODEST_ICON_SIZE_BIG
+#else
+#define FOLDER_ICON_SIZE MODEST_ICON_SIZE_SMALL
+#endif
+
+/* Column names depending on we use list store or tree store */
+#ifdef MODEST_TOOLKIT_HILDON2
+#define NAME_COLUMN TNY_GTK_FOLDER_LIST_STORE_NAME_COLUMN
+#define UNREAD_COLUMN TNY_GTK_FOLDER_LIST_STORE_UNREAD_COLUMN
+#define ALL_COLUMN TNY_GTK_FOLDER_LIST_STORE_ALL_COLUMN
+#define TYPE_COLUMN TNY_GTK_FOLDER_LIST_STORE_TYPE_COLUMN
+#define INSTANCE_COLUMN TNY_GTK_FOLDER_LIST_STORE_INSTANCE_COLUMN
+#else
+#define NAME_COLUMN TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN
+#define UNREAD_COLUMN TNY_GTK_FOLDER_STORE_TREE_MODEL_UNREAD_COLUMN
+#define ALL_COLUMN TNY_GTK_FOLDER_STORE_TREE_MODEL_ALL_COLUMN
+#define TYPE_COLUMN TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN
+#define INSTANCE_COLUMN TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN
+#endif
+
 /* 'private'/'protected' functions */
 static void modest_folder_view_class_init  (ModestFolderViewClass *klass);
 static void modest_folder_view_init        (ModestFolderView *obj);
@@ -325,7 +351,7 @@ on_model_foreach_set_name(GtkTreeModel *model, GtkTreePath *path,  GtkTreeIter *
        GObject *instance = NULL;
 
        gtk_tree_model_get (model, iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+                           INSTANCE_COLUMN, &instance,
                            -1);
 
        if (!instance)
@@ -401,9 +427,9 @@ text_cell_data  (GtkTreeViewColumn *column,
        GObject *instance = NULL;
 
        gtk_tree_model_get (tree_model, iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, &fname,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+                           NAME_COLUMN, &fname,
+                           TYPE_COLUMN, &type,
+                           INSTANCE_COLUMN, &instance,
                            -1);
        if (!fname || !instance)
                goto end;
@@ -576,16 +602,16 @@ get_composite_icons (const gchar *icon_code,
        ThreePixbufs *retval;
 
        if (!*pixbuf)
-               *pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (icon_code, MODEST_ICON_SIZE_SMALL));
+               *pixbuf = gdk_pixbuf_copy (modest_platform_get_icon (icon_code, FOLDER_ICON_SIZE));
 
        if (!*pixbuf_open)
                *pixbuf_open = get_composite_pixbuf ("qgn_list_gene_fldr_exp",
-                                                    MODEST_ICON_SIZE_SMALL,
+                                                    FOLDER_ICON_SIZE,
                                                     *pixbuf);
 
        if (!*pixbuf_close)
                *pixbuf_close = get_composite_pixbuf ("qgn_list_gene_fldr_clp",
-                                                     MODEST_ICON_SIZE_SMALL,
+                                                     FOLDER_ICON_SIZE,
                                                      *pixbuf);
 
        retval = g_slice_new0 (ThreePixbufs);
@@ -734,8 +760,8 @@ icon_cell_data  (GtkTreeViewColumn *column,
        rendobj = (GObject *) renderer;
 
        gtk_tree_model_get (tree_model, iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+                           TYPE_COLUMN, &type,
+                           INSTANCE_COLUMN, &instance,
                            -1);
 
        if (!instance)
@@ -1343,8 +1369,8 @@ filter_row (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
        priv = MODEST_FOLDER_VIEW_GET_PRIVATE (data);
 
        gtk_tree_model_get (model, iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+                           TYPE_COLUMN, &type,
+                           INSTANCE_COLUMN, &instance,
                            -1);
 
        /* Do not show if there is no instance, this could indeed
@@ -1354,32 +1380,55 @@ filter_row (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
        if (!instance)
                return FALSE;
 
-       if (type == TNY_FOLDER_TYPE_ROOT) {
-               /* TNY_FOLDER_TYPE_ROOT means that the instance is an
-                  account instead of a folder. */
-               if (TNY_IS_ACCOUNT (instance)) {
-                       TnyAccount *acc = TNY_ACCOUNT (instance);
-                       const gchar *account_id = tny_account_get_id (acc);
-
-                       /* If it isn't a special folder,
-                        * don't show it unless it is the visible account: */
-                       if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE &&
-                           !modest_tny_account_is_virtual_local_folders (acc) &&
-                           strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
-
-                               /* Show only the visible account id */
-                               if (priv->visible_account_id) {
-                                       if (strcmp (account_id, priv->visible_account_id))
-                                               retval = FALSE;
-                               } else {
+       if (TNY_IS_ACCOUNT (instance)) {
+               TnyAccount *acc = TNY_ACCOUNT (instance);
+               const gchar *account_id = tny_account_get_id (acc);
+               
+               /* If it isn't a special folder,
+                * don't show it unless it is the visible account: */
+               if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE &&
+                   !modest_tny_account_is_virtual_local_folders (acc) &&
+                   strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
+                       
+                       /* Show only the visible account id */
+                       if (priv->visible_account_id) {
+                               if (strcmp (account_id, priv->visible_account_id))
                                        retval = FALSE;
-                               }
+                       } else {
+                               retval = FALSE;
                        }
+               }
+               
+               /* Never show these to the user. They are merged into one folder
+                * in the local-folders account instead: */
+               if (retval && MODEST_IS_TNY_OUTBOX_ACCOUNT (acc))
+                       retval = FALSE;
+       } else {
+               GtkTreeIter parent;
 
-                       /* Never show these to the user. They are merged into one folder
-                        * in the local-folders account instead: */
-                       if (retval && MODEST_IS_TNY_OUTBOX_ACCOUNT (acc))
-                               retval = FALSE;
+               if (priv->style == MODEST_FOLDER_VIEW_STYLE_SHOW_ONE &&
+                   !gtk_tree_model_iter_parent (model, iter, &parent)) {
+                       /* Only show special folders for current account if needed */
+                       if (TNY_IS_FOLDER (instance)) {
+                               TnyAccount *account;
+
+                               account = tny_folder_get_account (TNY_FOLDER (instance));
+                               
+                               if (TNY_IS_ACCOUNT (account)) {
+                                       const gchar *account_id = tny_account_get_id (account);
+
+                                       if (!modest_tny_account_is_virtual_local_folders (account) &&
+                                           strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
+                                               /* Show only the visible account id */
+                                               if (priv->visible_account_id) {
+                                                       if (strcmp (account_id, priv->visible_account_id))
+                                                               retval = FALSE;
+                                               }
+                                       }
+                                               g_object_unref (account);
+                               }
+                       }
+                       
                }
        }
 
@@ -1453,7 +1502,12 @@ modest_folder_view_update_model (ModestFolderView *self,
 
        /* FIXME: the local accounts are not shown when the query
           selects only the subscribed folders */
+#ifdef MODEST_TOOLKIT_HILDON2
+       model = tny_gtk_folder_list_store_new_with_flags (NULL, 
+                                                         TNY_GTK_FOLDER_LIST_STORE_FLAG_SHOW_PATH);
+#else
        model = tny_gtk_folder_store_tree_model_new (NULL);
+#endif
 
        /* Get the accounts: */
        tny_account_store_get_accounts (TNY_ACCOUNT_STORE(account_store),
@@ -1462,10 +1516,10 @@ modest_folder_view_update_model (ModestFolderView *self,
 
        sortable = gtk_tree_model_sort_new_with_model (model);
        gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE(sortable),
-                                             TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN,
+                                             NAME_COLUMN,
                                              GTK_SORT_ASCENDING);
        gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (sortable),
-                                        TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN,
+                                        NAME_COLUMN,
                                         cmp_rows, NULL, NULL);
 
        /* Create filter model */
@@ -1512,7 +1566,7 @@ on_selection_changed (GtkTreeSelection *sel, gpointer user_data)
 
        if (selected) {
                gtk_tree_model_get (model, &iter,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder,
+                                   INSTANCE_COLUMN, &folder,
                                    -1);
 
                /* If the folder is the same do not notify */
@@ -1577,7 +1631,7 @@ on_row_activated (GtkTreeView *treeview,
                return;
 
        gtk_tree_model_get (model, &iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder,
+                           INSTANCE_COLUMN, &folder,
                            -1);
 
        g_signal_emit (G_OBJECT(self),
@@ -1626,7 +1680,7 @@ get_cmp_rows_type_pos (GObject *folder)
 }
 
 static gint
-get_cmp_subfolder_type_pos (TnyFolderType t)
+get_cmp_pos (TnyFolderType t)
 {
        /* Inbox, Outbox, Drafts, Sent, User */
        /* 0, 1, 2, 3, 4 */
@@ -1649,6 +1703,64 @@ get_cmp_subfolder_type_pos (TnyFolderType t)
        }
 }
 
+static gint
+compare_account_names (TnyAccount *a1, TnyAccount *a2)
+{
+       const gchar *a1_name, *a2_name;
+
+       a1_name = tny_account_get_name (a1);
+       a2_name = tny_account_get_name (a2);
+
+       return modest_text_utils_utf8_strcmp (a1_name, a2_name, TRUE);
+}
+
+static gint
+compare_accounts (TnyFolderStore *s1, TnyFolderStore *s2)
+{
+       TnyAccount *a1, *a2;
+       gint cmp;
+
+       if (TNY_IS_ACCOUNT (s1)) {
+               a1 = TNY_ACCOUNT (g_object_ref (s1));
+       } else {
+               a1 = tny_folder_get_account (TNY_FOLDER (s1));
+       }
+
+       if (TNY_IS_ACCOUNT (s2)) {
+               a2 = TNY_ACCOUNT (g_object_ref (s2));
+       } else {
+               a2 = tny_folder_get_account (TNY_FOLDER (s2));
+       }
+
+       if (a1 == a2) {
+               cmp = 0;
+               goto finish;
+       }
+       /* First we sort with the type of account */
+       cmp = get_cmp_rows_type_pos (G_OBJECT (a1)) - get_cmp_rows_type_pos (G_OBJECT (a2));
+       if (cmp != 0)
+               goto finish;
+
+       cmp = compare_account_names (a1, a2);
+
+finish:
+       g_object_unref (a1);
+       g_object_unref (a2);
+
+       return cmp;
+}
+
+static gint
+compare_accounts_first (TnyFolderStore *s1, TnyFolderStore *s2)
+{
+       gint is_account1, is_account2;
+
+       is_account1 = TNY_IS_ACCOUNT (s1)?1:0;
+       is_account2 = TNY_IS_ACCOUNT (s2)?1:0;
+
+       return is_account2 - is_account1;
+}
+
 /*
  * This function orders the mail accounts according to these rules:
  * 1st - remote accounts
@@ -1668,14 +1780,14 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        GObject *folder2 = NULL;
 
        gtk_tree_model_get (tree_model, iter1,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, &name1,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder1,
+                           NAME_COLUMN, &name1,
+                           TYPE_COLUMN, &type,
+                           INSTANCE_COLUMN, &folder1,
                            -1);
        gtk_tree_model_get (tree_model, iter2,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, &name2,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type2,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder2,
+                           NAME_COLUMN, &name2,
+                           TYPE_COLUMN, &type2,
+                           INSTANCE_COLUMN, &folder2,
                            -1);
 
        /* Return if we get no folder. This could happen when folder
@@ -1685,90 +1797,24 @@ cmp_rows (GtkTreeModel *tree_model, GtkTreeIter *iter1, GtkTreeIter *iter2,
        if (!folder1 || !folder2)
                goto finish;
 
-       if (type == TNY_FOLDER_TYPE_ROOT) {
-               /* Compare the types, so that
-                * Remote accounts -> Local account -> MMC account .*/
-               const gint pos1 = get_cmp_rows_type_pos (folder1);
-               const gint pos2 = get_cmp_rows_type_pos (folder2);
-               /* printf ("DEBUG: %s:\n  type1=%s, pos1=%d\n  type2=%s, pos2=%d\n",
-                       __FUNCTION__, G_OBJECT_TYPE_NAME(folder1), pos1, G_OBJECT_TYPE_NAME(folder2), pos2); */
-               if (pos1 <  pos2)
-                       cmp = -1;
-               else if (pos1 > pos2)
-                       cmp = 1;
-               else {
-                       /* Compare items of the same type: */
-
-                       TnyAccount *account1 = NULL;
-                       if (TNY_IS_ACCOUNT (folder1))
-                               account1 = TNY_ACCOUNT (folder1);
-
-                       TnyAccount *account2 = NULL;
-                       if (TNY_IS_ACCOUNT (folder2))
-                               account2 = TNY_ACCOUNT (folder2);
-
-                       const gchar *account_id = account1 ? tny_account_get_id (account1) : NULL;
-                       const gchar *account_id2 = account2 ? tny_account_get_id (account2) : NULL;
-
-                       if (!account_id && !account_id2) {
-                               cmp = 0;
-                       } else if (!account_id) {
-                               cmp = -1;
-                       } else if (!account_id2) {
-                               cmp = +1;
-                       } else if (!strcmp (account_id, MODEST_MMC_ACCOUNT_ID)) {
-                               cmp = +1;
-                       } else {
-                               cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
-                       }
-               }
-       } else {
-               gint cmp1 = 0, cmp2 = 0;
-               /* get the parent to know if it's a local folder */
-
-               GtkTreeIter parent;
-               gboolean has_parent;
-               has_parent = gtk_tree_model_iter_parent (tree_model, &parent, iter1);
-               if (has_parent) {
-                       GObject *parent_folder;
-                       TnyFolderType parent_type = TNY_FOLDER_TYPE_UNKNOWN;
-                       gtk_tree_model_get (tree_model, &parent,
-                                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &parent_type,
-                                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &parent_folder,
-                                           -1);
-                       if ((parent_type == TNY_FOLDER_TYPE_ROOT) &&
-                           TNY_IS_ACCOUNT (parent_folder)) {
-                               if (modest_tny_account_is_virtual_local_folders (TNY_ACCOUNT (parent_folder))) {
-                                       cmp1 = get_cmp_subfolder_type_pos (modest_tny_folder_get_local_or_mmc_folder_type
-                                                                          (TNY_FOLDER (folder1)));
-                                       cmp2 = get_cmp_subfolder_type_pos (modest_tny_folder_get_local_or_mmc_folder_type
-                                                                          (TNY_FOLDER (folder2)));
-                               } else if (modest_tny_account_is_memory_card_account (TNY_ACCOUNT (parent_folder))) {
-                                       if (modest_local_folder_info_get_type (tny_folder_get_name (TNY_FOLDER (folder1))) == TNY_FOLDER_TYPE_ARCHIVE) {
-                                               cmp1 = 0;
-                                               cmp2 = 1;
-                                               } else if (modest_local_folder_info_get_type (tny_folder_get_name (TNY_FOLDER (folder2))) == TNY_FOLDER_TYPE_ARCHIVE) {
-                                               cmp1 = 1;
-                                               cmp2 = 0;
-                                       }
-                               }
-                       }
-                       g_object_unref (parent_folder);
-               }
+       /* First sort by type. First the special folders, then the archives */
+       cmp = get_cmp_pos (type) - get_cmp_pos (type2);
+       if (cmp != 0)
+               goto finish;
 
-               /* if they are not local folders */
-               if (cmp1 == cmp2) {
-                       cmp1 = get_cmp_subfolder_type_pos (tny_folder_get_folder_type (TNY_FOLDER (folder1)));
-                       cmp2 = get_cmp_subfolder_type_pos (tny_folder_get_folder_type (TNY_FOLDER (folder2)));
-               }
+       /* Now we sort using the account of each folder */
+       cmp = compare_accounts (TNY_FOLDER_STORE (folder1), TNY_FOLDER_STORE (folder2));
+       if (cmp != 0)
+               goto finish;
 
-               if (cmp1 == cmp2)
-                       cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
-               else
-                       cmp = (cmp1 - cmp2);
-       }
+       /* Each group is preceeded by its account */
+       cmp = compare_accounts_first (TNY_FOLDER_STORE (folder1), TNY_FOLDER_STORE (folder2));
+       if (cmp != 0)
+               goto finish;
 
-finish:
+       /* Pure sort by name */
+       cmp = modest_text_utils_utf8_strcmp (name1, name2, TRUE);
+ finish:
        if (folder1)
                g_object_unref(G_OBJECT(folder1));
        if (folder2)
@@ -1846,7 +1892,7 @@ tree_path_to_folder (GtkTreeModel *model, GtkTreePath *path)
 
        if (gtk_tree_model_get_iter (model,&iter, path))
                gtk_tree_model_get (model, &iter,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &folder,
+                                   INSTANCE_COLUMN, &folder,
                                    -1);
        return folder;
 }
@@ -1914,7 +1960,7 @@ drag_and_drop_from_header_view (GtkTreeModel *source_model,
        /* Get the target folder */
        gtk_tree_model_get_iter (dest_model, &dest_iter, dest_row);
        gtk_tree_model_get (dest_model, &dest_iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
+                           INSTANCE_COLUMN,
                            &folder, -1);
 
        if (!folder || !TNY_IS_FOLDER(folder)) {
@@ -2122,11 +2168,11 @@ drag_and_drop_from_folder_view (GtkTreeModel     *source_model,
        /* Get data */
        gtk_tree_model_get_iter (dest_model, &dest_iter, dest_row);
        gtk_tree_model_get (dest_model, &dest_iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
+                           INSTANCE_COLUMN,
                            &dest_folder, -1);
        gtk_tree_model_get_iter (source_model, &iter, helper->source_row);
        gtk_tree_model_get (source_model, &iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN,
+                           INSTANCE_COLUMN,
                            &folder, -1);
 
        /* Create the info for the performer */
@@ -2522,7 +2568,7 @@ on_configuration_key_changed (ModestConf* conf,
                GtkTreeViewColumn * tree_column;
 
                tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW (self),
-                                                       TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN);
+                                                       NAME_COLUMN);
                gtk_tree_view_column_queue_resize (tree_column);
 #else
                gtk_widget_queue_draw (GTK_WIDGET (self));
@@ -2596,7 +2642,7 @@ find_inbox_iter (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *inbox_iter
                TnyFolderType type = TNY_FOLDER_TYPE_UNKNOWN;
 
                gtk_tree_model_get (model, iter,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN,
+                                   TYPE_COLUMN,
                                    &type, -1);
 
                gboolean result = FALSE;
@@ -2670,9 +2716,9 @@ find_folder_iter (GtkTreeModel *model, GtkTreeIter *iter, GtkTreeIter *folder_it
                gchar *name = NULL;
 
                gtk_tree_model_get (model, iter,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &a_folder,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN, &name,
-                                   TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
+                                   INSTANCE_COLUMN, &a_folder,
+                                   NAME_COLUMN, &name,
+                                   TYPE_COLUMN, &type,
                                    -1);
                g_free (name);
 
@@ -2713,8 +2759,8 @@ on_row_inserted_maybe_select_folder (GtkTreeModel *tree_model,
        priv->reexpand = TRUE;
 
        gtk_tree_model_get (tree_model, iter,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_TYPE_COLUMN, &type,
-                           TNY_GTK_FOLDER_STORE_TREE_MODEL_INSTANCE_COLUMN, &instance,
+                           TYPE_COLUMN, &type,
+                           INSTANCE_COLUMN, &instance,
                            -1);
        if (type == TNY_FOLDER_TYPE_INBOX && priv->folder_to_select == NULL) {
                priv->folder_to_select = g_object_ref (instance);
@@ -2966,7 +3012,7 @@ on_display_name_changed (ModestAccountMgr *mgr,
        GtkTreeViewColumn * tree_column;
 
        tree_column = gtk_tree_view_get_column (GTK_TREE_VIEW (self),
-                                               TNY_GTK_FOLDER_STORE_TREE_MODEL_NAME_COLUMN);
+                                               NAME_COLUMN);
        gtk_tree_view_column_queue_resize (tree_column);
 #else
        gtk_widget_queue_draw (GTK_WIDGET (self));