diff --git a/src/View/Sidebar/BookmarkRow.vala b/src/View/Sidebar/BookmarkRow.vala index c7dd7a3ec..612327c8a 100644 --- a/src/View/Sidebar/BookmarkRow.vala +++ b/src/View/Sidebar/BookmarkRow.vala @@ -51,7 +51,6 @@ public class Sidebar.BookmarkRow : Gtk.ListBoxRow, SidebarItemInterface { private bool valid = true; //Set to false if scheduled for removal private Gtk.Image icon; - private Files.File target_file; private List drop_file_list = null; private string? drop_text = null; private bool drop_occurred = false; @@ -59,6 +58,7 @@ public class Sidebar.BookmarkRow : Gtk.ListBoxRow, SidebarItemInterface { private Gtk.EventControllerKey key_controller; private Gtk.GestureMultiPress button_controller; + protected Files.File? target_file = null; protected Gtk.Grid content_grid; protected Gtk.Grid icon_label_grid; protected Gtk.Stack label_stack; @@ -524,7 +524,7 @@ public class Sidebar.BookmarkRow : Gtk.ListBoxRow, SidebarItemInterface { y > row_height - 1; // When dropping onto a row, determine what actions are possible - if (!reveal && drop_file_list != null) { + if (target_file != null && !reveal && drop_file_list != null) { Files.DndHandler.file_accepts_drop ( target_file, drop_file_list, diff --git a/src/View/Sidebar/VolumeRow.vala b/src/View/Sidebar/VolumeRow.vala index a1d02ee51..96185d82d 100644 --- a/src/View/Sidebar/VolumeRow.vala +++ b/src/View/Sidebar/VolumeRow.vala @@ -79,6 +79,10 @@ public class Sidebar.VolumeRow : Sidebar.AbstractMountableRow, SidebarItemInterf if (drive_name != null && drive_name != "") { custom_name = _("%s (%s)").printf (custom_name, drive_name); } + + if (mount == null) { + target_file = null; + } } construct { @@ -120,6 +124,8 @@ public class Sidebar.VolumeRow : Sidebar.AbstractMountableRow, SidebarItemInterf protected override void on_mount_added (Mount added_mount) { if (added_mount == volume.get_mount ()) { mount = volume.get_mount (); + target_file = Files.File.get (mount.get_root ()); + target_file.ensure_query_info (); update_visibilities (); } } @@ -127,6 +133,7 @@ public class Sidebar.VolumeRow : Sidebar.AbstractMountableRow, SidebarItemInterf protected override void on_mount_removed (Mount removed_mount) { if (volume.get_mount () == null) { mount = null; + target_file = null; update_visibilities (); } }