[nautilus-actions] Display sort indicator in tabs



commit 52669f640a3a4330f34a5408338710cf2b296769
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sat Jul 31 22:24:22 2010 +0200

    Display sort indicator in tabs

 ChangeLog                  |    6 ++++++
 TODO                       |    4 ----
 src/nact/nact-match-list.c |   12 +++++++++++-
 3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 16fddc2..7c98194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-07-31 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-match-list.c (on_must_not_match_clicked):
+	Fix incorrect column id.
+
+	* src/nact/nact-match-list.c (sort_on_column):
+	Display sort indicator.
+
 	* src/nact/nact-match-list.c (on_must_match_toggled):
 	Fix crash when defining a positive assertion.
 
diff --git a/TODO b/TODO
index 2f99b4e..38ddcce 100644
--- a/TODO
+++ b/TODO
@@ -469,10 +469,6 @@ Parameter 	Description
   after deleting this default value in the UI, we should write basenames=[] in the I/O provider
   so that we really have an empty list
 
-- 2010-06-03: ui enhancement
-  sortable column headers in tab as basenames, mimetypes, and so on, should have
-  a small indicator of the current sort order
-
 - 2010-06-17: ui enhancement
   all edition (entry, buttons, etc.) fields should have a small emblem when read-only.
 
diff --git a/src/nact/nact-match-list.c b/src/nact/nact-match-list.c
index efebb23..20422c6 100644
--- a/src/nact/nact-match-list.c
+++ b/src/nact/nact-match-list.c
@@ -291,6 +291,9 @@ nact_match_list_init_view( BaseWindow *window, const gchar *tab_name )
 	gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE( model ), ITEM_COLUMN, GTK_SORT_ASCENDING );
 	data->sort_column = ITEM_COLUMN;
 	data->sort_order = GTK_SORT_ASCENDING;
+
+	column = gtk_tree_view_get_column( data->listview, ITEM_COLUMN );
+	sort_on_column( column, data, ITEM_COLUMN );
 }
 
 /**
@@ -608,7 +611,7 @@ on_must_match_toggled( GtkCellRendererToggle *cell_renderer, gchar *path_str, Ma
 static void
 on_must_not_match_clicked( GtkTreeViewColumn *treeviewcolumn, MatchListStr *data )
 {
-	sort_on_column( treeviewcolumn, data, MUST_MATCH_COLUMN );
+	sort_on_column( treeviewcolumn, data, MUST_NOT_MATCH_COLUMN );
 }
 
 static void
@@ -958,10 +961,14 @@ sort_on_column( GtkTreeViewColumn *treeviewcolumn, MatchListStr *data, guint new
 	guint prev_col_id;
 	guint prev_order, new_order;
 	GtkTreeModel *model;
+	GtkTreeViewColumn *column;
 
 	prev_col_id = data->sort_column;
 	prev_order = data->sort_order;
 
+	column = gtk_tree_view_get_column( data->listview, prev_col_id );
+	gtk_tree_view_column_set_sort_indicator( column, FALSE );
+
 	if( new_col_id == prev_col_id ){
 		new_order = ( prev_order == GTK_SORT_ASCENDING ? GTK_SORT_DESCENDING : GTK_SORT_ASCENDING );
 	} else {
@@ -971,6 +978,9 @@ sort_on_column( GtkTreeViewColumn *treeviewcolumn, MatchListStr *data, guint new
 	data->sort_column = new_col_id;
 	data->sort_order = new_order;
 
+	gtk_tree_view_column_set_sort_indicator( treeviewcolumn, TRUE );
+	gtk_tree_view_column_set_sort_order( treeviewcolumn, new_order );
+
 	model = gtk_tree_view_get_model( data->listview );
 	gtk_tree_sortable_set_sort_column_id( GTK_TREE_SORTABLE( model ), new_col_id, new_order );
 }



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