GNOME Bugzilla – Bug 304074
d&d from explorer doesn't work in gnumeric
Last modified: 2009-08-15 18:40:50 UTC
This could be a shortcoming in GTK+, so I apologize if this is misfiled against Gnumeric. Start Gnumeric. Find an XL file in Windows Explorer. Drag the XL file to Gnumeric. Notice that the cursor turns into an arrow with a "+" sign, meaning that Explorer thinks it can drop the file onto your app. Expected results: Gnumeric opens the file dropped onto it Actual results: Nothing happens Reproducible: 100%
Very probably a gtk+/win32 issue. I think DND is not supported across native-win32 and gtk+/win32 ATM, just like the situation of copying/pasting image a few months ago.
Reassigning. What version of gtk+ are we talking about?
iirc, it's 2.6.4 running natively on win32, with patches from ivan wong also applied
FYI, dropping a file onto the application to open it works in GIMP.
I can confirm that dropping a PNG or JPEG onto the Gimp opens the image. However, dropping a .gnumeric, .dbf, .csv, .html, or .xls file onto Gnumeric does nothing.
I guess running gnumeric with --gdk-debug=dnd might help tracing this problem. (Make sure to redirect output to a file.) For reference, this is what GIMP outputs when started with --gdk-debug=dnd, and if you drag-and-drop an image onto it: gdk_display_request_selection_notification (..., CLIPBOARD)WM_DRAWCLIPBOARD: owner:00060118 formats: TEXT LOCALE OEMTEXT UNICODETEXT registered -> TRUE gdk_window_register_dnd: 006A04FE gdk_display_request_selection_notification (..., PRIMARY) by default -> TRUE gdk_window_register_dnd: 0017066C WM_DROPFILES: 006A04FE ...C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg: file:///C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/Sunset.jpg gdk_selection_owner_get: 0xc033 (DROPFILES_DND) = 00000000 gdk_selection_convert: 000906BC 0xc033 (DROPFILES_DND) 0xc030 (text/uri-list) gdk_drop_reply gdk_selection_property_get: 000906BC gimp_dnd_data_drop_handle(1 105,144) gdk_window_register_dnd: 000406C2 gdk_drop_finishgdk_drop_finishgdk_drag_context_finalize gdk_property_delete: 000906BC 0xc035 (GDK_SELECTION) _gdk_selection_property_delete: 000906BC
try this out: http://www.gnome.org/~jody/gnumeric/win32/gnumeric-1.5.1-rc1.exe
looking at the gnumeric sources, it looks like gnumeric supports only the following two GtkTargetEntry types: text/uri-list GNUMERIC_SHEET I'll try the --gdk-debug=dnd test when I get to work on Monday and see what GTK+ is handing to gnumeric.
Yes, and text/uri-list is a list of file names. That's what drag-and-dropped files from Explorer should show up as.
'gnumeric.exe --gtk-debug=dnd' gives me: drag-data-received - text/uri-list just as one would expect.
reassigning to gnumeric and goffice. the function go_get_mime_type() depends on gnome-vfs. if gnome-vfs isn't present, it returns "application/octet-string", which isn't handled by gnumeric's scg_drag_receive_uri_list() function. in any case, gnumeric should probably try to accept the drop, and alert the user if it can't import the file instead of silently failing. at least in the !HAVE_GNOME case.
I made scg_drag_receive_uri_list complain about stuff it does not understand.
Created attachment 47340 [details] [review] proposed patch As suggested by gmorten, we are going to use FindMimeFromData() to identify whatever it can and just fall back to "text/plain".
Created attachment 47341 [details] [review] proposed patch (gnumeric)
Created attachment 47342 [details] [review] revised patch dom: thanks for saving me
Both patches seem reasonable.
Patch committed. In addition, our next installer will register the mime type of .gnumeric
If this problem in Gnumeric is fixed now it is probably not relevant, but there was also a bug in gdk/win32 related to drag-and-drop of files. The action and suggested_action fields of the GdkDragContext struct were never initialized. For instance eog (which I use as a simple test application for various things) checks the value of suggested_action, and doesn't accept drops unless it equals GDK_ACTION_COPY. Fixed now in HEAD and gtk-2-6: 2005-06-17 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkdnd-win32.c (gdk_dropfiles_filter): Set the actions and suggested_action fields in the GdkDragContext to GDK_ACTION_COPY. Otherwise apps that check the suggested_action field, like eog, won't accept dropped files.
i can verify that this works in gnumeric 1.5.2