diff options
author | 2009-08-04 22:29:26 +0200 | |
---|---|---|
committer | 2009-08-04 22:29:26 +0200 | |
commit | 8e2e95f37a8509c7cbc7b85a61ab7b53f9d7b9d3 (patch) | |
tree | b31ddc98a4af3041e9c94737510adf419e8c5dcc /callbacks.c | |
parent | fbbbd7436a347595e925c5ba8b69e8875b5c73bc (diff) |
fixed drag and drop from filemanagers
Diffstat (limited to 'callbacks.c')
-rw-r--r-- | callbacks.c | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/callbacks.c b/callbacks.c index 2a148fe4..c38e82b9 100644 --- a/callbacks.c +++ b/callbacks.c @@ -360,6 +360,9 @@ on_playlist_drag_drop (GtkWidget *widget, { if (drag_context->targets) { GdkAtom target_type = GDK_POINTER_TO_ATOM (g_list_nth_data (drag_context->targets, TARGET_SAMEWIDGET)); + if (!target_type) { + return FALSE; + } gtk_drag_get_data (widget, drag_context, target_type, time); return TRUE; } @@ -413,35 +416,9 @@ on_playlist_drag_data_received (GtkWidget *widget, gpointer user_data) { gchar *ptr=(char*)data->data; -// printf ("target type: %d\n", target_type); if (target_type == 0) { // uris if (!strncmp(ptr,"file:///",8)) { - //printf ("data: %s\n", ptr); - // this happens when dropped from file manager - // parse, and try to add to playlist - const gchar *p = ptr; - while (*p) { - const gchar *pe = p+1; - while (*pe && *pe > ' ') { - pe++; - } - if (pe - p < 4096 && pe - p > 7) { - char fname[(int)(pe - p)]; - strncpy (fname, p, pe - p); - fname[pe - p] = 0; - if (ps_add_dir (fname+7)) { - ps_add_file (fname+7); - } - } - p = pe; - // skip whitespace - while (*p && *p <= ' ') { - p++; - } - } - gtkps_setup_scrollbar (); - draw_playlist (widget, 0, 0, widget->allocation.width, widget->allocation.height); - gtkps_expose (widget, 0, 0, widget->allocation.width, widget->allocation.height); + gtkps_handle_fm_drag_drop (y, ptr, data->length); } } else if (target_type == 1) { |