aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--mail/ChangeLog6
-rw-r--r--mail/em-folder-tree-model.c36
-rw-r--r--mail/mail-vfolder.c2
3 files changed, 39 insertions, 5 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ab34b9dbb6..3d21154d1b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,11 @@
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).
+
Fixes bug #52888
* em-folder-tree-model.c (sort_cb): New sort function for the
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"))))
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 21a920b7c2..f014e42d08 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -51,7 +51,7 @@
#define d(x) /*(printf("%s(%d):%s: ", __FILE__, __LINE__, __PRETTY_FUNCTION__), (x))*/
static VfolderContext *context; /* context remains open all time */
-static CamelStore *vfolder_store; /* the 1 static vfolder store */
+CamelStore *vfolder_store; /* the 1 static vfolder store */
/* lock for accessing shared resources (below) */
static pthread_mutex_t vfolder_lock = PTHREAD_MUTEX_INITIALIZER;