After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 304074 - d&d from explorer doesn't work in gnumeric
d&d from explorer doesn't work in gnumeric
Status: VERIFIED FIXED
Product: Gnumeric
Classification: Applications
Component: General
git master
Other Windows
: Normal normal
: ---
Assigned To: Jody Goldberg
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-05-13 15:47 UTC by Dominic Lachowicz
Modified: 2009-08-15 18:40 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (8.34 KB, patch)
2005-06-06 19:35 UTC, Ivan Wong
none Details | Review
proposed patch (gnumeric) (1.18 KB, patch)
2005-06-06 19:36 UTC, Ivan Wong
accepted-commit_now Details | Review
revised patch (8.34 KB, patch)
2005-06-06 19:43 UTC, Ivan Wong
accepted-commit_now Details | Review

Description Dominic Lachowicz 2005-05-13 15:47:45 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%
Comment 1 Ivan Wong 2005-05-24 06:48:06 UTC
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.
Comment 2 Christian Kirbach 2005-05-25 11:15:43 UTC
Reassigning. What version of gtk+ are we talking about?
Comment 3 Dominic Lachowicz 2005-05-25 12:49:53 UTC
iirc, it's 2.6.4 running natively on win32, with patches from ivan wong also applied
Comment 4 Michael Schumacher 2005-05-25 15:58:16 UTC
FYI, dropping a file onto the application to open it works in GIMP.
Comment 5 Dominic Lachowicz 2005-05-25 16:17:22 UTC
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.
Comment 6 Tor Lillqvist 2005-06-04 22:21:18 UTC
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
Comment 7 Dominic Lachowicz 2005-06-04 22:46:05 UTC
try this out:

http://www.gnome.org/~jody/gnumeric/win32/gnumeric-1.5.1-rc1.exe
Comment 8 Dominic Lachowicz 2005-06-05 18:39:22 UTC
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.
Comment 9 Tor Lillqvist 2005-06-06 04:52:12 UTC
Yes, and text/uri-list is a list of file names. That's what drag-and-dropped
files from Explorer should show up as.
Comment 10 Dominic Lachowicz 2005-06-06 15:59:54 UTC
'gnumeric.exe --gtk-debug=dnd' gives me:

drag-data-received - text/uri-list

just as one would expect.
Comment 11 Dominic Lachowicz 2005-06-06 16:09:03 UTC
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.
Comment 12 Morten Welinder 2005-06-06 17:36:57 UTC
I made scg_drag_receive_uri_list complain about stuff it does not understand.
Comment 13 Ivan Wong 2005-06-06 19:35:43 UTC
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".
Comment 14 Ivan Wong 2005-06-06 19:36:32 UTC
Created attachment 47341 [details] [review]
proposed patch (gnumeric)
Comment 15 Ivan Wong 2005-06-06 19:43:34 UTC
Created attachment 47342 [details] [review]
revised patch

dom: thanks for saving me
Comment 16 Jody Goldberg 2005-06-08 02:55:05 UTC
Both patches seem reasonable. 
Comment 17 Ivan Wong 2005-06-08 07:14:56 UTC
Patch committed.
In addition, our next installer will register the mime type of .gnumeric
Comment 18 Tor Lillqvist 2005-06-17 19:47:40 UTC
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.
Comment 19 Dominic Lachowicz 2005-06-17 19:51:39 UTC
i can verify that this works in gnumeric 1.5.2