diff options
author | Martin Wimpress <[email protected]> | 2015-06-18 19:00:22 +0100 |
---|---|---|
committer | Martin Wimpress <[email protected]> | 2015-06-18 19:00:22 +0100 |
commit | e3147a24808fdd0cedecfa6b6ca42f376128c76c (patch) | |
tree | 693b2956485261fb7c76b77132897826956e8e25 /src/caja-places-sidebar.c | |
parent | b4e25754bf17ef54569367718eda57ea759108c5 (diff) | |
parent | 3fdb9a14077b14263e8acfc93addc8fbcf568ca1 (diff) | |
download | caja-e3147a24808fdd0cedecfa6b6ca42f376128c76c.tar.bz2 caja-e3147a24808fdd0cedecfa6b6ca42f376128c76c.tar.xz |
Merge pull request #429 from mate-desktop/sux-bugs-and-drag-n-drop
places-sidebar: enable both creating bookmarks and dropping files
Diffstat (limited to 'src/caja-places-sidebar.c')
-rw-r--r-- | src/caja-places-sidebar.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c index 55517be2..24ab023e 100644 --- a/src/caja-places-sidebar.c +++ b/src/caja-places-sidebar.c @@ -1130,11 +1130,13 @@ compute_drop_position (GtkTreeView *tree_view, PLACES_SIDEBAR_COLUMN_SECTION_TYPE, §ion_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; @@ -1145,17 +1147,19 @@ compute_drop_position (GtkTreeView *tree_view, sidebar->drag_data_received && sidebar->drag_data_info == GTK_TREE_MODEL_ROW) { /* don't allow dropping bookmarks into non-bookmark areas */ - - gtk_tree_path_free (*path); - *path = NULL; + gtk_tree_path_free (*path); + *path = NULL; 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; } @@ -1266,10 +1270,10 @@ drag_motion_callback (GtkTreeView *tree_view, } if (pos == GTK_TREE_VIEW_DROP_BEFORE || - pos == GTK_TREE_VIEW_DROP_AFTER ) + pos == GTK_TREE_VIEW_DROP_AFTER ) { if (sidebar->drag_data_received && - sidebar->drag_data_info == GTK_TREE_MODEL_ROW) + sidebar->drag_data_info == GTK_TREE_MODEL_ROW) { action = GDK_ACTION_MOVE; } @@ -1527,7 +1531,7 @@ drag_data_received_callback (GtkWidget *widget, success = FALSE; if (tree_pos == GTK_TREE_VIEW_DROP_BEFORE || - tree_pos == GTK_TREE_VIEW_DROP_AFTER) + tree_pos == GTK_TREE_VIEW_DROP_AFTER) { model = gtk_tree_view_get_model (tree_view); @@ -1538,14 +1542,20 @@ drag_data_received_callback (GtkWidget *widget, gtk_tree_model_get (model, &iter, PLACES_SIDEBAR_COLUMN_SECTION_TYPE, §ion_type, - PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type, + PLACES_SIDEBAR_COLUMN_ROW_TYPE, &place_type, 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++; |