aboutsummaryrefslogtreecommitdiff
path: root/src/foldersel.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-04-07 07:40:06 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-04-07 07:40:06 +0000
commit39c49cbb79d346f277d236c6b069a9de7dad4211 (patch)
treead31dc7288af4d27c5c5b8ffbb5eac265ced41b8 /src/foldersel.c
parent130f58af6de1b8669c01ee873a4188b2ffd9c4d5 (diff)
reimplemented folder view with GtkTreeView.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@202 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src/foldersel.c')
-rw-r--r--src/foldersel.c38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/foldersel.c b/src/foldersel.c
index 218b488d..ae82eb35 100644
--- a/src/foldersel.c
+++ b/src/foldersel.c
@@ -538,7 +538,7 @@ static void foldersel_new_folder(GtkButton *button, gpointer data)
gtk_tree_path_free(new_child_p);
gtk_tree_path_free(selected_p);
- folderview_append_item(new_item);
+ folderview_append_item(folderview_get(), NULL, new_item);
folder_write_list();
}
@@ -569,46 +569,12 @@ static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data
static gint foldersel_folder_name_compare(GtkTreeModel *model, GtkTreeIter *a,
GtkTreeIter *b, gpointer context)
{
- gchar *str_a = NULL, *str_b = NULL;
- gint val = 0;
FolderItem *item_a = NULL, *item_b = NULL;
- GtkTreeIter parent;
gtk_tree_model_get(model, a, FOLDERSEL_FOLDERITEM, &item_a, -1);
gtk_tree_model_get(model, b, FOLDERSEL_FOLDERITEM, &item_b, -1);
- /* no sort for root folder */
- if (!gtk_tree_model_iter_parent(GTK_TREE_MODEL(model), &parent, a))
- return 0;
-
- /* if both a and b are special folders, sort them according to
- * their types (which is in-order). Note that this assumes that
- * there are no multiple folders of a special type. */
- if (item_a->stype != F_NORMAL && item_b->stype != F_NORMAL)
- return item_a->stype - item_b->stype;
-
- /* if b is normal folder, and a is not, b is smaller (ends up
- * lower in the list) */
- if (item_a->stype != F_NORMAL && item_b->stype == F_NORMAL)
- return item_b->stype - item_a->stype;
-
- /* if b is special folder, and a is not, b is larger (ends up
- * higher in the list) */
- if (item_a->stype == F_NORMAL && item_b->stype != F_NORMAL)
- return item_b->stype - item_a->stype;
-
- /* XXX g_utf8_collate_key() comparisons may speed things
- * up when having large lists of folders */
- gtk_tree_model_get(model, a, FOLDERSEL_FOLDERNAME, &str_a, -1);
- gtk_tree_model_get(model, b, FOLDERSEL_FOLDERNAME, &str_b, -1);
-
- /* otherwise just compare the folder names */
- val = g_utf8_collate(str_a, str_b);
-
- g_free(str_a);
- g_free(str_b);
-
- return val;
+ return folder_item_compare(item_a, item_b);
}
static gboolean tree_view_folder_item_func(GtkTreeModel *model,