Merge lp:~vikoadi/noise/fix-column-order into lp:~elementary-apps/noise/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Corentin Noël
Approved revision: 1779
Merged at revision: 1780
Proposed branch: lp:~vikoadi/noise/fix-column-order
Merge into: lp:~elementary-apps/noise/trunk
Diff against target: 25 lines (+9/-1)
1 file modified
src/Views/ListView/Lists/TreeViewSetup.vala (+9/-1)
To merge this branch: bzr merge lp:~vikoadi/noise/fix-column-order
Reviewer Review Type Date Requested Status
Corentin Noël Approve
Review via email: mp+252536@code.launchpad.net

Commit message

[TreeViewSetup] Sort column order on importing from sqlite

Description of the change

sort column order on importing from sqlite

To post a comment you must log in.
Revision history for this message
Corentin Noël (tintou) wrote :

Working fine !

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Views/ListView/Lists/TreeViewSetup.vala'
2--- src/Views/ListView/Lists/TreeViewSetup.vala 2015-02-28 13:43:27 +0000
3+++ src/Views/ListView/Lists/TreeViewSetup.vala 2015-03-11 06:06:35 +0000
4@@ -84,7 +84,7 @@
5 */
6 public bool import_columns (string cols) {
7 string[] col_strings = cols.split (COLUMN_SEP_STRING, 0);
8- var new_columns = new Gee.TreeSet<Gtk.TreeViewColumn> ();
9+ var new_columns = new Gee.TreeSet<Gtk.TreeViewColumn> (column_compare_func);
10
11 // the '-1' because col_strings has blank column at end
12 for (int index = 0; index < col_strings.length - 1; ++index) {
13@@ -212,4 +212,12 @@
14 private void append_new_column (ListColumn column, bool initially_visible = true) {
15 columns.add (create_column (column, initially_visible));
16 }
17+
18+ private int column_compare_func (Gtk.TreeViewColumn column_a, Gtk.TreeViewColumn column_b) {
19+ int a = (int) get_column_type (column_a);
20+ int b = (int) get_column_type (column_b);
21+
22+ // return negative value if a<b;zero if a=b;positive value if a>b
23+ return (int) (a > b) - (int) (a < b);
24+ }
25 }

Subscribers

People subscribed via source and target branches