[Xfce4-commits] <postler:master> Highlight folder when dragging a message over it
Christian Dywan
noreply at xfce.org
Sun Feb 20 22:12:01 CET 2011
Updating branch refs/heads/master
to 2197b09cef817157231208bda89086d89e836f67 (commit)
from 95828e752aaf542ca5f941b4d0b44d25cfb42b89 (commit)
commit 2197b09cef817157231208bda89086d89e836f67
Author: Sergio Spinatelli <spinatelli.sergio at gmail.com>
Date: Sun Feb 20 19:11:54 2011 +0100
Highlight folder when dragging a message over it
Fixes: https://bugs.launchpad.net/postler/+bug/716199
postler/postler-folders.vala | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index f72e242..f73a696 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -13,6 +13,7 @@ public class Postler.Folders : Gtk.TreeView {
Accounts accounts;
AccountInfo local_info;
Gtk.TreeStore store;
+ Gtk.TreeIter? selected_folder = null;
public Postler.Messages messages { get; set; }
public string? selected_location { get; private set; }
@@ -72,11 +73,32 @@ public class Postler.Folders : Gtk.TreeView {
}
}
+ bool on_drag_motion (Gdk.DragContext context, int x, int y, uint time_) {
+ if (selected_folder == null) {
+ var model = get_model ();
+ get_selection ().get_selected (out model, out selected_folder);
+ }
+ Gtk.TreePath path;
+ Gtk.TreeViewDropPosition pos;
+ if (get_dest_row_at_pos (x, y, out path, out pos)) {
+ var selection = get_selection ();
+ selection.select_path (path);
+ }
+ return true;
+ }
+
+ void on_drag_leave (Gdk.DragContext context, uint time_) {
+ get_selection ().select_iter (selected_folder);
+ selected_folder = null;
+ }
+
public Folders (Accounts accounts) {
/* Drag and Drop */
Gtk.drag_dest_set (this, Gtk.DestDefaults.ALL, {}, Gdk.DragAction.MOVE);
Gtk.drag_dest_add_uri_targets (this);
drag_data_received.connect (on_drag_data_received);
+ drag_motion.connect (on_drag_motion);
+ drag_leave.connect (on_drag_leave);
this.accounts = accounts;
More information about the Xfce4-commits
mailing list