# HG changeset patch # User Tomasz Mon # Date 1211468819 -7200 # Node ID 2ce9e17525dc1f40baf1b37b69c1925a24054de0 # Parent c45acc6e352c95c601ea7c6c9b45f0ce0545b757 make dnd working in playlistwin diff -r c45acc6e352c -r 2ce9e17525dc src/skins/Makefile --- a/src/skins/Makefile Thu May 22 16:31:25 2008 +0200 +++ b/src/skins/Makefile Thu May 22 17:06:59 2008 +0200 @@ -3,6 +3,7 @@ SRCS = plugin.c \ skins_cfg.c \ pixbuf_effects.c \ + dnd.c \ ui_fileopener.c \ ui_skin.c \ ui_skinned_window.c \ diff -r c45acc6e352c -r 2ce9e17525dc src/skins/dnd.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/skins/dnd.c Thu May 22 17:06:59 2008 +0200 @@ -0,0 +1,34 @@ +/* Audacious + * Copyright (C) 2005-2007 Audacious development team. + * + * Based on BMP: + * Copyright (C) 2003-2004 BMP development team. + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#include "dnd.h" + +void +aud_drag_dest_set(GtkWidget *widget) +{ + gtk_drag_dest_set(widget, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP, + aud_drop_types, 5, + GDK_ACTION_COPY | GDK_ACTION_MOVE); +} diff -r c45acc6e352c -r 2ce9e17525dc src/skins/dnd.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/skins/dnd.h Thu May 22 17:06:59 2008 +0200 @@ -0,0 +1,51 @@ +/* Audacious - Cross-platform multimedia player + * Copyright (C) 2005-2007 Audacious development team + * + * Based on BMP: + * Copyright (C) 2003-2004 BMP development team + * + * Based on XMMS: + * Copyright (C) 1998-2003 XMMS development team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; under version 3 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * The Audacious team does not consider modular code linking to + * Audacious or using our public API to be a derived work. + */ + +#ifndef AUDACIOUS_DND_H +#define AUDACIOUS_DND_H + +#include + +/* Designate dropped data types that we know and care about */ +enum { + BMP_DROP_STRING, + BMP_DROP_PLAINTEXT, + BMP_DROP_URLENCODED, + BMP_DROP_SKIN, + BMP_DROP_FONT +}; + +/* Drag data format listing for gtk_drag_dest_set() */ +static const GtkTargetEntry aud_drop_types[] = { + {"text/plain", 0, BMP_DROP_PLAINTEXT}, + {"text/uri-list", 0, BMP_DROP_URLENCODED}, + {"STRING", 0, BMP_DROP_STRING}, + {"interface/x-winamp-skin", 0, BMP_DROP_SKIN}, + {"application/x-font-ttf", 0, BMP_DROP_FONT}, +}; + +void aud_drag_dest_set(GtkWidget*); + +#endif /* AUDACIOUS_DND_H */ diff -r c45acc6e352c -r 2ce9e17525dc src/skins/ui_main.c --- a/src/skins/ui_main.c Thu May 22 16:31:25 2008 +0200 +++ b/src/skins/ui_main.c Thu May 22 17:06:59 2008 +0200 @@ -56,9 +56,9 @@ #include "ui_equalizer.h" #include "ui_playlist.h" #include "ui_hints.h" +#include "dnd.h" #if 0 #include "configdb.h" -#include "dnd.h" #include "input.h" #include "main.h" #include "playback.h" @@ -901,8 +901,8 @@ case GDK_c: if (event->state & GDK_CONTROL_MASK) { Playlist *playlist = aud_playlist_get_active(); - gint pos = playlist_get_position(playlist); - gchar *title = playlist_get_songtitle(playlist, pos); + gint pos = aud_playlist_get_position(playlist); + gchar *title = aud_playlist_get_songtitle(playlist, pos); if (title != NULL) { GtkClipboard *clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); @@ -1065,12 +1065,11 @@ guint time, gpointer user_data) { -#if 0 Playlist *playlist = aud_playlist_get_active(); g_return_if_fail(selection_data != NULL); g_return_if_fail(selection_data->data != NULL); - +#if 0 if (aud_str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///")) { gchar *path = (gchar *) selection_data->data; @@ -1096,11 +1095,10 @@ return; } } - +#endif aud_playlist_clear(playlist); aud_playlist_add_url(playlist, (gchar *) selection_data->data); - playback_initiate(); -#endif + audacious_drct_initiate(); } static void @@ -2442,12 +2440,12 @@ G_CALLBACK(mainwin_scrolled), NULL); g_signal_connect(mainwin, "button_release_event", G_CALLBACK(mainwin_mouse_button_release), NULL); -#if 0 + aud_drag_dest_set(mainwin); g_signal_connect(mainwin, "key_press_event", G_CALLBACK(mainwin_keypress), NULL); -#endif + ui_main_evlistener_init(); } diff -r c45acc6e352c -r 2ce9e17525dc src/skins/ui_playlist.c --- a/src/skins/ui_playlist.c Thu May 22 16:31:25 2008 +0200 +++ b/src/skins/ui_playlist.c Thu May 22 17:06:59 2008 +0200 @@ -40,8 +40,8 @@ #include #include "actions-playlist.h" +#include "dnd.h" #if 0 -#include "dnd.h" #include "input.h" #include "main.h" #include "playback.h" @@ -1549,9 +1549,9 @@ G_CALLBACK(playlistwin_scrolled), NULL); g_signal_connect(playlistwin, "motion_notify_event", G_CALLBACK(playlistwin_motion), NULL); -#if 0 + aud_drag_dest_set(playlistwin); -#endif + /* DnD stuff */ g_signal_connect(playlistwin, "drag-leave", G_CALLBACK(playlistwin_drag_end), NULL); diff -r c45acc6e352c -r 2ce9e17525dc src/skins/ui_skinned_playlist.c --- a/src/skins/ui_skinned_playlist.c Thu May 22 16:31:25 2008 +0200 +++ b/src/skins/ui_skinned_playlist.c Thu May 22 17:06:59 2008 +0200 @@ -1070,7 +1070,7 @@ tuple = playlist_get_tuple(pl_active, pos); if ((tuple == NULL) || (tuple_get_int(tuple, FIELD_LENGTH, NULL) < 1)) { - gchar *title = playlist_get_songtitle(pl_active, pos); + gchar *title = aud_playlist_get_songtitle(pl_active, pos); fileinfopopup_show_from_title(popup, title); g_free(title); } else {