diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-28 04:31:16 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-28 04:31:16 +0000 |
commit | 21b09182decce85e678c53d410ecd34469a70195 (patch) | |
tree | 822fa1f569fbd61fd27aa348684c15daaaeee5ff /src | |
parent | ddb447ebffca1df375ef875b20c51912e31ab988 (diff) |
src/addressbook.c: automatically sort the tree and list.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2303 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r-- | src/addressbook.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/addressbook.c b/src/addressbook.c index b5fdb86c..c6e52813 100644 --- a/src/addressbook.c +++ b/src/addressbook.c @@ -633,6 +633,10 @@ static void addressbook_create(void) gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), column); gtk_tree_view_set_expander_column(GTK_TREE_VIEW(treeview), column); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(tree_store), + COL_FOLDER_NAME, + GTK_SORT_ASCENDING); + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(addressbook_tree_selection_changed), NULL); g_signal_connect(G_OBJECT(treeview), "button_press_event", @@ -708,6 +712,9 @@ static void addressbook_create(void) gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW(listview), column); + gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list_store), + COL_NAME, GTK_SORT_ASCENDING); + g_signal_connect(G_OBJECT(selection), "changed", G_CALLBACK(addressbook_list_selection_changed), NULL); g_signal_connect(G_OBJECT(listview), "button_press_event", @@ -3204,10 +3211,17 @@ static gint addressbook_tree_compare(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer data) { gchar *name1 = NULL, *name2 = NULL; + AddressObject *obj1 = NULL, *obj2 = NULL; gint ret; - gtk_tree_model_get(model, a, COL_FOLDER_NAME, &name1, -1); - gtk_tree_model_get(model, b, COL_FOLDER_NAME, &name2, -1); + gtk_tree_model_get(model, a, COL_FOLDER_NAME, &name1, COL_OBJ, &obj1, + -1); + gtk_tree_model_get(model, b, COL_FOLDER_NAME, &name2, COL_OBJ, &obj2, + -1); + + /* Do not sort toplevel row */ + if (obj1 && obj1->type == ADDR_INTERFACE) + return 0; if (!name1 || !name2) { if (!name1) |