aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-06-23 05:12:13 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-23 05:12:13 +0800
commitd0b89545c588ea26366a69f049f00082c51f283a (patch)
tree874cb2dec067698af94ca2ac2b6337aa7452ed83
parentcaefd7c4828090daaf2cf45095fd3769ec164562 (diff)
downloadgsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar.gz
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar.bz2
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar.lz
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar.xz
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.tar.zst
gsoc2013-evolution-d0b89545c588ea26366a69f049f00082c51f283a.zip
Same as below. (em_folder_tree_model_remove_folders): Same.
2004-06-22 Jeffrey Stedfast <fejj@novell.com> * em-folder-tree-model.c (sort_cb): Same as below. (em_folder_tree_model_remove_folders): Same. svn path=/trunk/; revision=26458
-rw-r--r--mail/ChangeLog3
-rw-r--r--mail/em-folder-tree-model.c50
2 files changed, 33 insertions, 20 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e0678b7c31..c25b0cde45 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,8 @@
2004-06-22 Jeffrey Stedfast <fejj@novell.com>
+ * em-folder-tree-model.c (sort_cb): Same as below.
+ (em_folder_tree_model_remove_folders): Same.
+
* em-folder-tree.c (emft_maybe_expand_row): As toshok discovered,
gtk_tree_model_get() strdup's string arguments, *sigh*, so we need
to free them.
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index aa32044b6f..70a058970f 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -184,6 +184,7 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
char *aname, *bname;
CamelStore *store;
gboolean is_store;
+ int rv = -2;
gtk_tree_model_get (model, a, COL_BOOL_IS_STORE, &is_store,
COL_POINTER_CAMEL_STORE, &store,
@@ -193,34 +194,40 @@ sort_cb (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data
if (is_store) {
/* On This Computer is always first and VFolders is always last */
if (!strcmp (aname, _("On This Computer")))
- return -1;
- if (!strcmp (bname, _("On This Computer")))
- return 1;
- if (!strcmp (aname, _("VFolders")))
- return 1;
- if (!strcmp (bname, _("VFolders")))
- return -1;
+ rv = -1;
+ else if (!strcmp (bname, _("On This Computer")))
+ rv = 1;
+ else if (!strcmp (aname, _("VFolders")))
+ rv = 1;
+ else if (!strcmp (bname, _("VFolders")))
+ rv = -1;
} else if (store == vfolder_store) {
/* UNMATCHED is always last */
if (aname && !strcmp (aname, _("UNMATCHED")))
- return 1;
- if (bname && !strcmp (bname, _("UNMATCHED")))
- return -1;
+ rv = 1;
+ else if (bname && !strcmp (bname, _("UNMATCHED")))
+ rv = -1;
} else {
/* Inbox is always first */
if (aname && (!strcmp (aname, "INBOX") || !strcmp (aname, _("Inbox"))))
- return -1;
- if (bname && (!strcmp (bname, "INBOX") || !strcmp (bname, _("Inbox"))))
- return 1;
+ rv = -1;
+ else if (bname && (!strcmp (bname, "INBOX") || !strcmp (bname, _("Inbox"))))
+ rv = 1;
}
if (aname == NULL) {
if (bname == NULL)
- return 0;
+ rv = 0;
} else if (bname == NULL)
- return 1;
+ rv = 1;
- return g_utf8_collate (aname, bname);
+ if (rv == -2)
+ rv = g_utf8_collate (aname, bname);
+
+ g_free (aname);
+ g_free (bname);
+
+ return rv;
}
static void
@@ -830,7 +837,7 @@ void
em_folder_tree_model_remove_folders (EMFolderTreeModel *model, struct _EMFolderTreeModelStoreInfo *si, GtkTreeIter *toplevel)
{
GtkTreeRowReference *row;
- char *uri, *folder_path;
+ char *uri, *full_name;
gboolean is_store, go;
GtkTreeIter iter;
@@ -845,11 +852,11 @@ em_folder_tree_model_remove_folders (EMFolderTreeModel *model, struct _EMFolderT
}
gtk_tree_model_get ((GtkTreeModel *) model, toplevel, COL_STRING_URI, &uri,
- COL_STRING_FULL_NAME, &folder_path,
+ COL_STRING_FULL_NAME, &full_name,
COL_BOOL_IS_STORE, &is_store, -1);
- if (folder_path && (row = g_hash_table_lookup (si->full_hash, folder_path))) {
- g_hash_table_remove (si->full_hash, folder_path);
+ if (full_name && (row = g_hash_table_lookup (si->full_hash, full_name))) {
+ g_hash_table_remove (si->full_hash, full_name);
gtk_tree_row_reference_free (row);
}
@@ -859,6 +866,9 @@ em_folder_tree_model_remove_folders (EMFolderTreeModel *model, struct _EMFolderT
if (is_store)
em_folder_tree_model_remove_store_info (model, si->store);
+
+ g_free (full_name);
+ g_free (uri);
}