diff --git a/nautilus-2.22.0-treeview-xds-dnd.patch b/nautilus-2.22.0-treeview-xds-dnd.patch new file mode 100644 index 0000000..be49931 --- /dev/null +++ b/nautilus-2.22.0-treeview-xds-dnd.patch @@ -0,0 +1,203 @@ +--- nautilus-2.22.0-orig/libnautilus-private/nautilus-tree-view-drag-dest.c 2008-03-07 16:28:45.000000000 +0100 ++++ nautilus-2.22.0-xdstree/libnautilus-private/nautilus-tree-view-drag-dest.c 2008-03-18 15:01:32.000000000 +0100 +@@ -21,6 +21,7 @@ + * Boston, MA 02111-1307, USA. + * + * Author: Dave Camp ++ * XDS support: Benedikt Meurer (adapted by Amos Brocco ) + */ + + /* nautilus-tree-view-drag-dest.c: Handles drag and drop for treeviews which +@@ -38,6 +39,9 @@ + #include "nautilus-icon-dnd.h" + #include "nautilus-link.h" + #include "nautilus-marshal.h" ++#include "nautilus-debug-log.h" ++#include ++#include + + #define AUTO_SCROLL_MARGIN 20 + +@@ -56,6 +60,8 @@ struct _NautilusTreeViewDragDestDetails + guint highlight_id; + guint scroll_id; + guint expand_id; ++ ++ gchar *drop_path; + }; + + enum { +@@ -82,7 +88,8 @@ static const GtkTargetEntry drag_types [ + /* prefer "_NETSCAPE_URL" over "text/uri-list" to satisfy web browsers. */ + { NAUTILUS_ICON_DND_NETSCAPE_URL_TYPE, 0, NAUTILUS_ICON_DND_NETSCAPE_URL }, + { NAUTILUS_ICON_DND_URI_LIST_TYPE, 0, NAUTILUS_ICON_DND_URI_LIST }, +- { NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD } ++ { NAUTILUS_ICON_DND_KEYWORD_TYPE, 0, NAUTILUS_ICON_DND_KEYWORD }, ++ { NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, 0, NAUTILUS_ICON_DND_XDNDDIRECTSAVE }, /* XDS Protocol Type */ + }; + + +@@ -408,6 +415,7 @@ get_drop_action (NautilusTreeViewDragDes + return context->suggested_action; + + case NAUTILUS_ICON_DND_TEXT: ++ case NAUTILUS_ICON_DND_XDNDDIRECTSAVE: + return GDK_ACTION_COPY; + + case NAUTILUS_ICON_DND_KEYWORD: +@@ -438,6 +446,7 @@ drag_motion_callback (GtkWidget *widget, + GtkTreeViewDropPosition pos; + GdkWindow *bin_window; + guint action; ++ gchar *uri_path; + + dest = NAUTILUS_TREE_VIEW_DRAG_DEST (data); + +@@ -464,13 +473,42 @@ drag_motion_callback (GtkWidget *widget, + gtk_tree_view_get_drag_dest_row (GTK_TREE_VIEW (widget), &old_drop_path, + NULL); + ++ + if (action) { ++ ++ /* XDS support: I need to save the drop path here, because I didn't ++ * succeeded to get it from the drag_drop_callback (x and y coordinates ++ * passed to it do not match drop position, so I cannot get the target later) */ ++ ++ uri_path = get_drop_target_uri_for_path (dest, drop_path); ++ ++ if (uri_path != NULL) { ++ if (dest->details->drop_path != NULL) { ++ /* A path is already in, free and replace */ ++ if (strcmp (uri_path, dest->details->drop_path) != 0) { ++ g_free (dest->details->drop_path); ++ dest->details->drop_path = g_strdup (uri_path); ++ } ++ } else { ++ /* No previous path is there */ ++ dest->details->drop_path = g_strdup (uri_path); ++ } ++ ++ g_free (uri_path); ++ ++ } ++ ++ /* End XDS support */ ++ + set_drag_dest_row (dest, drop_path); ++ + model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget)); + if (drop_path == NULL || (old_drop_path != NULL && + gtk_tree_path_compare (old_drop_path, drop_path) != 0)) { + remove_expand_timeout (dest); + } ++ ++ + if (dest->details->expand_id == 0 && drop_path != NULL) { + gtk_tree_model_get_iter (model, &drop_iter, drop_path); + if (gtk_tree_model_iter_has_child (model, &drop_iter)) { +@@ -767,6 +805,22 @@ drag_data_received_callback (GtkWidget * + receive_dropped_keyword (dest, context, x, y); + success = TRUE; + break; ++ case NAUTILUS_ICON_DND_XDNDDIRECTSAVE: ++ /* Indicate that we don't provide "F" fallback */ ++ if (G_UNLIKELY (dest->details->drag_data->format == 8 ++ && dest->details->drag_data->length == 1 ++ && dest->details->drag_data->data[0] == 'F')) { ++ gdk_property_change (GDK_DRAWABLE (context->source_window), ++ gdk_atom_intern (NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE), ++ gdk_atom_intern ("text/plain", FALSE), 8, ++ GDK_PROP_MODE_REPLACE, (const guchar *) "", 0); ++ } else if (G_LIKELY (dest->details->drag_data->format == 8 ++ && dest->details->drag_data->length == 1 ++ && dest->details->drag_data->data[0] == 'S')) { ++ /* FIXME: XDS Successful... Do we need to tell the treeview to update itself? */ ++ } ++ success = TRUE; ++ break; + } + + dest->details->drop_occurred = FALSE; +@@ -791,8 +845,71 @@ drag_drop_callback (GtkWidget *widget, + gpointer data) + { + NautilusTreeViewDragDest *dest; ++ guint info; ++ guchar *prop_text; ++ gint prop_len; ++ GFile *base, *child; ++ gchar *uri = NULL; ++ GdkAtom target; + + dest = NAUTILUS_TREE_VIEW_DRAG_DEST (data); ++ ++ target = gtk_drag_dest_find_target (GTK_WIDGET (dest->details->tree_view), ++ context, ++ NULL); ++ ++ info = dest->details->drag_type; ++ ++ if (G_UNLIKELY (target == GDK_NONE)) { ++ return FALSE; ++ } else if (target != GDK_NONE) { ++ if (info == NAUTILUS_ICON_DND_XDNDDIRECTSAVE) { ++ if (gdk_property_get (context->source_window, gdk_atom_intern (NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE), ++ gdk_atom_intern ("text/plain", FALSE), 0, 1024, FALSE, NULL, NULL, ++ &prop_len, &prop_text) && prop_text != NULL) { ++ /* Zero-terminate the string */ ++ prop_text = g_realloc (prop_text, prop_len + 1); ++ prop_text[prop_len] = '\0'; ++ ++ /* Verify that the file name provided by the source is valid */ ++ if (G_LIKELY (*prop_text != '\0' && strchr ((const gchar *) prop_text, G_DIR_SEPARATOR) == NULL)) { ++ ++ /* Retrieve drop target path */ ++ if (dest->details->drop_path != NULL) { ++ /* Resolve relative path */ ++ base = g_file_new_for_uri (dest->details->drop_path); ++ child = g_file_get_child (base, (const gchar *) prop_text); ++ uri = g_file_get_uri (child); ++ g_object_unref (base); ++ g_object_unref (child); ++ /* Change the property */ ++ gdk_property_change (GDK_DRAWABLE (context->source_window), ++ gdk_atom_intern (NAUTILUS_ICON_DND_XDNDDIRECTSAVE_TYPE, FALSE), ++ gdk_atom_intern ("text/plain", FALSE), 8, ++ GDK_PROP_MODE_REPLACE, (const guchar *) uri, ++ strlen (uri)); ++ ++ /* Free memory */ ++ g_free (dest->details->drop_path); ++ dest->details->drop_path = NULL; ++ g_free (uri); ++ } else { ++ nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, ++ "Could not retrieve XDS drag site "); ++ } ++ } else { ++ /* tell the user that the file name provided by the X Direct Save source is invalid */ ++ nautilus_debug_log (FALSE, NAUTILUS_DEBUG_LOG_DOMAIN_USER, ++ "Invalid filename provided by XDS drag site"); ++ } ++ /* cleanup */ ++ g_free (prop_text); ++ } ++ /* if uri == NULL, we didn't set the property */ ++ if (G_UNLIKELY (uri == NULL)) ++ return FALSE; ++ } ++ } + + dest->details->drop_occurred = TRUE; + +@@ -845,6 +962,9 @@ nautilus_tree_view_drag_dest_finalize (G + dest = NAUTILUS_TREE_VIEW_DRAG_DEST (object); + + free_drag_data (dest); ++ ++ if (dest->details->drop_path) ++ g_free (dest->details->drop_path); + + g_free (dest->details); + diff --git a/nautilus.spec b/nautilus.spec index 92a9b86..4efa900 100644 --- a/nautilus.spec +++ b/nautilus.spec @@ -19,7 +19,7 @@ Name: nautilus Summary: Nautilus is a file manager for GNOME Version: 2.23.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Group: User Interface/Desktops Source: http://download.gnome.org/sources/%{name}/2.23/%{name}-%{version}.tar.bz2 @@ -86,8 +86,6 @@ Patch6: nautilus-2.22.1-dynamic-search.patch Patch7: rtl-fix.patch Patch8: nautilus-2.22.1-hide-white-screen.patch -Patch9: nautilus-2.22-fix-autorun.patch - Patch10: nautilus-gvfs-desktop-key.patch # http://bugzilla.gnome.org/show_bug.cgi?id=528675 @@ -96,12 +94,12 @@ Patch11: nautilus-fix-open-folder.patch # https://bugzilla.redhat.com/show_bug.cgi?id=443944 Patch12: nautilus-cd-burner-move-workaround.patch -# https://bugzilla.gnome.org/show_bug.cgi?id=530720 -Patch13: nautilus-copymove_inside_itself.patch - # https://bugzilla.redhat.com/show_bug.cgi?id=444639 Patch14: nautilus-2.22-default-to-asking.patch +# http://bugzilla.gnome.org/show_bug.cgi?id=171655 +Patch15: nautilus-2.22.0-treeview-xds-dnd.patch + %description Nautilus integrates access to files, applications, media, Internet-based resources and the Web. Nautilus delivers a dynamic and @@ -137,12 +135,11 @@ for writing nautilus extensions. %patch6 -p1 -b .dynamic-search %patch7 -p1 -b .rtl-fix %patch8 -p1 -b .hide-white-screen -# %patch9 -p0 -b .fix-autorun %patch10 -p0 -b .gvfs-desktop-key %patch11 -p1 -b .fix-open-folder %patch12 -p0 -b .cd-burner -%patch13 -p0 -b .recurse %patch14 -p1 -b .default-to-asking +%patch15 -p1 -b .xds %build @@ -255,6 +252,9 @@ fi %changelog +* Fri May 16 2008 Tomas Bzatek - 2.23.2-2 +- Add treeview XDS drag&drop support (#446760) + * Tue May 13 2008 Tomas Bzatek - 2.23.2-1 - Update to 2.23.2