[Xfce4-commits] <postler:master> Scroll up when refreshing if already at the top
Christian Dywan
noreply at xfce.org
Mon Feb 21 19:28:04 CET 2011
Updating branch refs/heads/master
to f72a8d8e5f9c88bfc418a9028cc4077aab2fc6d2 (commit)
from 72a49de0022da983c5163cbe03d8223adbc9a20b (commit)
commit f72a8d8e5f9c88bfc418a9028cc4077aab2fc6d2
Author: Christian Dywan <christian at twotoasts.de>
Date: Mon Feb 21 19:01:50 2011 +0100
Scroll up when refreshing if already at the top
Fixes: https://bugs.launchpad.net/postler/+bug/722694
postler/postler-messages.vala | 22 +++++++---------------
1 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index e7fdb65..46aa1c7 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2010 Christian Dywan <christian at twotoasts.de>
+ Copyright (C) 2011 Christian Dywan <christian at twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@@ -19,7 +19,6 @@ public class Postler.Messages : Gtk.TreeView {
public bool hide_read { get; set; }
public bool rich_rows { get; set; default = true; }
public bool show_attachments { get; set; default = false; }
- public bool newest_at_the_bottom { get; set; default = false; }
public string? location { get; private set; }
public AccountInfo account_info { get; private set; }
@@ -751,19 +750,10 @@ public class Postler.Messages : Gtk.TreeView {
}
sort = new Gtk.TreeModelSort.with_model (store);
- sort.set_sort_column_id (Columns.TIMESTAMP,
- newest_at_the_bottom ? Gtk.SortType.ASCENDING : Gtk.SortType.DESCENDING);
+ sort.set_sort_column_id (Columns.TIMESTAMP, Gtk.SortType.DESCENDING);
model = sort;
- hadjustment.value = 0;
- if (newest_at_the_bottom) {
- int last_child = n_messages - 1;
- if (last_child > 0)
- scroll_to_cell (new Gtk.TreePath.from_indices (last_child),
- null, false, 0, 0);
- }
- else
- vadjustment.value = 0;
+ hadjustment.value = vadjustment.value = 0;
} catch (GLib.Error error) {
display_error (_("Failed to read folder \"%s\".").printf (location),
@@ -869,6 +859,7 @@ public class Postler.Messages : Gtk.TreeView {
if (message == null)
break;
message.size = 0; /* FIXME: get file size */
+ bool scroll = vadjustment.value == 0;
store.insert_with_values (null, null, 0,
Columns.FLAGGED, message.flagged,
Columns.STATUS, message.status,
@@ -879,6 +870,8 @@ public class Postler.Messages : Gtk.TreeView {
Columns.TIMESTAMP, message.timestamp,
Columns.SIZE, message.size,
Columns.LOCATION, message.location);
+ if (scroll)
+ vadjustment.value = 0;
break;
case FileMonitorEvent.DELETED:
Gtk.TreeIter iter;
@@ -1007,8 +1000,7 @@ public class Postler.Messages : Gtk.TreeView {
sort.convert_iter_to_child_iter (out child_iter, sort_iter);
Gtk.TreePath next_path = sort.get_path (sort_iter);
if (store.remove (child_iter)) {
- if (!newest_at_the_bottom)
- next_path.prev ();
+ next_path.prev ();
if (sort.get_iter (out sort_iter, next_path))
set_cursor (sort.get_path (sort_iter), null, false);
}
More information about the Xfce4-commits
mailing list