summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-06-18 17:03:47 +0300
committerMonsta <[email protected]>2015-06-18 17:03:47 +0300
commit3fdb9a14077b14263e8acfc93addc8fbcf568ca1 (patch)
tree693b2956485261fb7c76b77132897826956e8e25
parent5690a7f39eb644c4cd7c299fd092b0fd5a1a3cd9 (diff)
downloadcaja-3fdb9a14077b14263e8acfc93addc8fbcf568ca1.tar.bz2
caja-3fdb9a14077b14263e8acfc93addc8fbcf568ca1.tar.xz
places-sidebar: enable both creating bookmarks and dropping files
- drag a folder to the top or bottom of the bookmark list to add a new bookmark. a horizontal line will be shown and the mouse pointer will have a '+' at its right side. - if there are no bookmarks (and that section isn't shown), drag a folder over the network section's heading. this will add a new bookmark and make the bookmarks list visible. - drag a file or a folder over some existing bookmark to move it into the bookmarked folder. the mouse pointer will have an arrow at its right side. - if you want to copy a file or a folder there instead, perform the same operation but hold ctrl during that. the mouse pointer will have a '+' at its right side. no horizontal line will be shown, so you will be able to distinguish this operation from adding a new bookmark. :) adapted from https://github.com/linuxmint/nemo/commit/f18c4dd842be0998cbe6a519d9904bfd9993ca3e (thanks to @mtwebster) fixes https://github.com/mate-desktop/caja/issues/345 closes https://github.com/mate-desktop/caja/issues/423
-rw-r--r--src/caja-places-sidebar.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
index 3acd1810..24ab023e 100644
--- a/src/caja-places-sidebar.c
+++ b/src/caja-places-sidebar.c
@@ -1130,9 +1130,12 @@ compute_drop_position (GtkTreeView *tree_view,
PLACES_SIDEBAR_COLUMN_SECTION_TYPE, &section_type,
-1);
- if (place_type == PLACES_HEADING && section_type != SECTION_BOOKMARKS) {
- /* never drop on headings, but special case the bookmarks heading,
- * so we can drop bookmarks in between it and the first item.
+ if (place_type == PLACES_HEADING &&
+ section_type != SECTION_BOOKMARKS &&
+ section_type != SECTION_NETWORK) {
+ /* never drop on headings, but the bookmarks or network heading
+ * is a special case, so we can create new bookmarks by dragging
+ * at the beginning or end of the bookmark list.
*/
gtk_tree_path_free (*path);
*path = NULL;
@@ -1150,10 +1153,13 @@ compute_drop_position (GtkTreeView *tree_view,
return FALSE;
}
- if (section_type == SECTION_BOOKMARKS) {
+ /* drag to top or bottom of bookmark list to add a bookmark */
+ if (place_type == PLACES_HEADING && section_type == SECTION_BOOKMARKS) {
*pos = GTK_TREE_VIEW_DROP_AFTER;
+ } else if (place_type == PLACES_HEADING && section_type == SECTION_NETWORK) {
+ *pos = GTK_TREE_VIEW_DROP_BEFORE;
} else {
- /* non-bookmark shortcuts can only be dragged into */
+ /* or else you want to drag items INTO the existing bookmarks */
*pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
}
@@ -1540,10 +1546,16 @@ drag_data_received_callback (GtkWidget *widget,
PLACES_SIDEBAR_COLUMN_INDEX, &position,
-1);
- if (section_type != SECTION_BOOKMARKS) {
+ if (section_type != SECTION_BOOKMARKS &&
+ !(section_type == SECTION_NETWORK && place_type == PLACES_HEADING)) {
goto out;
}
+ if (section_type == SECTION_NETWORK && place_type == PLACES_HEADING &&
+ tree_pos == GTK_TREE_VIEW_DROP_BEFORE) {
+ position = caja_bookmark_list_length (sidebar->bookmarks);
+ }
+
if (tree_pos == GTK_TREE_VIEW_DROP_AFTER && place_type != PLACES_HEADING) {
/* heading already has position 0 */
position++;