[Xfce4-commits] <postler:master> Select first message and restore selection after deletion

Christian Dywan noreply at xfce.org
Thu Jun 3 03:24:06 CEST 2010


Updating branch refs/heads/master
         to 002506c5d92da08454e443e23faf6b18250d6852 (commit)
       from 32171bfe45ad8da30fb735a7b0232b0341b81079 (commit)

commit 002506c5d92da08454e443e23faf6b18250d6852
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jun 2 23:34:17 2010 +0200

    Select first message and restore selection after deletion

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

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index f4e1a9c..5c29731 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -333,12 +333,11 @@ public class Postler.Messages : Gtk.TreeView {
             sort.set_sort_column_id (Columns.TIMESTAMP, Gtk.SortType.ASCENDING);
 
             /* Scroll to the bottom */
-            /* FIXME: This is broken atm */
             int last_child = sort.iter_n_children (null) - 1;
             if (last_child > -1) {
                 Gtk.TreeIter sort_iter;
                 if (sort.iter_nth_child (out sort_iter, null, last_child)) {
-                    scroll_to_cell (sort.get_path (sort_iter), null, false, 0, 0);
+                    set_cursor (sort.get_path (sort_iter), null, false);
                 }
             }
             last_location = location;
@@ -376,9 +375,12 @@ public class Postler.Messages : Gtk.TreeView {
                     file.delete (null);
                     Gtk.TreeIter child_iter;
                     sort.convert_iter_to_child_iter (out child_iter, sort_iter);
-                    store.remove (child_iter);
+                    string next_path = sort.get_string_from_iter (sort_iter);
+                    if (store.remove (child_iter)) {
+                        if (sort.get_iter_from_string (out sort_iter, next_path))
+                            set_cursor (sort.get_path (sort_iter), null, false);
+                    }
                     content.clear ();
-                    /* Restore selection */
                 } catch (GLib.Error error) {
                     GLib.critical (_("Failed to delete message \"%s\": %s"),
                         location, error.message);



More information about the Xfce4-commits mailing list