[Xfce4-commits] <postler:master> Easier dragging of multiple messages

Christian Dywan noreply at xfce.org
Mon Feb 21 21:46:01 CET 2011


Updating branch refs/heads/master
         to 4decee8f8b78c5236650b61a46bd710c97b06e7c (commit)
       from 23f7c3900f59e9a0de4555b58debd46f3024a516 (commit)

commit 4decee8f8b78c5236650b61a46bd710c97b06e7c
Author: Sergio Spinatelli <spinatelli.sergio at gmail.com>
Date:   Mon Feb 21 19:46:04 2011 +0100

    Easier dragging of multiple messages
    
    Fixes: https://bugs.launchpad.net/postler/+bug/716202

 postler/postler-messages.vala |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 46aa1c7..d5e002b 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -13,6 +13,7 @@ public class Postler.Messages : Gtk.TreeView {
     Accounts accounts;
     Gtk.TreeStore store;
     Gtk.TreeModelSort sort;
+    Gtk.TreePath defer_select;
     Dexter.Dexter dexter = new Dexter.Dexter ();
 
     public Postler.Content content { get; set; }
@@ -241,7 +242,8 @@ public class Postler.Messages : Gtk.TreeView {
                 filename = Path.get_basename (toggle_flag (location, 'S'));
             uris += ("file://" + location);
         }
-        selection_data.set_uris (uris);
+        if (uris != null)
+            selection_data.set_uris (uris);
     }
 
     public Messages (Accounts accounts) {
@@ -1018,6 +1020,10 @@ public class Postler.Messages : Gtk.TreeView {
     }
 
     public override bool button_press_event (Gdk.EventButton event) {
+        Gtk.TreePath path;
+        Gtk.TreeViewDropPosition pos;
+        get_dest_row_at_pos ((int)event.x, (int)event.y, out path, out pos);
+
         if (event.type == Gdk.EventType.2BUTTON_PRESS) {
             Gtk.TreeIter sort_iter;
             if (get_selected_iter (out sort_iter)) {
@@ -1026,13 +1032,32 @@ public class Postler.Messages : Gtk.TreeView {
                 mark_message_read (sort_iter, ref location);
                 Postler.App.spawn_module ("content", location);
             }
+        } else if (event.type == Gdk.EventType.BUTTON_PRESS
+                && get_selection ().count_selected_rows () > 1
+                && ((event.state & (Gdk.ModifierType.CONTROL_MASK
+                                  | Gdk.ModifierType.SHIFT_MASK)) == 0)
+                && get_selection ().path_is_selected (path)) {
+                    get_selection().set_select_function( () => { return false; });
+                    defer_select = path;
         }
         return base.button_press_event (event);
     }
 
     public override bool button_release_event (Gdk.EventButton event) {
-        if ((event.state & Gdk.ModifierType.BUTTON1_MASK) == 0)
+        if ((event.state & Gdk.ModifierType.BUTTON1_MASK) == 0) {
+            /* Re-enable selection */
+            get_selection().set_select_function(() => { return true; });
+            Gtk.TreePath? path = null;
+            Gtk.TreeViewDropPosition pos;
+            if (defer_select != null
+             && get_dest_row_at_pos ((int)event.x, (int)event.y, out path, out pos)
+             && defer_select == path
+             && !(event.x == 0 && event.y == 0))
+                set_cursor (path, null, false);
+
+            defer_select = null;
             return base.button_release_event (event);
+        }
 
         GLib.List<Gtk.TreePath> paths = get_selection ().get_selected_rows (null);
         Gtk.TreeIter sort_iter = Gtk.TreeIter ();



More information about the Xfce4-commits mailing list