[caja] 01/02: debian/patches: Add 0005_files-as-bookmarks.patch. Allow the user to drag'n'drop files into the bookmark section. (Closes: #786395).
Mike Gabriel
sunweaver at debian.org
Mon Jun 15 07:50:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
sunweaver pushed a commit to branch master
in repository caja.
commit a7c8a13bed350e03b2747eece96eb6d94fca7d3d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu May 28 11:29:07 2015 +0200
debian/patches: Add 0005_files-as-bookmarks.patch. Allow the user to drag'n'drop files into the bookmark section. (Closes: #786395).
---
debian/patches/0005_files-as-bookmarks.patch | 208 +++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 209 insertions(+)
diff --git a/debian/patches/0005_files-as-bookmarks.patch b/debian/patches/0005_files-as-bookmarks.patch
new file mode 100644
index 0000000..713204e
--- /dev/null
+++ b/debian/patches/0005_files-as-bookmarks.patch
@@ -0,0 +1,208 @@
+From ec0c8f4143d900db6968b5a73a45a08a925b6f06 Mon Sep 17 00:00:00 2001
+From: raveit65 <chat-to-me at raveit.de>
+Date: Mon, 7 Oct 2013 19:17:37 +0200
+Subject: [PATCH] places-sidebar: allow dropping of files to bookmarks
+
+---
+ src/caja-places-sidebar.c | 129 +++++-----------------------------------------
+ 1 file changed, 14 insertions(+), 115 deletions(-)
+
+diff --git a/src/caja-places-sidebar.c b/src/caja-places-sidebar.c
+index f797497..9f79e15 100644
+--- a/src/caja-places-sidebar.c
++++ b/src/caja-places-sidebar.c
+@@ -1130,11 +1130,12 @@ compute_drop_position (GtkTreeView *tree_view,
+ PLACES_SIDEBAR_COLUMN_SECTION_TYPE, §ion_type,
+ -1);
+
+- if (place_type == PLACES_HEADING && section_type != SECTION_BOOKMARKS) {
++ if (section_type != SECTION_BOOKMARKS &&
++ place_type == PLACES_HEADING) {
+ /* never drop on headings, but special case the bookmarks heading,
+- * so we can drop bookmarks in between it and the first item.
++ * so we can drop bookmarks in between it and the first item when
++ * reordering.
+ */
+-
+ gtk_tree_path_free (*path);
+ *path = NULL;
+
+@@ -1145,25 +1146,18 @@ 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) {
+- *pos = GTK_TREE_VIEW_DROP_AFTER;
+- } else {
+- /* non-bookmark shortcuts can only be dragged into */
+- *pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
+- }
+-
+- if (*pos != GTK_TREE_VIEW_DROP_BEFORE &&
+- sidebar->drag_data_received &&
++ if (sidebar->drag_data_received &&
+ sidebar->drag_data_info == GTK_TREE_MODEL_ROW) {
+- /* bookmark rows are never dragged into other bookmark rows */
+- *pos = GTK_TREE_VIEW_DROP_AFTER;
++ /* bookmark rows can only be reordered */
++ *pos = GTK_TREE_VIEW_DROP_AFTER;
++ } else {
++ *pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
+ }
+
+ return TRUE;
+@@ -1204,38 +1198,6 @@ free_drag_data (CajaPlacesSidebar *sidebar)
+ }
+
+ static gboolean
+-can_accept_file_as_bookmark (CajaFile *file)
+-{
+- return (caja_file_is_directory (file) &&
+- !is_built_in_bookmark (file));
+-}
+-
+-static gboolean
+-can_accept_items_as_bookmarks (const GList *items)
+-{
+- int max;
+- char *uri;
+- CajaFile *file;
+-
+- /* Iterate through selection checking if item will get accepted as a bookmark.
+- * If more than 100 items selected, return an over-optimistic result.
+- */
+- for (max = 100; items != NULL && max >= 0; items = items->next, max--)
+- {
+- uri = ((CajaDragSelectionItem *)items->data)->uri;
+- file = caja_file_get_by_uri (uri);
+- if (!can_accept_file_as_bookmark (file))
+- {
+- caja_file_unref (file);
+- return FALSE;
+- }
+- caja_file_unref (file);
+- }
+-
+- return TRUE;
+-}
+-
+-static gboolean
+ drag_motion_callback (GtkTreeView *tree_view,
+ GdkDragContext *context,
+ int x,
+@@ -1265,18 +1227,13 @@ drag_motion_callback (GtkTreeView *tree_view,
+ goto out;
+ }
+
+- if (pos == GTK_TREE_VIEW_DROP_BEFORE ||
+- pos == GTK_TREE_VIEW_DROP_AFTER )
++ if (pos == GTK_TREE_VIEW_DROP_AFTER )
+ {
+ if (sidebar->drag_data_received &&
+ sidebar->drag_data_info == GTK_TREE_MODEL_ROW)
+ {
+ action = GDK_ACTION_MOVE;
+ }
+- else if (can_accept_items_as_bookmarks (sidebar->drag_list))
+- {
+- action = GDK_ACTION_COPY;
+- }
+ else
+ {
+ action = 0;
+@@ -1333,62 +1290,10 @@ drag_leave_callback (GtkTreeView *tree_view,
+ CajaPlacesSidebar *sidebar)
+ {
+ free_drag_data (sidebar);
+- gtk_tree_view_set_drag_dest_row (tree_view, NULL, GTK_TREE_VIEW_DROP_BEFORE);
++ gtk_tree_view_set_drag_dest_row (tree_view, NULL, 0);
+ g_signal_stop_emission_by_name (tree_view, "drag-leave");
+ }
+
+-/* Parses a "text/uri-list" string and inserts its URIs as bookmarks */
+-static void
+-bookmarks_drop_uris (CajaPlacesSidebar *sidebar,
+- GtkSelectionData *selection_data,
+- int position)
+-{
+- CajaBookmark *bookmark;
+- CajaFile *file;
+- char *uri, *name;
+- char **uris;
+- int i;
+- GFile *location;
+- GIcon *icon;
+-
+- uris = gtk_selection_data_get_uris (selection_data);
+- if (!uris)
+- return;
+-
+- for (i = 0; uris[i]; i++)
+- {
+- uri = uris[i];
+- file = caja_file_get_by_uri (uri);
+-
+- if (!can_accept_file_as_bookmark (file))
+- {
+- caja_file_unref (file);
+- continue;
+- }
+-
+- uri = caja_file_get_drop_target_uri (file);
+- location = g_file_new_for_uri (uri);
+- caja_file_unref (file);
+-
+- name = caja_compute_title_for_location (location);
+- icon = g_themed_icon_new (CAJA_ICON_FOLDER);
+- bookmark = caja_bookmark_new (location, name, TRUE, icon);
+-
+- if (!caja_bookmark_list_contains (sidebar->bookmarks, bookmark))
+- {
+- caja_bookmark_list_insert_item (sidebar->bookmarks, bookmark, position++);
+- }
+-
+- g_object_unref (location);
+- g_object_unref (bookmark);
+- g_object_unref (icon);
+- g_free (name);
+- g_free (uri);
+- }
+-
+- g_strfreev (uris);
+-}
+-
+ static GList *
+ uri_list_from_selection (GList *selection)
+ {
+@@ -1526,9 +1431,7 @@ drag_data_received_callback (GtkWidget *widget,
+
+ success = FALSE;
+
+- if (tree_pos == GTK_TREE_VIEW_DROP_BEFORE ||
+- tree_pos == GTK_TREE_VIEW_DROP_AFTER)
+- {
++ if (tree_pos == GTK_TREE_VIEW_DROP_AFTER) {
+ model = gtk_tree_view_get_model (tree_view);
+
+ if (!gtk_tree_model_get_iter (model, &iter, tree_path))
+@@ -1553,10 +1456,6 @@ drag_data_received_callback (GtkWidget *widget,
+
+ switch (info)
+ {
+- case TEXT_URI_LIST:
+- bookmarks_drop_uris (sidebar, selection_data, position);
+- success = TRUE;
+- break;
+ case GTK_TREE_MODEL_ROW:
+ reorder_bookmarks (sidebar, position);
+ success = TRUE;
+
diff --git a/debian/patches/series b/debian/patches/series
index 1358a57..fe6ca3f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
0002_dont-start-desktop-outside-of-MATE-sessions.patch
0003_fix-crash-in-places-sidebar.patch
0004_avoid-automounts-while-screen-is-locked.patch
+0005_files-as-bookmarks.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mate/caja.git
More information about the pkg-mate-commits
mailing list