Highlight destination folder upon conversation DND

Further utilises partially enabled automatic DND. Fixes #422.
This commit is contained in:
Chris Heywood 2019-11-28 11:33:28 +01:00
parent 151d9aed86
commit eb36fd5929
2 changed files with 10 additions and 21 deletions

View file

@ -25,14 +25,10 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
private Application.NotificationContext? monitor = null;
public Tree() {
base(new Gtk.TargetEntry[0], Gdk.DragAction.ASK, drop_handler);
base(TARGET_ENTRY_LIST, Gdk.DragAction.ASK, drop_handler);
base_ref();
entry_selected.connect(on_entry_selected);
// Set self as a drag destination.
Gtk.drag_dest_set(this, Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,
TARGET_ENTRY_LIST, Gdk.DragAction.COPY | Gdk.DragAction.MOVE);
// GtkTreeView binds Ctrl+N to "move cursor to next". Not so interested in that, so we'll
// remove it.
unowned Gtk.BindingSet? binding_set = Gtk.BindingSet.find("GtkTreeView");
@ -213,22 +209,6 @@ public class FolderList.Tree : Sidebar.Tree, Geary.BaseInterface {
folder_selected(null);
}
public override bool drag_motion(Gdk.DragContext context, int x, int y, uint time) {
// Run the base version first.
bool ret = base.drag_motion(context, x, y, time);
// Update the cursor for copy or move.
Gdk.ModifierType mask;
double[] axes = new double[2];
context.get_device().get_state(context.get_dest_window(), axes, out mask);
if ((mask & Gdk.ModifierType.CONTROL_MASK) != 0) {
Gdk.drag_status(context, Gdk.DragAction.COPY, time);
} else {
Gdk.drag_status(context, Gdk.DragAction.MOVE, time);
}
return ret;
}
private void on_ordinal_changed() {
if (account_branches.size <= 1)
return;

View file

@ -325,3 +325,12 @@ popover.geary-editor > grid {
popover.geary-editor > grid > button.geary-setting-remove {
margin-top: 12px;
}
/* FolderList.Tree */
treeview.sidebar:drop(active).after,
treeview.sidebar:drop(active).before,
treeview.sidebar:drop(active).into {
border-top-style: solid;
border-bottom-style: solid;
}