From bb4317f961de4b6089c2670113bdd774ba4e65b5 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 11 Dec 1998 18:12:21 +0000 Subject: [PATCH] 1998-12-11 Owen Taylor * gscreen.c gdesktop.c gdnd.h: enable dragging locale files into Netscape. --- gnome/ChangeLog | 5 +++++ gnome/gdesktop.c | 21 ++++++++++++++++++--- gnome/gdnd.h | 3 ++- gnome/gscreen.c | 22 +++++++++++++++++++--- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/gnome/ChangeLog b/gnome/ChangeLog index 5d273b4ce..9c557de0c 100644 --- a/gnome/ChangeLog +++ b/gnome/ChangeLog @@ -1,3 +1,8 @@ +1998-12-11 Owen Taylor + + * gscreen.c gdesktop.c gdnd.h: enable dragging locale files + into Netscape. + 1998-12-11 Federico Mena Quintero * gicon.c (gicon_get_icon_for_file): First try to fetch the inline diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index f8fed84a8..7fe231faa 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -95,7 +95,8 @@ static struct desktop_icon_info *last_selected_icon; static GtkTargetEntry dnd_icon_sources[] = { { "application/x-mc-desktop-icon", 0, TARGET_MC_DESKTOP_ICON }, { "text/uri-list", 0, TARGET_URI_LIST }, - { "text/plain", 0, TARGET_TEXT_PLAIN } + { "text/plain", 0, TARGET_TEXT_PLAIN }, + { "_NETSCAPE_URL", 0, TARGET_URL } }; static GtkTargetEntry dnd_icon_targets[] = { @@ -953,25 +954,39 @@ drag_data_get (GtkWidget *widget, GdkDragContext *context, GtkSelectionData *sel struct desktop_icon_info *dii; char *filelist; int len; + GList *files; dii = data; + filelist = build_selected_icons_uri_list (&len); switch (info) { case TARGET_MC_DESKTOP_ICON: case TARGET_URI_LIST: case TARGET_TEXT_PLAIN: - filelist = build_selected_icons_uri_list (&len); gtk_selection_data_set (selection_data, selection_data->target, 8, filelist, len); - g_free (filelist); + break; + + case TARGET_URL: + files = gnome_uri_list_extract_uris (filelist); + if (files) { + gtk_selection_data_set (selection_data, + selection_data->target, + 8, + files->data, + strlen (files->data)); + } + gnome_uri_list_free_strings (files); break; default: g_assert_not_reached (); } + + g_free (filelist); } /* Set up a desktop icon as a DnD source */ diff --git a/gnome/gdnd.h b/gnome/gdnd.h index 3ed8e5797..64c51f0ad 100644 --- a/gnome/gdnd.h +++ b/gnome/gdnd.h @@ -16,7 +16,8 @@ enum { TARGET_MC_DESKTOP_ICON, TARGET_URI_LIST, - TARGET_TEXT_PLAIN + TARGET_TEXT_PLAIN, + TARGET_URL }; diff --git a/gnome/gscreen.c b/gnome/gscreen.c index c46ad202f..4a66f7754 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -55,7 +55,8 @@ GdkPixmap *icon_dev_pixmap; GdkBitmap *icon_dev_mask; static GtkTargetEntry drag_types [] = { { "text/uri-list", 0, TARGET_URI_LIST }, - { "text/plain", 0, TARGET_TEXT_PLAIN } + { "text/plain", 0, TARGET_TEXT_PLAIN }, + { "_NETSCAPE_URL", 0, TARGET_URL } }; static GtkTargetEntry drop_types [] = { @@ -675,15 +676,30 @@ panel_drag_data_get (GtkWidget *widget, { int len; char *data; + GList *files; + data = panel_build_selected_file_list (panel, &len); + switch (info){ case TARGET_URI_LIST: case TARGET_TEXT_PLAIN: - data = panel_build_selected_file_list (panel, &len); gtk_selection_data_set (selection_data, selection_data->target, 8, data, len); - g_free (data); + break; + + case TARGET_URL: + files = gnome_uri_list_extract_uris (data); + if (files) { + gtk_selection_data_set (selection_data, + selection_data->target, + 8, + files->data, + strlen (files->data)); + } + gnome_uri_list_free_strings (files); break; } + + g_free (data); } /**