[gucharmap] Sort the tree view column, not the model directly



commit 8daa603590cd403920cbb9b98595975ef0ba8d24
Author: Christian Persch <chpe gnome org>
Date:   Mon May 31 23:03:10 2010 +0200

    Sort the tree view column, not the model directly

 gucharmap/gucharmap-block-chapters-model.c  |    3 ---
 gucharmap/gucharmap-chapters-view.c         |    4 ++++
 gucharmap/gucharmap-script-chapters-model.c |    4 ----
 3 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/gucharmap/gucharmap-block-chapters-model.c b/gucharmap/gucharmap-block-chapters-model.c
index 957371d..e07053e 100644
--- a/gucharmap/gucharmap-block-chapters-model.c
+++ b/gucharmap/gucharmap-block-chapters-model.c
@@ -103,9 +103,6 @@ gucharmap_block_chapters_model_init (GucharmapBlockChaptersModel *model)
                                    GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL,
                                    (GtkTreeIterCompareFunc) compare_iters,
                                    NULL, NULL);
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
-                                        GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL,
-                                        GTK_SORT_ASCENDING);
 }
 
 static GucharmapCodepointList *
diff --git a/gucharmap/gucharmap-chapters-view.c b/gucharmap/gucharmap-chapters-view.c
index 0d944f7..805de99 100644
--- a/gucharmap/gucharmap-chapters-view.c
+++ b/gucharmap/gucharmap-chapters-view.c
@@ -62,6 +62,7 @@ gucharmap_chapters_view_init (GucharmapChaptersView *view)
   column = priv->column = gtk_tree_view_column_new ();
   gtk_tree_view_column_pack_start (column, cell, FALSE);
   gtk_tree_view_column_add_attribute (column, cell, "text", GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL);
+  gtk_tree_view_column_set_sort_column_id (column, GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL);
   gtk_tree_view_append_column (tree_view, column);
 
   selection = gtk_tree_view_get_selection (tree_view);
@@ -106,6 +107,9 @@ gucharmap_chapters_view_set_model (GucharmapChaptersView *view,
     return;
 
   gtk_tree_view_column_set_title (priv->column, gucharmap_chapters_model_get_title (model));
+  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
+                                        GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL,
+                                        GTK_SORT_ASCENDING);
 }
 
 /**
diff --git a/gucharmap/gucharmap-script-chapters-model.c b/gucharmap/gucharmap-script-chapters-model.c
index 8741898..e40348d 100644
--- a/gucharmap/gucharmap-script-chapters-model.c
+++ b/gucharmap/gucharmap-script-chapters-model.c
@@ -51,10 +51,6 @@ gucharmap_script_chapters_model_init (GucharmapScriptChaptersModel *model)
                           -1);
     }
   g_free (unicode_scripts);
-
-  gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (model),
-                                        GUCHARMAP_CHAPTERS_MODEL_COLUMN_LABEL,
-                                        GTK_SORT_ASCENDING);
 }
 
 static GucharmapCodepointList *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]