aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-folder-tree-model.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-01-16 05:56:00 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-01-16 05:56:00 +0800
commitafe8c997fd6887bd22ced7d6e0a1630fcf350131 (patch)
tree30342c90359ce97e00cb507adf6488bafd5e32ae /mail/em-folder-tree-model.c
parent6a22658a6886f3339417307d8f11a0a8e724a0d3 (diff)
downloadgsoc2013-evolution-afe8c997fd6887bd22ced7d6e0a1630fcf350131.tar.gz
gsoc2013-evolution-afe8c997fd6887bd22ced7d6e0a1630fcf350131.tar.zst
gsoc2013-evolution-afe8c997fd6887bd22ced7d6e0a1630fcf350131.zip
Make vfolder_store 'global'.
2004-01-15 Jeffrey Stedfast <fejj@ximian.com> * mail-vfolder.c: Make vfolder_store 'global'. * em-folder-tree-model.c (sort_cb): Fix bug #12600 by not sorting VFolders (ie. show them in the same order they appear in the editor). svn path=/trunk/; revision=24257
Diffstat (limited to 'mail/em-folder-tree-model.c')
-rw-r--r--mail/em-folder-tree-model.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 45ae925398..6f409cfb05 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -182,13 +182,17 @@ em_folder_tree_model_class_init (EMFolderTreeModelClass *klass)
static int
sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
{
- gboolean astore, bstore;
+ extern CamelStore *vfolder_store;
char *aname, *bname;
+ CamelStore *store;
+ gboolean is_store;
- gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &astore, COL_STRING_DISPLAY_NAME, &aname, -1);
- gtk_tree_model_get (model, b, COL_BOOL_IS_STORE, &bstore, COL_STRING_DISPLAY_NAME, &bname, -1);
+ gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store,
+ COL_POINTER_CAMEL_STORE, &store,
+ COL_STRING_DISPLAY_NAME, &aname, -1);
+ gtk_tree_model_get (model, b, COL_STRING_DISPLAY_NAME, &bname, -1);
- if (astore && bstore) {
+ if (is_store) {
/* On This Computer is always first and VFolders is always last */
if (!strcmp (aname, _("On this Computer")))
return -1;
@@ -198,6 +202,30 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
return 1;
if (!strcmp (bname, _("VFolders")))
return -1;
+ } else if (store == vfolder_store) {
+ /* perform no sorting, we want to display in the same
+ * order as they appear in the VFolder editor - UNMATCHED is always last */
+ GtkTreePath *path;
+ int ret;
+
+ if (aname && !strcmp (aname, _("UNMATCHED")))
+ return 1;
+ if (bname && !strcmp (bname, _("UNMATCHED")))
+ return -1;
+
+ path = gtk_tree_model_get_path (model, a);
+ aname = gtk_tree_path_to_string (path);
+ gtk_tree_path_free (path);
+
+ path = gtk_tree_model_get_path (model, b);
+ bname = gtk_tree_path_to_string (path);
+ gtk_tree_path_free (path);
+
+ ret = strcmp (aname, bname);
+ g_free (aname);
+ g_free (bname);
+
+ return ret;
} else {
/* Inbox is always first */
if (aname && (!strcmp (aname, "INBOX") || !strcmp (aname, _("Inbox"))))