[Xfce4-commits] <postler:master> Implement newest messages on top

Christian Dywan noreply at xfce.org
Sat Nov 6 22:32:01 CET 2010


Updating branch refs/heads/master
         to a3a73eab22dbc13d661370f539f30e4d7bec9b6c (commit)
       from 4a357d8431f68c9ae2ec882b3bcc181e6d0727f1 (commit)

commit a3a73eab22dbc13d661370f539f30e4d7bec9b6c
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Nov 6 22:30:14 2010 +0100

    Implement newest messages on top
    
    The reverse behaviour is still available in the code.

 postler/postler-messages.vala |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 94ca777..dd536d0 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -19,6 +19,7 @@ public class Postler.Messages : Gtk.TreeView {
     public bool rich_rows { get; set; default = true; }
     public bool show_attachments { get; set; default = false; }
     public string? selected_location { get; set; }
+    public bool newest_at_the_bottom { get; set; default = false; }
 
     string last_location;
     string last_filter = "";
@@ -627,14 +628,19 @@ public class Postler.Messages : Gtk.TreeView {
             }
 
             sort = new Gtk.TreeModelSort.with_model (store);
-            sort.set_sort_column_id (Columns.TIMESTAMP, Gtk.SortType.ASCENDING);
+            sort.set_sort_column_id (Columns.TIMESTAMP,
+                newest_at_the_bottom ? Gtk.SortType.ASCENDING : Gtk.SortType.DESCENDING);
             model = sort;
 
-            /* Scroll to the bottom */
-            int last_child = sort.iter_n_children (null) - 1;
-            if (last_child > 0)
-                scroll_to_cell (new Gtk.TreePath.from_indices (last_child),
-                                null, false, 0, 0);
+            hadjustment.value = 0;
+            if (newest_at_the_bottom) {
+                int last_child = sort.iter_n_children (null) - 1;
+                if (last_child > 0)
+                    scroll_to_cell (new Gtk.TreePath.from_indices (last_child),
+                                    null, false, 0, 0);
+            }
+            else
+                vadjustment.value = 0;
 
         } catch (GLib.Error error) {
             sort = new Gtk.TreeModelSort.with_model (store);



More information about the Xfce4-commits mailing list