diff options
author | Stephen Fisher <steve@stephen-fisher.com> | 2011-02-07 18:41:38 +0000 |
---|---|---|
committer | Stephen Fisher <steve@stephen-fisher.com> | 2011-02-07 18:41:38 +0000 |
commit | 9d3586b4f5de8f9a9e4fd5f4ec0e5a4fa97518ac (patch) | |
tree | be04b6fa1ad15df0c1c28fc7a185f9fe6224f83f /gtk/drag_and_drop.c | |
parent | 88ea7649d528a506be29c4196f390f0f1a873b96 (diff) |
And even more -DGSEAL_ENABLE cleanup for GTK+ 3.0 preparation...
svn path=/trunk/; revision=35849
Diffstat (limited to 'gtk/drag_and_drop.c')
-rw-r--r-- | gtk/drag_and_drop.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gtk/drag_and_drop.c b/gtk/drag_and_drop.c index f7caca924b..b03219d40c 100644 --- a/gtk/drag_and_drop.c +++ b/gtk/drag_and_drop.c @@ -313,6 +313,8 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin { gpointer dialog; gchar *cf_names_freeme; + const guchar *sel_data_data; + gint sel_data_len; if (info == DND_TARGET_URL) { /* Usually we block incoming events by disabling the corresponding menu/toolbar items. @@ -342,11 +344,18 @@ dnd_data_received(GtkWidget *widget _U_, GdkDragContext *dc _U_, gint x _U_, gin return; } - /* the selection_data will soon be gone, make a copy first */ - /* the data string is not zero terminated -> make a zero terminated "copy" of it */ - cf_names_freeme = g_malloc(selection_data->length + 1); - memcpy(cf_names_freeme, selection_data->data, selection_data->length); - cf_names_freeme[selection_data->length] = '\0'; + /* the selection_data will soon be gone, make a copy first */ + /* the data string is not zero terminated -> make a zero terminated "copy" of it */ +#if GTK_CHECK_VERSION(2,14,0) + sel_data_len = gtk_selection_data_get_length(selection_data); + sel_data_data = gtk_selection_data_get_data(selection_data); +#else + sel_data_len = selection_data->length; + sel_data_data = selection_data->data; +#endif + cf_names_freeme = g_malloc(sel_data_len + 1); + memcpy(cf_names_freeme, sel_data_data, sel_data_len); + cf_names_freeme[sel_data_len] = '\0'; /* ask the user to save it's current capture file first */ if((cfile.state != FILE_CLOSED) && !cfile.user_saved && prefs.gui_ask_unsaved) { |