changeset 3217:764e8f87c186 trunk

port PlayList_List to gtk2
author Tomasz Mon <desowin@gmail.com>
date Thu, 02 Aug 2007 14:14:32 +0200
parents e91acf24afbc
children 018b37cf0730
files src/audacious/Makefile src/audacious/playlist.c src/audacious/ui_main.c src/audacious/ui_playlist.c src/audacious/ui_playlist.h src/audacious/ui_preferences.c src/audacious/ui_skinned_playlist.c src/audacious/ui_skinned_playlist.h src/audacious/widgets/Makefile src/audacious/widgets/playlist_list.c src/audacious/widgets/playlist_list.h src/audacious/widgets/widgetcore.h
diffstat 12 files changed, 1122 insertions(+), 996 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/Makefile	Thu Aug 02 14:14:32 2007 +0200
@@ -125,6 +125,7 @@
 	ui_skinned_equalizer_slider.c \
 	ui_skinned_equalizer_graph.c \
 	ui_skinned_playlist_slider.c \
+	ui_skinned_playlist.c \
 	ui_skinselector.c \
 	ui_urlopener.c \
 	util.c \
--- a/src/audacious/playlist.c	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/playlist.c	Thu Aug 02 14:14:32 2007 +0200
@@ -73,6 +73,7 @@
 
 #include "playlist_evmessages.h"
 #include "playlist_evlisteners.h"
+#include "ui_skinned_playlist.h"
 
 typedef gint (*PlaylistCompareFunc) (PlaylistEntry * a, PlaylistEntry * b);
 typedef void (*PlaylistSaveFunc) (FILE * file);
@@ -1116,8 +1117,8 @@
     }
 
     bottom = MAX(0, playlist_get_length(playlist) -
-                 playlistwin_list->pl_num_visible);
-    row = CLAMP(pos - playlistwin_list->pl_num_visible / 2, 0, bottom);
+                 UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible);
+    row = CLAMP(pos - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible / 2, 0, bottom);
     PLAYLIST_UNLOCK(playlist->mutex);
     playlistwin_set_toprow(row);
     g_cond_signal(cond_scan);
--- a/src/audacious/ui_main.c	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/ui_main.c	Thu Aug 02 14:14:32 2007 +0200
@@ -89,6 +89,7 @@
 #include "ui_skinned_menurow.h"
 #include "ui_skinned_playstatus.h"
 #include "ui_skinned_monostereo.h"
+#include "ui_skinned_playlist.h"
 #include "ui_jumptotrack.h"
 
 #include "ui_main_evlisteners.h"
@@ -1327,7 +1328,7 @@
             return;
 
         cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL);
-        playlist_list_set_font(cfg.playlist_font);
+        ui_skinned_playlist_set_font(cfg.playlist_font);
         playlistwin_update_list(playlist);
 
         g_free(decoded);
--- a/src/audacious/ui_playlist.c	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/ui_playlist.c	Thu Aug 02 14:14:32 2007 +0200
@@ -59,6 +59,7 @@
 #include "ui_skinned_button.h"
 #include "ui_skinned_textbox.h"
 #include "ui_skinned_playlist_slider.h"
+#include "ui_skinned_playlist.h"
 
 #include "icons-stock.h"
 #include "images/audacious_playlist.xpm"
@@ -67,7 +68,7 @@
 
 static GMutex *resize_mutex = NULL;
 
-PlayList_List *playlistwin_list = NULL;
+GtkWidget *playlistwin_list = NULL;
 GtkWidget *playlistwin_shade, *playlistwin_close;
 
 static GdkPixmap *playlistwin_bg;
@@ -234,9 +235,9 @@
 gboolean
 playlistwin_item_visible(gint index)
 {
-    if (index >= playlistwin_list->pl_first
+    if (index >= UI_SKINNED_PLAYLIST(playlistwin_list)->first
         && index <
-        (playlistwin_list->pl_first + playlistwin_list->pl_num_visible))
+        (UI_SKINNED_PLAYLIST(playlistwin_list)->first + UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible))
         return TRUE;
     return FALSE;
 }
@@ -245,7 +246,7 @@
 playlistwin_list_get_visible_count(void)
 {
     if (playlistwin_list)
-    return playlistwin_list->pl_num_visible;
+    return UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible;
     return (-1);
 }
 
@@ -253,7 +254,7 @@
 playlistwin_list_get_first(void)
 {
     if (playlistwin_list)
-    return playlistwin_list->pl_first;
+    return UI_SKINNED_PLAYLIST(playlistwin_list)->first;
     return (-1);
 }
 
@@ -261,7 +262,7 @@
 playlistwin_get_toprow(void)
 {
     if (playlistwin_list)
-        return (playlistwin_list->pl_first);
+        return (UI_SKINNED_PLAYLIST(playlistwin_list)->first);
     return (-1);
 }
 
@@ -269,7 +270,7 @@
 playlistwin_set_toprow(gint toprow)
 {
     if (playlistwin_list)
-        playlistwin_list->pl_first = toprow;
+        UI_SKINNED_PLAYLIST(playlistwin_list)->first = toprow;
     playlistwin_update_list(playlist_get_active());
 }
 
@@ -279,7 +280,7 @@
     /* this can happen early on. just bail gracefully. */
     g_return_if_fail(playlistwin_list);
 
-    widget_queue_redraw(WIDGET(playlistwin_list));
+    gtk_widget_queue_draw(playlistwin_list);
     gtk_widget_queue_draw(playlistwin_slider);
     playlistwin_update_info(playlist);
     playlistwin_update_sinfo(playlist);
@@ -394,8 +395,6 @@
 
     playlistwin_set_mask();
 
-    widget_queue_redraw(WIDGET(playlistwin_list));
-
     draw_playlist_window(TRUE);
 }
 
@@ -440,7 +439,7 @@
 void
 playlistwin_scroll(gint num)
 {
-    playlistwin_list->pl_first += num;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->first += num;
     playlistwin_update_list(playlist_get_active());
 }
 
@@ -462,9 +461,9 @@
     Playlist *playlist = playlist_get_active();
 
     playlist_select_all(playlist, TRUE);
-    playlistwin_list->pl_prev_selected = 0;
-    playlistwin_list->pl_prev_min = 0;
-    playlistwin_list->pl_prev_max = playlist_get_length(playlist) - 1;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = 0;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = 0;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_max = playlist_get_length(playlist) - 1;
     playlistwin_update_list(playlist);
 }
 
@@ -472,8 +471,8 @@
 playlistwin_select_none(void)
 {
     playlist_select_all(playlist_get_active(), FALSE);
-    playlistwin_list->pl_prev_selected = -1;
-    playlistwin_list->pl_prev_min = -1;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1;
     playlistwin_update_list(playlist_get_active());
 }
 
@@ -632,8 +631,8 @@
 playlistwin_inverse_selection(void)
 {
     playlist_select_invert_all(playlist_get_active());
-    playlistwin_list->pl_prev_selected = -1;
-    playlistwin_list->pl_prev_min = -1;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected = -1;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->prev_min = -1;
     playlistwin_update_list(playlist_get_active());
 }
 
@@ -672,7 +671,7 @@
     cfg.playlist_height = height = ty;
 
     g_mutex_lock(resize_mutex);
-    widget_resize_relative(WIDGET(playlistwin_list), dx, dy);
+    ui_skinned_playlist_resize_relative(playlistwin_list, dx, dy);
 
     ui_skinned_playlist_slider_move_relative(playlistwin_slider, dx);
     ui_skinned_playlist_slider_resize_relative(playlistwin_slider, dy);
@@ -756,7 +755,7 @@
                    GdkEventMotion * event,
                    gpointer callback_data)
 {
-    playlistwin_list->pl_tooltips = TRUE;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->tooltips = TRUE;
 }
 
 static void
@@ -764,7 +763,7 @@
                    GdkEventMotion * event,
                    gpointer callback_data)
 {
-    playlistwin_list->pl_tooltips = FALSE;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->tooltips = FALSE;
 }
 
 static void
@@ -1133,11 +1132,6 @@
         else
             cfg.timer_mode = TIMER_ELAPSED;
     }
-    else if (event->button == 2 && (event->type == GDK_BUTTON_PRESS) &&
-             widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
-        gtk_selection_convert(widget, GDK_SELECTION_PRIMARY,
-                              GDK_TARGET_STRING, event->time);
-    }
     else if (event->button == 1 && event->type == GDK_BUTTON_PRESS &&
              !ui_skinned_window_widgetlist_contained(playlistwin, event->x,
                                                      event->y) &&
@@ -1157,7 +1151,6 @@
         return TRUE;
     }
     else if (event->button == 3 &&
-             !(widget_contains(WIDGET(playlistwin_list), event->x, event->y) ||
                (event->y >= cfg.playlist_height - 29 &&
                 event->y < cfg.playlist_height - 11 &&
                 ((event->x >= 12 && event->x < 37) ||
@@ -1165,7 +1158,7 @@
                  (event->x >= 70 && event->x < 95) ||
                  (event->x >= 99 && event->x < 124) ||
                  (event->x >= playlistwin_get_width() - 46 &&
-                  event->x < playlistwin_get_width() - 23))))) {
+                  event->x < playlistwin_get_width() - 23)))) {
         /*
          * Pop up the main menu a few pixels down to avoid
          * anything to be selected initially.
@@ -1174,14 +1167,6 @@
                                 event->y_root + 2, 3, event->time);
         grab = FALSE;
     }
-    else if (event->button == 3 &&
-             widget_contains(WIDGET(playlistwin_list), event->x, event->y)) {
-        handle_press_cb(playlistwin_wlist, widget, event);
-        ui_manager_popup_menu_show(GTK_MENU(playlistwin_popup_menu),
-                               event->x_root, event->y_root + 5,
-                               event->button, event->time);
-        grab = FALSE;
-    }
     else if (event->button == 1 && (event->state & GDK_MOD1_MASK))
     {
         GList *node;
@@ -1244,7 +1229,7 @@
 }
 
 static void
-playlistwin_keypress_up_down_handler(PlayList_List * pl,
+playlistwin_keypress_up_down_handler(UiSkinnedPlaylist * pl,
                                      gboolean up, guint state)
 {
     Playlist *playlist = playlist_get_active();
@@ -1254,52 +1239,52 @@
     if (!(state & GDK_MOD1_MASK))
         playlist_select_all(playlist, FALSE);
 
-    if (pl->pl_prev_selected == -1 ||
-        (!playlistwin_item_visible(pl->pl_prev_selected) &&
-         !(state & GDK_SHIFT_MASK && pl->pl_prev_min != -1))) {
-        pl->pl_prev_selected = pl->pl_first;
+    if (pl->prev_selected == -1 ||
+        (!playlistwin_item_visible(pl->prev_selected) &&
+         !(state & GDK_SHIFT_MASK && pl->prev_min != -1))) {
+        pl->prev_selected = pl->first;
     }
     else if (state & GDK_SHIFT_MASK) {
-        if (pl->pl_prev_min == -1) {
-            pl->pl_prev_max = pl->pl_prev_selected;
-            pl->pl_prev_min = pl->pl_prev_selected;
+        if (pl->prev_min == -1) {
+            pl->prev_max = pl->prev_selected;
+            pl->prev_min = pl->prev_selected;
         }
-        pl->pl_prev_max += (up ? -1 : 1);
-        pl->pl_prev_max =
-            CLAMP(pl->pl_prev_max, 0, playlist_get_length(playlist) - 1);
+        pl->prev_max += (up ? -1 : 1);
+        pl->prev_max =
+            CLAMP(pl->prev_max, 0, playlist_get_length(playlist) - 1);
 
-        pl->pl_first = MIN(pl->pl_first, pl->pl_prev_max);
-        pl->pl_first = MAX(pl->pl_first, pl->pl_prev_max -
-                           pl->pl_num_visible + 1);
-        playlist_select_range(playlist, pl->pl_prev_min, pl->pl_prev_max, TRUE);
+        pl->first = MIN(pl->first, pl->prev_max);
+        pl->first = MAX(pl->first, pl->prev_max -
+                           pl->num_visible + 1);
+        playlist_select_range(playlist, pl->prev_min, pl->prev_max, TRUE);
         return;
     }
     else if (state & GDK_MOD1_MASK) {
         if (up)
-            playlist_list_move_up(pl);
+            ui_skinned_playlist_move_up(pl);
         else
-            playlist_list_move_down(pl);
-        if (pl->pl_prev_min < pl->pl_first)
-            pl->pl_first = pl->pl_prev_min;
-        else if (pl->pl_prev_max >= (pl->pl_first + pl->pl_num_visible))
-            pl->pl_first = pl->pl_prev_max - pl->pl_num_visible + 1;
+            ui_skinned_playlist_move_down(pl);
+        if (pl->prev_min < pl->first)
+            pl->first = pl->prev_min;
+        else if (pl->prev_max >= (pl->first + pl->num_visible))
+            pl->first = pl->prev_max - pl->num_visible + 1;
         return;
     }
     else if (up)
-        pl->pl_prev_selected--;
+        pl->prev_selected--;
     else
-        pl->pl_prev_selected++;
+        pl->prev_selected++;
 
-    pl->pl_prev_selected =
-        CLAMP(pl->pl_prev_selected, 0, playlist_get_length(playlist) - 1);
+    pl->prev_selected =
+        CLAMP(pl->prev_selected, 0, playlist_get_length(playlist) - 1);
 
-    if (pl->pl_prev_selected < pl->pl_first)
-        pl->pl_first--;
-    else if (pl->pl_prev_selected >= (pl->pl_first + pl->pl_num_visible))
-        pl->pl_first++;
+    if (pl->prev_selected < pl->first)
+        pl->first--;
+    else if (pl->prev_selected >= (pl->first + pl->num_visible))
+        pl->first++;
 
-    playlist_select_range(playlist, pl->pl_prev_selected, pl->pl_prev_selected, TRUE);
-    pl->pl_prev_min = -1;
+    playlist_select_range(playlist, pl->prev_selected, pl->prev_selected, TRUE);
+    pl->prev_min = -1;
 }
 
 /* FIXME: Handle the keys through menu */
@@ -1320,33 +1305,33 @@
     case GDK_KP_Down:
     case GDK_Up:
     case GDK_Down:
-        playlistwin_keypress_up_down_handler(playlistwin_list,
+        playlistwin_keypress_up_down_handler(UI_SKINNED_PLAYLIST(playlistwin_list),
                                              keyval == GDK_Up
                                              || keyval == GDK_KP_Up,
                                              event->state);
         refresh = TRUE;
         break;
     case GDK_Page_Up:
-        playlistwin_scroll(-playlistwin_list->pl_num_visible);
+        playlistwin_scroll(-UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible);
         refresh = TRUE;
         break;
     case GDK_Page_Down:
-        playlistwin_scroll(playlistwin_list->pl_num_visible);
+        playlistwin_scroll(UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible);
         refresh = TRUE;
         break;
     case GDK_Home:
-        playlistwin_list->pl_first = 0;
+        UI_SKINNED_PLAYLIST(playlistwin_list)->first = 0;
         refresh = TRUE;
         break;
     case GDK_End:
-        playlistwin_list->pl_first =
-            playlist_get_length(playlist) - playlistwin_list->pl_num_visible;
+        UI_SKINNED_PLAYLIST(playlistwin_list)->first =
+            playlist_get_length(playlist) - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible;
         refresh = TRUE;
         break;
     case GDK_Return:
-        if (playlistwin_list->pl_prev_selected > -1
-            && playlistwin_item_visible(playlistwin_list->pl_prev_selected)) {
-            playlist_set_position(playlist, playlistwin_list->pl_prev_selected);
+        if (UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected > -1
+            && playlistwin_item_visible(UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected)) {
+            playlist_set_position(playlist, UI_SKINNED_PLAYLIST(playlistwin_list)->prev_selected);
             if (!playback_get_playing())
                 playback_initiate();
         }
@@ -1510,9 +1495,9 @@
                         GtkSelectionData * selection_data,
                         guint info, guint time, gpointer user_data)
 {
-    playlistwin_list->pl_drag_motion = TRUE;
-    playlistwin_list->drag_motion_x = x;
-    playlistwin_list->drag_motion_y = y;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = TRUE;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_x = x;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion_y = y;
     playlistwin_update_list(playlist_get_active());
     playlistwin_hint_flag = TRUE;
 }
@@ -1521,7 +1506,7 @@
 playlistwin_drag_end(GtkWidget * widget,
                      GdkDragContext * context, gpointer user_data)
 {
-    playlistwin_list->pl_drag_motion = FALSE;
+    UI_SKINNED_PLAYLIST(playlistwin_list)->drag_motion = FALSE;
     playlistwin_hint_flag = FALSE;
     playlistwin_update_list(playlist_get_active());
 }
@@ -1543,10 +1528,8 @@
         g_message("Received no DND data!");
         return;
     }
-
-    if (widget_contains(WIDGET(playlistwin_list), x, y)) {
-        pos = (y - WIDGET(playlistwin_list)->y) /
-            playlistwin_list->pl_fheight + playlistwin_list->pl_first;
+    if (x < playlistwin_get_width() - 20 || y < cfg.playlist_height - 38) {
+        pos = y / UI_SKINNED_PLAYLIST(playlistwin_list)->fheight + UI_SKINNED_PLAYLIST(playlistwin_list)->first;
 
         pos = MIN(pos, playlist_get_length(playlist));
         playlist_ins_url(playlist, (gchar *) selection_data->data, pos);
@@ -1601,13 +1584,10 @@
     g_signal_connect(playlistwin_close, "clicked", playlistwin_hide, NULL );
 
     /* playlist list box */
-    playlistwin_list =
-        create_playlist_list(&playlistwin_wlist, playlistwin_bg,
-                             SKINNED_WINDOW(playlistwin)->gc, 12, 20,
+    playlistwin_list = ui_skinned_playlist_new(SKINNED_WINDOW(playlistwin)->fixed, 12, 20,
                              playlistwin_get_width() - 31,
                              cfg.playlist_height - 58);
-    playlist_list_set_font(cfg.playlist_font);
-    ui_skinned_window_widgetlist_associate(playlistwin, WIDGET(playlistwin_list));
+    ui_skinned_playlist_set_font(cfg.playlist_font);
 
     /* playlist list box slider */
     playlistwin_slider = ui_skinned_playlist_slider_new(SKINNED_WINDOW(playlistwin)->fixed, playlistwin_get_width() - 15,
@@ -2182,11 +2162,11 @@
 
     win = gdk_window_at_pointer(NULL, NULL);
     gdk_window_get_pointer(GDK_WINDOW(playlistwin->window), &x, &y, NULL);
-    pos = playlist_list_get_playlist_position(playlistwin_list, x, y);
+    pos = ui_skinned_playlist_get_position(playlistwin_list, x - 12, y - 20);
 
     if (win == NULL
         || cfg.show_filepopup_for_tuple == FALSE
-        || playlistwin_list->pl_tooltips == FALSE
+        || UI_SKINNED_PLAYLIST(playlistwin_list)->tooltips == FALSE
         || pos != prev_pos
         || win != GDK_WINDOW(playlistwin->window))
     {
--- a/src/audacious/ui_playlist.h	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/ui_playlist.h	Thu Aug 02 14:14:32 2007 +0200
@@ -77,7 +77,7 @@
 gint playlistwin_list_get_first(void);
 
 extern GtkWidget *playlistwin;
-extern PlayList_List *playlistwin_list;
+extern GtkWidget *playlistwin_list;
 
 extern gboolean playlistwin_focus;
 
--- a/src/audacious/ui_preferences.c	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/ui_preferences.c	Thu Aug 02 14:14:32 2007 +0200
@@ -61,6 +61,7 @@
 #include "ui_skinselector.h"
 #include "ui_preferences.h"
 #include "ui_equalizer.h"
+#include "ui_skinned_playlist.h"
 
 #include "build_stamp.h"
 
@@ -931,7 +932,7 @@
     g_free(cfg.playlist_font);
     cfg.playlist_font = g_strdup(gtk_font_button_get_font_name(button));
 
-    playlist_list_set_font(cfg.playlist_font);
+    ui_skinned_playlist_set_font(cfg.playlist_font);
     playlistwin_set_sinfo_font(cfg.playlist_font);  /* propagate font setting to playlistwin_sinfo */
     playlistwin_update_list(playlist_get_active());
     draw_playlist_window(TRUE);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_skinned_playlist.c	Thu Aug 02 14:14:32 2007 +0200
@@ -0,0 +1,971 @@
+/*
+ * Audacious - a cross-platform multimedia player
+ * Copyright (c) 2007  Audacious development team.
+ *
+ * Based on:
+ * BMP - Cross-platform multimedia player
+ * Copyright (C) 2003-2004  BMP development team.
+ * 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 <http://www.gnu.org/licenses>.
+ *
+ * The Audacious team does not consider modular code linking to
+ * Audacious or using our public API to be a derived work.
+ */
+
+/*
+ *  A note about Pango and some funky spacey fonts: Weirdly baselined
+ *  fonts, or fonts with weird ascents or descents _will_ display a
+ *  little bit weird in the playlist widget, but the display engine
+ *  won't make it look too bad, just a little deranged.  I honestly
+ *  don't think it's worth fixing (around...), it doesn't have to be
+ *  perfectly fitting, just the general look has to be ok, which it
+ *  IMHO is.
+ *
+ *  A second note: The numbers aren't perfectly aligned, but in the
+ *  end it looks better when using a single Pango layout for each
+ *  number.
+ */
+
+
+#include "widgets/widgetcore.h"
+#include "ui_skinned_playlist.h"
+#include "main.h"
+#include "util.h"
+#include "ui_playlist.h"
+
+#include "input.h"
+#include "strings.h"
+#include "playback.h"
+#include "playlist.h"
+#include "ui_manager.h"
+
+#include "debug.h"
+static PangoFontDescription *playlist_list_font = NULL;
+static gint ascent, descent, width_delta_digit_one;
+static gboolean has_slant;
+static guint padding;
+
+/* FIXME: the following globals should not be needed. */
+static gint width_approx_letters;
+static gint width_colon, width_colon_third;
+static gint width_approx_digits, width_approx_digits_half;
+
+#define UI_SKINNED_PLAYLIST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_playlist_get_type(), UiSkinnedPlaylistPrivate))
+typedef struct _UiSkinnedPlaylistPrivate UiSkinnedPlaylistPrivate;
+
+enum {
+    REDRAW,
+    LAST_SIGNAL
+};
+
+struct _UiSkinnedPlaylistPrivate {
+    GtkWidget        *fixed;
+    SkinPixmapId     skin_index;
+    gint             width, height;
+    gint             resize_width, resize_height;
+    gint             drag_pos;
+    gboolean         dragging, auto_drag_down, auto_drag_up;
+    gint             auto_drag_up_tag, auto_drag_down_tag;
+};
+
+static void ui_skinned_playlist_class_init         (UiSkinnedPlaylistClass *klass);
+static void ui_skinned_playlist_init               (UiSkinnedPlaylist *playlist);
+static void ui_skinned_playlist_destroy            (GtkObject *object);
+static void ui_skinned_playlist_realize            (GtkWidget *widget);
+static void ui_skinned_playlist_size_request       (GtkWidget *widget, GtkRequisition *requisition);
+static void ui_skinned_playlist_size_allocate      (GtkWidget *widget, GtkAllocation *allocation);
+static gboolean ui_skinned_playlist_expose         (GtkWidget *widget, GdkEventExpose *event);
+static gboolean ui_skinned_playlist_button_press   (GtkWidget *widget, GdkEventButton *event);
+static gboolean ui_skinned_playlist_button_release (GtkWidget *widget, GdkEventButton *event);
+static gboolean ui_skinned_playlist_motion_notify  (GtkWidget *widget, GdkEventMotion *event);
+static void ui_skinned_playlist_redraw             (UiSkinnedPlaylist *playlist);
+
+static GtkWidgetClass *parent_class = NULL;
+static guint playlist_signals[LAST_SIGNAL] = { 0 };
+
+GType ui_skinned_playlist_get_type() {
+    static GType playlist_type = 0;
+    if (!playlist_type) {
+        static const GTypeInfo playlist_info = {
+            sizeof (UiSkinnedPlaylistClass),
+            NULL,
+            NULL,
+            (GClassInitFunc) ui_skinned_playlist_class_init,
+            NULL,
+            NULL,
+            sizeof (UiSkinnedPlaylist),
+            0,
+            (GInstanceInitFunc) ui_skinned_playlist_init,
+        };
+        playlist_type = g_type_register_static (GTK_TYPE_WIDGET, "UiSkinnedPlaylist", &playlist_info, 0);
+    }
+
+    return playlist_type;
+}
+
+static void ui_skinned_playlist_class_init(UiSkinnedPlaylistClass *klass) {
+    GObjectClass *gobject_class;
+    GtkObjectClass *object_class;
+    GtkWidgetClass *widget_class;
+
+    gobject_class = G_OBJECT_CLASS(klass);
+    object_class = (GtkObjectClass*) klass;
+    widget_class = (GtkWidgetClass*) klass;
+    parent_class = gtk_type_class (gtk_widget_get_type ());
+
+    object_class->destroy = ui_skinned_playlist_destroy;
+
+    widget_class->realize = ui_skinned_playlist_realize;
+    widget_class->expose_event = ui_skinned_playlist_expose;
+    widget_class->size_request = ui_skinned_playlist_size_request;
+    widget_class->size_allocate = ui_skinned_playlist_size_allocate;
+    widget_class->button_press_event = ui_skinned_playlist_button_press;
+    widget_class->button_release_event = ui_skinned_playlist_button_release;
+    widget_class->motion_notify_event = ui_skinned_playlist_motion_notify;
+
+    klass->redraw = ui_skinned_playlist_redraw;
+
+    playlist_signals[REDRAW] = 
+        g_signal_new ("redraw", G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+                      G_STRUCT_OFFSET (UiSkinnedPlaylistClass, redraw), NULL, NULL,
+                      gtk_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+    g_type_class_add_private (gobject_class, sizeof (UiSkinnedPlaylistPrivate));
+}
+
+static void ui_skinned_playlist_init(UiSkinnedPlaylist *playlist) {
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
+    playlist->pressed = FALSE;
+    priv->resize_width = 0;
+    priv->resize_height = 0;
+    playlist->prev_selected = -1;
+    playlist->prev_min = -1;
+    playlist->prev_max = -1;
+}
+
+GtkWidget* ui_skinned_playlist_new(GtkWidget *fixed, gint x, gint y, gint w, gint h) {
+
+    UiSkinnedPlaylist *hs = g_object_new (ui_skinned_playlist_get_type (), NULL);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(hs);
+
+    hs->x = x;
+    hs->y = y;
+    priv->width = w;
+    priv->height = h;
+    priv->fixed = fixed;
+    priv->skin_index = SKIN_PLEDIT;
+
+    gtk_fixed_put(GTK_FIXED(priv->fixed), GTK_WIDGET(hs), hs->x, hs->y);
+
+    return GTK_WIDGET(hs);
+}
+
+static void ui_skinned_playlist_destroy(GtkObject *object) {
+    UiSkinnedPlaylist *playlist;
+
+    g_return_if_fail (object != NULL);
+    g_return_if_fail (UI_SKINNED_IS_PLAYLIST (object));
+
+    playlist = UI_SKINNED_PLAYLIST (object);
+
+    if (GTK_OBJECT_CLASS (parent_class)->destroy)
+        (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+}
+
+static void ui_skinned_playlist_realize(GtkWidget *widget) {
+    UiSkinnedPlaylist *playlist;
+    GdkWindowAttr attributes;
+    gint attributes_mask;
+
+    g_return_if_fail (widget != NULL);
+    g_return_if_fail (UI_SKINNED_IS_PLAYLIST(widget));
+
+    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+    playlist = UI_SKINNED_PLAYLIST(widget);
+
+    attributes.x = widget->allocation.x;
+    attributes.y = widget->allocation.y;
+    attributes.width = widget->allocation.width;
+    attributes.height = widget->allocation.height;
+    attributes.wclass = GDK_INPUT_OUTPUT;
+    attributes.window_type = GDK_WINDOW_CHILD;
+    attributes.event_mask = gtk_widget_get_events(widget);
+    attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | 
+                             GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK;
+    attributes.visual = gtk_widget_get_visual(widget);
+    attributes.colormap = gtk_widget_get_colormap(widget);
+
+    attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
+    widget->window = gdk_window_new(widget->parent->window, &attributes, attributes_mask);
+
+    widget->style = gtk_style_attach(widget->style, widget->window);
+    gdk_window_set_user_data(widget->window, widget);
+}
+
+static void ui_skinned_playlist_size_request(GtkWidget *widget, GtkRequisition *requisition) {
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
+
+    requisition->width = priv->width;
+    requisition->height = priv->height;
+}
+
+static void ui_skinned_playlist_size_allocate(GtkWidget *widget, GtkAllocation *allocation) {
+    UiSkinnedPlaylist *playlist = UI_SKINNED_PLAYLIST (widget);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
+
+    widget->allocation = *allocation;
+    if (GTK_WIDGET_REALIZED (widget))
+        gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height);
+
+    playlist->x = widget->allocation.x;
+    playlist->y = widget->allocation.y;
+
+    if (priv->height != widget->allocation.height || priv->width != widget->allocation.width) {
+        priv->width = priv->width + priv->resize_width;
+        priv->height = priv->height + priv->resize_height;
+        priv->resize_width = 0;
+        priv->resize_height = 0;
+        gtk_widget_queue_draw(widget);
+    }
+}
+
+static gboolean ui_skinned_playlist_auto_drag_down_func(gpointer data) {
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(data);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(data);
+
+    if (priv->auto_drag_down) {
+        ui_skinned_playlist_move_down(pl);
+        pl->first++;
+        playlistwin_update_list(playlist_get_active());
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static gboolean ui_skinned_playlist_auto_drag_up_func(gpointer data) {
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(data);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(data);
+
+    if (priv->auto_drag_up) {
+        ui_skinned_playlist_move_up(pl);
+        pl->first--;
+        playlistwin_update_list(playlist_get_active());
+        return TRUE;
+
+    }
+    return FALSE;
+}
+
+void ui_skinned_playlist_move_up(UiSkinnedPlaylist * pl) {
+    GList *list;
+    Playlist *playlist = playlist_get_active();
+
+    if (!playlist)
+        return;
+
+    PLAYLIST_LOCK(playlist->mutex);
+    if ((list = playlist->entries) == NULL) {
+        PLAYLIST_UNLOCK(playlist->mutex);
+        return;
+    }
+    if (PLAYLIST_ENTRY(list->data)->selected) {
+        /* We are at the top */
+        PLAYLIST_UNLOCK(playlist->mutex);
+        return;
+    }
+    while (list) {
+        if (PLAYLIST_ENTRY(list->data)->selected)
+            glist_moveup(list);
+        list = g_list_next(list);
+    }
+    PLAYLIST_UNLOCK(playlist->mutex);
+    if (pl->prev_selected != -1)
+        pl->prev_selected--;
+    if (pl->prev_min != -1)
+        pl->prev_min--;
+    if (pl->prev_max != -1)
+        pl->prev_max--;
+}
+
+void ui_skinned_playlist_move_down(UiSkinnedPlaylist * pl) {
+    GList *list;
+    Playlist *playlist = playlist_get_active();
+
+    if (!playlist)
+        return;
+
+    PLAYLIST_LOCK(playlist->mutex);
+
+    if (!(list = g_list_last(playlist->entries))) {
+        PLAYLIST_UNLOCK(playlist->mutex);
+        return;
+    }
+
+    if (PLAYLIST_ENTRY(list->data)->selected) {
+        /* We are at the bottom */
+        PLAYLIST_UNLOCK(playlist->mutex);
+        return;
+    }
+
+    while (list) {
+        if (PLAYLIST_ENTRY(list->data)->selected)
+            glist_movedown(list);
+        list = g_list_previous(list);
+    }
+
+    PLAYLIST_UNLOCK(playlist->mutex);
+
+    if (pl->prev_selected != -1)
+        pl->prev_selected++;
+    if (pl->prev_min != -1)
+        pl->prev_min++;
+    if (pl->prev_max != -1)
+        pl->prev_max++;
+}
+
+static void
+playlist_list_draw_string(GdkPixmap *obj, GdkGC *gc, UiSkinnedPlaylist *pl,
+                          PangoFontDescription * font,
+                          gint line,
+                          gint width,
+                          const gchar * text,
+                          guint ppos)
+{
+    guint plist_length_int;
+    Playlist *playlist = playlist_get_active();
+    PangoLayout *layout;
+
+    REQUIRE_LOCK(playlist->mutex);
+
+    if (cfg.show_numbers_in_pl) {
+        gchar *pos_string = g_strdup_printf(cfg.show_separator_in_pl == TRUE ? "%d" : "%d.", ppos);
+        plist_length_int =
+            gint_count_digits(playlist_get_length(playlist)) + !cfg.show_separator_in_pl + 1; /* cf.show_separator_in_pl will be 0 if false */
+
+        padding = plist_length_int;
+        padding = ((padding + 1) * width_approx_digits);
+
+        layout = gtk_widget_create_pango_layout(playlistwin, pos_string);
+        pango_layout_set_font_description(layout, playlist_list_font);
+        pango_layout_set_width(layout, plist_length_int * 100);
+
+        pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
+
+
+        gdk_draw_layout(obj, gc, (width_approx_digits *
+                         (-1 + plist_length_int - strlen(pos_string))) +
+                        (width_approx_digits / 4),
+                        (line - 1) * pl->fheight +
+                        ascent + abs(descent), layout);
+        g_free(pos_string);
+        g_object_unref(layout);
+
+        if (!cfg.show_separator_in_pl)
+            padding -= (width_approx_digits * 1.5);
+    } else {
+        padding = 3;
+    }
+
+    width -= padding;
+
+    layout = gtk_widget_create_pango_layout(playlistwin, text);
+
+    pango_layout_set_font_description(layout, playlist_list_font);
+    pango_layout_set_width(layout, width * PANGO_SCALE);
+    pango_layout_set_single_paragraph_mode(layout, TRUE);
+    pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
+    gdk_draw_layout(obj, gc,
+                    padding + (width_approx_letters / 4),
+                    (line - 1) * pl->fheight +
+                    ascent + abs(descent), layout);
+
+    g_object_unref(layout);
+}
+
+static gboolean ui_skinned_playlist_expose(GtkWidget *widget, GdkEventExpose *event) {
+    g_return_val_if_fail (widget != NULL, FALSE);
+    g_return_val_if_fail (UI_SKINNED_IS_PLAYLIST (widget), FALSE);
+    g_return_val_if_fail (event != NULL, FALSE);
+
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(pl);
+
+    Playlist *playlist = playlist_get_active();
+    GList *list;
+    PangoLayout *layout;
+    gchar *title;
+    gint width, height;
+    gint i, max_first;
+    guint padding, padding_dwidth, padding_plength;
+    guint max_time_len = 0;
+    gfloat queue_tailpadding = 0;
+    gint tpadding; 
+    gsize tpadding_dwidth = 0;
+    gint x, y;
+    guint tail_width;
+    guint tail_len;
+
+    gchar tail[100];
+    gchar queuepos[255];
+    gchar length[40];
+
+    gchar **frags;
+    gchar *frag0;
+
+    gint plw_w, plw_h;
+
+    GdkPixmap *obj = NULL;
+    GdkGC *gc;
+
+    obj = gdk_pixmap_new(NULL, priv->width, priv->height, gdk_rgb_get_visual()->depth);
+    gc = gdk_gc_new(obj);
+
+    GdkRectangle *playlist_rect;
+
+    width = priv->width;
+    height = priv->height;
+
+    plw_w = playlistwin_get_width();
+    plw_h = playlistwin_get_height();
+
+    playlist_rect = g_new0(GdkRectangle, 1);
+
+    playlist_rect->x = 0;
+    playlist_rect->y = 0;
+    playlist_rect->width = plw_w - 17;
+    playlist_rect->height = plw_h - 36;
+
+    gdk_gc_set_clip_origin(gc, 31, 58);
+    gdk_gc_set_clip_rectangle(gc, playlist_rect);
+
+    gdk_gc_set_foreground(gc,
+                          skin_get_color(bmp_active_skin,
+                                         SKIN_PLEDIT_NORMALBG));
+    gdk_draw_rectangle(obj, gc, TRUE, 0, 0,
+                       width, height);
+
+    if (!playlist_list_font) {
+        g_critical("Couldn't open playlist font");
+        return FALSE;
+    }
+
+    pl->fheight = (ascent + abs(descent));
+    pl->num_visible = height / pl->fheight;
+
+    max_first = playlist_get_length(playlist) - pl->num_visible;
+    max_first = MAX(max_first, 0);
+
+    pl->first = CLAMP(pl->first, 0, max_first);
+
+    PLAYLIST_LOCK(playlist->mutex);
+    list = playlist->entries;
+    list = g_list_nth(list, pl->first);
+
+    /* It sucks having to run the iteration twice but this is the only
+       way you can reliably get the maximum width so we can get our
+       playlist nice and aligned... -- plasmaroo */
+
+    for (i = pl->first;
+         list && i < pl->first + pl->num_visible;
+         list = g_list_next(list), i++) {
+        PlaylistEntry *entry = list->data;
+
+        if (entry->length != -1)
+        {
+            g_snprintf(length, sizeof(length), "%d:%-2.2d",
+                       entry->length / 60000, (entry->length / 1000) % 60);
+            tpadding_dwidth = MAX(tpadding_dwidth, strlen(length));
+        }
+    }
+
+    /* Reset */
+    list = playlist->entries;
+    list = g_list_nth(list, pl->first);
+
+    for (i = pl->first;
+         list && i < pl->first + pl->num_visible;
+         list = g_list_next(list), i++) {
+        gint pos;
+        PlaylistEntry *entry = list->data;
+
+        if (entry->selected) {
+            gdk_gc_set_foreground(gc,
+                                  skin_get_color(bmp_active_skin,
+                                                 SKIN_PLEDIT_SELECTEDBG));
+            gdk_draw_rectangle(obj, gc, TRUE, 0,
+                               ((i - pl->first) * pl->fheight),
+                               width, pl->fheight);
+        }
+
+        /* FIXME: entry->title should NEVER be NULL, and there should
+           NEVER be a need to do a UTF-8 conversion. Playlist title
+           strings should be kept properly. */
+
+        if (!entry->title) {
+            gchar *realfn = g_filename_from_uri(entry->filename, NULL, NULL);
+            gchar *basename = g_path_get_basename(realfn ? realfn : entry->filename);
+            title = filename_to_utf8(basename);
+            g_free(basename); g_free(realfn);
+        }
+        else
+            title = str_to_utf8(entry->title);
+
+        title = convert_title_text(title);
+
+        pos = playlist_get_queue_position(playlist, entry);
+
+        tail[0] = 0;
+        queuepos[0] = 0;
+        length[0] = 0;
+
+        if (pos != -1)
+            g_snprintf(queuepos, sizeof(queuepos), "%d", pos + 1);
+
+        if (entry->length != -1)
+        {
+            g_snprintf(length, sizeof(length), "%d:%-2.2d",
+                       entry->length / 60000, (entry->length / 1000) % 60);
+        }
+
+        strncat(tail, length, sizeof(tail) - 1);
+        tail_len = strlen(tail);
+
+        max_time_len = MAX(max_time_len, tail_len);
+
+        if (pos != -1 && tpadding_dwidth <= 0)
+            tail_width = width - (width_approx_digits * (strlen(queuepos) + 2.25));
+        else if (pos != -1)
+            tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4));
+        else if (tpadding_dwidth > 0)
+            tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5));
+        else
+            tail_width = width;
+
+        if (i == playlist_get_position_nolock(playlist))
+            gdk_gc_set_foreground(gc,
+                                  skin_get_color(bmp_active_skin,
+                                                 SKIN_PLEDIT_CURRENT));
+        else
+            gdk_gc_set_foreground(gc,
+                                  skin_get_color(bmp_active_skin,
+                                                 SKIN_PLEDIT_NORMAL));
+        playlist_list_draw_string(obj, gc, pl, playlist_list_font,
+                                  i - pl->first, tail_width, title,
+                                  i + 1);
+
+        x = width - width_approx_digits * 2;
+        y = ((i - pl->first) - 1) * pl->fheight + ascent;
+
+        frags = NULL;
+        frag0 = NULL;
+
+        if ((strlen(tail) > 0) && (tail != NULL)) {
+            frags = g_strsplit(tail, ":", 0);
+            frag0 = g_strconcat(frags[0], ":", NULL);
+
+            layout = gtk_widget_create_pango_layout(playlistwin, frags[1]);
+            pango_layout_set_font_description(layout, playlist_list_font);
+            pango_layout_set_width(layout, tail_len * 100);
+            pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
+            gdk_draw_layout(obj, gc, x - (0.5 * width_approx_digits),
+                            y + abs(descent), layout);
+            g_object_unref(layout);
+
+            layout = gtk_widget_create_pango_layout(playlistwin, frag0);
+            pango_layout_set_font_description(layout, playlist_list_font);
+            pango_layout_set_width(layout, tail_len * 100);
+            pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT);
+            gdk_draw_layout(obj, gc, x - (0.75 * width_approx_digits),
+                            y + abs(descent), layout);
+            g_object_unref(layout);
+
+            g_free(frag0);
+            g_strfreev(frags);
+        }
+
+        if (pos != -1) {
+
+            /* DON'T remove the commented code yet please     -- Milosz */
+
+            if (tpadding_dwidth > 0)
+                queue_tailpadding = tpadding_dwidth + 1;
+            else
+                queue_tailpadding = -0.75;
+
+            gdk_draw_rectangle(obj, gc, FALSE,
+                               x -
+                               (((queue_tailpadding +
+                                  strlen(queuepos)) *
+                                 width_approx_digits) +
+                                (width_approx_digits / 4)),
+                               y + abs(descent),
+                               (strlen(queuepos)) *
+                               width_approx_digits +
+                               (width_approx_digits / 2),
+                               pl->fheight - 2);
+
+            layout =
+                gtk_widget_create_pango_layout(playlistwin, queuepos);
+            pango_layout_set_font_description(layout, playlist_list_font);
+            pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
+
+            gdk_draw_layout(obj, gc,
+                            x -
+                            ((queue_tailpadding +
+                              strlen(queuepos)) * width_approx_digits) +
+                            (width_approx_digits / 4),
+                            y + abs(descent), layout);
+            g_object_unref(layout);
+        }
+
+        g_free(title);
+    }
+
+
+    /*
+     * Drop target hovering over the playlist, so draw some hint where the
+     * drop will occur.
+     *
+     * This is (currently? unfixably?) broken when dragging files from Qt/KDE apps,
+     * probably due to DnD signaling problems (actually i have no clue).
+     *
+     */
+
+    if (pl->drag_motion) {
+        guint pos, plength, lpadding;
+	gint x, y, plx, ply;
+
+        if (cfg.show_numbers_in_pl) {
+            lpadding = gint_count_digits(playlist_get_length(playlist)) + 1;
+            lpadding = ((lpadding + 1) * width_approx_digits);
+        }
+        else {
+            lpadding = 3;
+        };
+
+        /* We already hold the mutex and have the playlist locked, so call
+           the non-locking function. */
+        plength = playlist_get_length(playlist);
+
+        x = pl->drag_motion_x;
+        y = pl->drag_motion_y;
+
+        plx = pl->x;
+        ply = pl->y;
+
+        if ((x > pl->x) && !(x > priv->width)) {
+
+            if ((y > pl->y)
+                && !(y > (priv->height + ply))) {
+
+                pos = ((y - ((Widget *) pl)->y) / pl->fheight) +
+                    pl->first;
+
+                if (pos > (plength)) {
+                    pos = plength;
+                }
+
+                gdk_gc_set_foreground(gc,
+                                      skin_get_color(bmp_active_skin,
+                                                     SKIN_PLEDIT_CURRENT));
+
+                gdk_draw_line(obj, gc, 0,
+			      ((pos - pl->first) * pl->fheight),
+                              priv->width - 1,
+                              ((pos - pl->first) * pl->fheight));
+            }
+
+        }
+
+        /* When dropping on the borders of the playlist, outside the text area,
+         * files get appended at the end of the list. Show that too.
+         */
+
+        if ((y < ply) || (y > priv->height + ply)) {
+            if ((y >= 0) || (y <= (priv->height + ply))) {
+                pos = plength;
+                gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_PLEDIT_CURRENT));
+
+                gdk_draw_line(obj, gc, 0, ((pos - pl->first) * pl->fheight),
+                              priv->width - 1, ((pos - pl->first) * pl->fheight));
+
+            }
+        }
+    }
+
+    gdk_gc_set_foreground(gc, skin_get_color(bmp_active_skin, SKIN_PLEDIT_NORMAL));
+
+    if (cfg.show_numbers_in_pl)
+    {
+        padding_plength = playlist_get_length(playlist);
+
+        if (padding_plength == 0) {
+            padding_dwidth = 0;
+        }
+        else {
+            padding_dwidth = gint_count_digits(playlist_get_length(playlist));
+        }
+
+        padding =
+            (padding_dwidth *
+             width_approx_digits) + width_approx_digits;
+
+
+        /* For italic or oblique fonts we add another half of the
+         * approximate width */
+        if (has_slant)
+            padding += width_approx_digits_half;
+
+        if (cfg.show_separator_in_pl) {
+            gdk_draw_line(obj, gc, padding, 0, padding, priv->height - 1);
+        }
+    }
+
+    if (tpadding_dwidth != 0)
+    {
+        tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5);
+
+        if (has_slant)
+            tpadding += width_approx_digits_half;
+
+        if (cfg.show_separator_in_pl) {
+            gdk_draw_line(obj, gc, priv->width - tpadding, 0, priv->width - tpadding, priv->height - 1);
+        }
+    }
+
+    gdk_gc_set_clip_origin(gc, 0, 0);
+    gdk_gc_set_clip_rectangle(gc, NULL);
+
+    PLAYLIST_UNLOCK(playlist->mutex);
+
+    gdk_draw_drawable(widget->window, gc, obj, 0, 0, 0, 0, priv->width, priv->height);
+
+    g_object_unref(obj);
+    g_object_unref(gc);
+    g_free(playlist_rect);
+
+    return FALSE;
+}
+
+gint ui_skinned_playlist_get_position(GtkWidget *widget, gint x, gint y) {
+    gint iy, length;
+    gint ret;
+    Playlist *playlist = playlist_get_active();
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
+
+    if (!pl->fheight)
+        return -1;
+
+    if ((length = playlist_get_length(playlist)) == 0)
+        return -1;
+    iy = y;
+
+    ret = (iy / pl->fheight) + pl->first;
+
+    if (ret > length - 1)
+        ret = -1;
+
+    return ret;
+}
+
+static gboolean ui_skinned_playlist_button_press(GtkWidget *widget, GdkEventButton *event) {
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST (widget);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
+
+    if (event->button == 3) {
+        ui_manager_popup_menu_show(GTK_MENU(playlistwin_popup_menu),
+                                   event->x_root, event->y_root + 5,
+                                   event->button, event->time);
+    }
+    gint nr;
+    Playlist *playlist = playlist_get_active();
+
+    nr = ui_skinned_playlist_get_position(widget, event->x, event->y);
+    if (nr == -1)
+        return FALSE;
+
+    if (event->button == 3) {
+        GList* selection = playlist_get_selected(playlist);
+        if (g_list_find(selection, GINT_TO_POINTER(nr)) == NULL) {
+            playlist_select_all(playlist, FALSE);
+            playlist_select_range(playlist, nr, nr, TRUE);
+        }
+    } else if (event->button == 1) {
+        if (!(event->state & GDK_CONTROL_MASK))
+            playlist_select_all(playlist, FALSE);
+
+        if (event->state & GDK_SHIFT_MASK && pl->prev_selected != -1) {
+            playlist_select_range(playlist, pl->prev_selected, nr, TRUE);
+            pl->prev_min = pl->prev_selected;
+            pl->prev_max = nr;
+            priv->drag_pos = nr - pl->first;
+        }
+        else {
+            if (playlist_select_invert(playlist, nr)) {
+                if (event->state & GDK_CONTROL_MASK) {
+                    if (pl->prev_min == -1) {
+                        pl->prev_min = pl->prev_selected;
+                        pl->prev_max = pl->prev_selected;
+                    }
+                    if (nr < pl->prev_min)
+                        pl->prev_min = nr;
+                    else if (nr > pl->prev_max)
+                        pl->prev_max = nr;
+                }
+                else
+                    pl->prev_min = -1;
+                pl->prev_selected = nr;
+                priv->drag_pos = nr - pl->first;
+            }
+        }
+        if (event->type == GDK_2BUTTON_PRESS) {
+            /*
+             * Ungrab the pointer to prevent us from
+             * hanging on to it during the sometimes slow
+             * playback_initiate().
+             */
+            gdk_pointer_ungrab(GDK_CURRENT_TIME);
+            playlist_set_position(playlist, nr);
+            if (!playback_get_playing())
+                playback_initiate();
+        }
+
+        priv->dragging = TRUE;
+    }
+    playlistwin_update_list(playlist);
+
+    return TRUE;
+}
+
+static gboolean ui_skinned_playlist_button_release(GtkWidget *widget, GdkEventButton *event) {
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
+
+    if (event->button == 1) {
+        priv->dragging = FALSE;
+        priv->auto_drag_down = FALSE;
+        priv->auto_drag_up = FALSE;
+        gtk_widget_queue_draw(widget);
+    }
+    return TRUE;
+}
+
+static gboolean ui_skinned_playlist_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
+    UiSkinnedPlaylist *pl = UI_SKINNED_PLAYLIST(widget);
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
+
+    gint nr, y, off, i;
+    if (priv->dragging) {
+        y = event->y;
+        nr = (y / pl->fheight);
+        if (nr < 0) {
+            nr = 0;
+            if (!priv->auto_drag_up) {
+                priv->auto_drag_up = TRUE;
+                priv->auto_drag_up_tag =
+                    g_timeout_add(100, ui_skinned_playlist_auto_drag_up_func, pl);
+            }
+        }
+        else if (priv->auto_drag_up)
+            priv->auto_drag_up = FALSE;
+
+        if (nr >= pl->num_visible) {
+            nr = pl->num_visible - 1;
+            if (!priv->auto_drag_down) {
+                priv->auto_drag_down = TRUE;
+                priv->auto_drag_down_tag =
+                    g_timeout_add(100, ui_skinned_playlist_auto_drag_down_func, pl);
+            }
+        }
+        else if (priv->auto_drag_down)
+            priv->auto_drag_down = FALSE;
+
+        off = nr - priv->drag_pos;
+        if (off) {
+            for (i = 0; i < abs(off); i++) {
+                if (off < 0)
+                    ui_skinned_playlist_move_up(pl);
+                else
+                    ui_skinned_playlist_move_down(pl);
+
+            }
+            playlistwin_update_list(playlist_get_active());
+        }
+        priv->drag_pos = nr;
+    }
+    return TRUE;
+}
+
+static void ui_skinned_playlist_redraw(UiSkinnedPlaylist *playlist) {
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(playlist);
+
+    if (priv->resize_height || priv->resize_width)
+        gtk_widget_set_size_request(GTK_WIDGET(playlist), priv->width+priv->resize_width, priv->height+priv->resize_height);
+
+    gtk_widget_queue_draw(GTK_WIDGET(playlist));
+}
+
+void ui_skinned_playlist_set_font(const gchar * font) {
+    /* Welcome to bad hack central 2k3 */
+    gchar *font_lower;
+    gint width_temp;
+    gint width_temp_0;
+
+    playlist_list_font = pango_font_description_from_string(font);
+
+    text_get_extents(font,
+                     "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ",
+                     &width_approx_letters, NULL, &ascent, &descent);
+
+    width_approx_letters = (width_approx_letters / 53);
+
+    /* Experimental: We don't weigh the 1 into total because it's width is almost always
+     * very different from the rest
+     */
+    text_get_extents(font, "023456789", &width_approx_digits, NULL, NULL,
+                     NULL);
+    width_approx_digits = (width_approx_digits / 9);
+
+    /* Precache some often used calculations */
+    width_approx_digits_half = width_approx_digits / 2;
+
+    /* FIXME: We assume that any other number is broader than the "1" */
+    text_get_extents(font, "1", &width_temp, NULL, NULL, NULL);
+    text_get_extents(font, "2", &width_temp_0, NULL, NULL, NULL);
+
+    if (abs(width_temp_0 - width_temp) < 2) {
+        width_delta_digit_one = 0;
+    }
+    else {
+        width_delta_digit_one = ((width_temp_0 - width_temp) / 2) + 2;
+    }
+
+    text_get_extents(font, ":", &width_colon, NULL, NULL, NULL);
+    width_colon_third = width_colon / 4;
+
+    font_lower = g_utf8_strdown(font, strlen(font));
+    /* This doesn't take any i18n into account, but i think there is none with TTF fonts
+     * FIXME: This can probably be retrieved trough Pango too
+     */
+    has_slant = g_strstr_len(font_lower, strlen(font_lower), "oblique")
+        || g_strstr_len(font_lower, strlen(font_lower), "italic");
+
+    g_free(font_lower);
+}
+
+void ui_skinned_playlist_resize_relative(GtkWidget *widget, gint w, gint h) {
+    UiSkinnedPlaylistPrivate *priv = UI_SKINNED_PLAYLIST_GET_PRIVATE(widget);
+    priv->resize_width += w;
+    priv->resize_height += h;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_skinned_playlist.h	Thu Aug 02 14:14:32 2007 +0200
@@ -0,0 +1,71 @@
+/*
+ * Audacious - a cross-platform multimedia player
+ * Copyright (c) 2007  Audacious development team.
+ *
+ * Based on:
+ * BMP - Cross-platform multimedia player
+ * Copyright (C) 2003-2004  BMP development team.
+ * 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 <http://www.gnu.org/licenses>.
+ *
+ * The Audacious team does not consider modular code linking to
+ * Audacious or using our public API to be a derived work.
+ */
+
+#ifndef UISKINNEDPLAYLIST_H
+#define UISKINNEDPLAYLIST_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define UI_SKINNED_PLAYLIST(obj)          GTK_CHECK_CAST (obj, ui_skinned_playlist_get_type (), UiSkinnedPlaylist)
+#define UI_SKINNED_PLAYLIST_CLASS(klass)  GTK_CHECK_CLASS_CAST (klass, ui_skinned_playlist_get_type (), UiSkinnedPlaylistClass)
+#define UI_SKINNED_IS_PLAYLIST(obj)       GTK_CHECK_TYPE (obj, ui_skinned_playlist_get_type ())
+
+typedef struct _UiSkinnedPlaylist        UiSkinnedPlaylist;
+typedef struct _UiSkinnedPlaylistClass   UiSkinnedPlaylistClass;
+
+struct _UiSkinnedPlaylist {
+    GtkWidget   widget;
+    gboolean    pressed;
+    gint        x, y;
+    gint        first;
+    gint        num_visible;
+    gint        prev_selected, prev_min, prev_max;
+    gboolean    tooltips;
+    gboolean    drag_motion;
+    gint        drag_motion_x, drag_motion_y;
+    gint        fheight;
+};
+
+struct _UiSkinnedPlaylistClass {
+    GtkWidgetClass    parent_class;
+    void (* redraw)   (UiSkinnedPlaylist *playlist);
+};
+
+GtkWidget* ui_skinned_playlist_new(GtkWidget *fixed, gint x, gint y, gint w, gint h);
+GtkType ui_skinned_playlist_get_type(void);
+void ui_skinned_playlist_resize_relative(GtkWidget *widget, gint w, gint h);
+void ui_skinned_playlist_set_font(const gchar * font);
+void ui_skinned_playlist_move_up(UiSkinnedPlaylist *pl);
+void ui_skinned_playlist_move_down(UiSkinnedPlaylist *pl);
+gint ui_skinned_playlist_get_position(GtkWidget *widget, gint x, gint y);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- a/src/audacious/widgets/Makefile	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/widgets/Makefile	Thu Aug 02 14:14:32 2007 +0200
@@ -20,7 +20,6 @@
 
 SOURCES = \
 	widget.c \
-	playlist_list.c \
 	skin.c
 
 OBJECTS = ${SOURCES:.c=.o}
--- a/src/audacious/widgets/playlist_list.c	Thu Aug 02 02:03:35 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,834 +0,0 @@
-/*  Audacious - Cross-platform multimedia player
- *  Copyright (C) 2005-2006  Audacious development team.
- *
- *  BMP - Cross-platform multimedia player
- *  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 <http://www.gnu.org/licenses>.
- *
- *  The Audacious team does not consider modular code linking to
- *  Audacious or using our public API to be a derived work.
- */
-
-/*
- *  A note about Pango and some funky spacey fonts: Weirdly baselined
- *  fonts, or fonts with weird ascents or descents _will_ display a
- *  little bit weird in the playlist widget, but the display engine
- *  won't make it look too bad, just a little deranged.  I honestly
- *  don't think it's worth fixing (around...), it doesn't have to be
- *  perfectly fitting, just the general look has to be ok, which it
- *  IMHO is.
- *
- *  A second note: The numbers aren't perfectly aligned, but in the
- *  end it looks better when using a single Pango layout for each
- *  number.
- */
-
-#include "widgetcore.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "main.h"
-#include "input.h"
-#include "strings.h"
-#include "playback.h"
-#include "playlist.h"
-#include "ui_playlist.h"
-#include "util.h"
-
-#include "debug.h"
-
-static PangoFontDescription *playlist_list_font = NULL;
-static gint ascent, descent, width_delta_digit_one;
-static gboolean has_slant;
-static guint padding;
-
-/* FIXME: the following globals should not be needed. */
-static gint width_approx_letters;
-static gint width_colon, width_colon_third;
-static gint width_approx_digits, width_approx_digits_half;
-
-void playlist_list_draw(Widget * w);
-
-static gboolean
-playlist_list_auto_drag_down_func(gpointer data)
-{
-    PlayList_List *pl = data;
-
-    if (pl->pl_auto_drag_down) {
-        playlist_list_move_down(pl);
-        pl->pl_first++;
-        playlistwin_update_list(playlist_get_active());
-        return TRUE;
-    }
-    return FALSE;
-}
-
-static gboolean
-playlist_list_auto_drag_up_func(gpointer data)
-{
-    PlayList_List *pl = data;
-
-    if (pl->pl_auto_drag_up) {
-        playlist_list_move_up(pl);
-        pl->pl_first--;
-        playlistwin_update_list(playlist_get_active());
-        return TRUE;
-
-    }
-    return FALSE;
-}
-
-void
-playlist_list_move_up(PlayList_List * pl)
-{
-    GList *list;
-    Playlist *playlist = playlist_get_active();
-
-    if (!playlist)
-        return;
-
-    PLAYLIST_LOCK(playlist->mutex);
-    if ((list = playlist->entries) == NULL) {
-        PLAYLIST_UNLOCK(playlist->mutex);
-        return;
-    }
-    if (PLAYLIST_ENTRY(list->data)->selected) {
-        /* We are at the top */
-        PLAYLIST_UNLOCK(playlist->mutex);
-        return;
-    }
-    while (list) {
-        if (PLAYLIST_ENTRY(list->data)->selected)
-            glist_moveup(list);
-        list = g_list_next(list);
-    }
-    PLAYLIST_UNLOCK(playlist->mutex);
-    if (pl->pl_prev_selected != -1)
-        pl->pl_prev_selected--;
-    if (pl->pl_prev_min != -1)
-        pl->pl_prev_min--;
-    if (pl->pl_prev_max != -1)
-        pl->pl_prev_max--;
-}
-
-void
-playlist_list_move_down(PlayList_List * pl)
-{
-    GList *list;
-    Playlist *playlist = playlist_get_active();
-
-    if (!playlist)
-        return;
-
-    PLAYLIST_LOCK(playlist->mutex);
-
-    if (!(list = g_list_last(playlist->entries))) {
-        PLAYLIST_UNLOCK(playlist->mutex);
-        return;
-    }
-
-    if (PLAYLIST_ENTRY(list->data)->selected) {
-        /* We are at the bottom */
-        PLAYLIST_UNLOCK(playlist->mutex);
-        return;
-    }
-
-    while (list) {
-        if (PLAYLIST_ENTRY(list->data)->selected)
-            glist_movedown(list);
-        list = g_list_previous(list);
-    }
-
-    PLAYLIST_UNLOCK(playlist->mutex);
-
-    if (pl->pl_prev_selected != -1)
-        pl->pl_prev_selected++;
-    if (pl->pl_prev_min != -1)
-        pl->pl_prev_min++;
-    if (pl->pl_prev_max != -1)
-        pl->pl_prev_max++;
-}
-
-static void
-playlist_list_button_press_cb(GtkWidget * widget,
-                              GdkEventButton * event,
-                              PlayList_List * pl)
-{
-    gint nr;
-    Playlist *playlist = playlist_get_active();
-
-	nr = playlist_list_get_playlist_position(pl, event->x, event->y);
-	if (nr == -1)
-		return;
-
-	if (event->button == 3)
-	{
-		GList* selection = playlist_get_selected(playlist);
-		if (g_list_find(selection, GINT_TO_POINTER(nr)) == NULL)
-		{
-			playlist_select_all(playlist, FALSE);
-			playlist_select_range(playlist, nr, nr, TRUE);
-		}
-	}
-	else if (event->button == 1)
-	{
-        if (!(event->state & GDK_CONTROL_MASK))
-            playlist_select_all(playlist, FALSE);
-
-        if (event->state & GDK_SHIFT_MASK && pl->pl_prev_selected != -1) {
-            playlist_select_range(playlist, pl->pl_prev_selected, nr, TRUE);
-            pl->pl_prev_min = pl->pl_prev_selected;
-            pl->pl_prev_max = nr;
-            pl->pl_drag_pos = nr - pl->pl_first;
-        }
-        else {
-            if (playlist_select_invert(playlist, nr)) {
-                if (event->state & GDK_CONTROL_MASK) {
-                    if (pl->pl_prev_min == -1) {
-                        pl->pl_prev_min = pl->pl_prev_selected;
-                        pl->pl_prev_max = pl->pl_prev_selected;
-                    }
-                    if (nr < pl->pl_prev_min)
-                        pl->pl_prev_min = nr;
-                    else if (nr > pl->pl_prev_max)
-                        pl->pl_prev_max = nr;
-                }
-                else
-                    pl->pl_prev_min = -1;
-                pl->pl_prev_selected = nr;
-                pl->pl_drag_pos = nr - pl->pl_first;
-            }
-        }
-        if (event->type == GDK_2BUTTON_PRESS) {
-            /*
-             * Ungrab the pointer to prevent us from
-             * hanging on to it during the sometimes slow
-             * playback_initiate().
-             */
-            gdk_pointer_ungrab(GDK_CURRENT_TIME);
-            gdk_flush();
-            playlist_set_position(playlist, nr);
-            if (!playback_get_playing())
-                playback_initiate();
-        }
-
-        pl->pl_dragging = TRUE;
-    }
-
-	playlistwin_update_list(playlist);
-}
-
-gint
-playlist_list_get_playlist_position(PlayList_List * pl,
-                                    gint x,
-                                    gint y)
-{
-    gint iy, length;
-    gint ret;
-    Playlist *playlist = playlist_get_active();
-
-    if (!widget_contains(WIDGET(pl), x, y) || !pl->pl_fheight)
-        return -1;
-
-    if ((length = playlist_get_length(playlist)) == 0)
-        return -1;
-    iy = y - pl->pl_widget.y;
-
-    ret = (iy / pl->pl_fheight) + pl->pl_first;
-
-    if (ret > length - 1)
-	    ret = -1;
-
-    return ret;
-}
-
-static void
-playlist_list_motion_cb(GtkWidget * widget,
-                        GdkEventMotion * event,
-                        PlayList_List * pl)
-{
-    gint nr, y, off, i;
-
-    if (pl->pl_dragging) {
-        y = event->y - pl->pl_widget.y;
-        nr = (y / pl->pl_fheight);
-        if (nr < 0) {
-            nr = 0;
-            if (!pl->pl_auto_drag_up) {
-                pl->pl_auto_drag_up = TRUE;
-                pl->pl_auto_drag_up_tag =
-                    g_timeout_add(100, playlist_list_auto_drag_up_func, pl);
-            }
-        }
-        else if (pl->pl_auto_drag_up)
-            pl->pl_auto_drag_up = FALSE;
-
-        if (nr >= pl->pl_num_visible) {
-            nr = pl->pl_num_visible - 1;
-            if (!pl->pl_auto_drag_down) {
-                pl->pl_auto_drag_down = TRUE;
-                pl->pl_auto_drag_down_tag =
-                    g_timeout_add(100, playlist_list_auto_drag_down_func,
-                                    pl);
-            }
-        }
-        else if (pl->pl_auto_drag_down)
-            pl->pl_auto_drag_down = FALSE;
-
-        off = nr - pl->pl_drag_pos;
-        if (off) {
-            for (i = 0; i < abs(off); i++) {
-                if (off < 0)
-                    playlist_list_move_up(pl);
-                else
-                    playlist_list_move_down(pl);
-
-            }
-            playlistwin_update_list(playlist_get_active());
-        }
-        pl->pl_drag_pos = nr;
-    }
-}
-
-static void
-playlist_list_button_release_cb(GtkWidget * widget,
-                                GdkEventButton * event,
-                                PlayList_List * pl)
-{
-    pl->pl_dragging = FALSE;
-    pl->pl_auto_drag_down = FALSE;
-    pl->pl_auto_drag_up = FALSE;
-}
-
-static void
-playlist_list_draw_string(PlayList_List * pl,
-                          PangoFontDescription * font,
-                          gint line,
-                          gint width,
-                          const gchar * text,
-                          guint ppos)
-{
-    guint plist_length_int;
-    Playlist *playlist = playlist_get_active();
-
-    PangoLayout *layout;
-
-    REQUIRE_LOCK(playlist->mutex);
-
-    if (cfg.show_numbers_in_pl) {
-        gchar *pos_string = g_strdup_printf(cfg.show_separator_in_pl == TRUE ? "%d" : "%d.", ppos);
-        plist_length_int =
-            gint_count_digits(playlist_get_length(playlist)) + !cfg.show_separator_in_pl + 1; /* cf.show_separator_in_pl will be 0 if false */
-
-        padding = plist_length_int;
-        padding = ((padding + 1) * width_approx_digits);
-
-        layout = gtk_widget_create_pango_layout(playlistwin, pos_string);
-        pango_layout_set_font_description(layout, playlist_list_font);
-        pango_layout_set_width(layout, plist_length_int * 100);
-
-        pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
-        gdk_draw_layout(pl->pl_widget.parent, pl->pl_widget.gc,
-                        pl->pl_widget.x +
-                        (width_approx_digits *
-                         (-1 + plist_length_int - strlen(pos_string))) +
-                        (width_approx_digits / 4),
-                        pl->pl_widget.y + (line - 1) * pl->pl_fheight +
-                        ascent + abs(descent), layout);
-        g_free(pos_string);
-        g_object_unref(layout);
-
-        if (!cfg.show_separator_in_pl)
-            padding -= (width_approx_digits * 1.5);
-    }
-    else {
-        padding = 3;
-    }
-
-    width -= padding;
-
-    layout = gtk_widget_create_pango_layout(playlistwin, text);
-
-    pango_layout_set_font_description(layout, playlist_list_font);
-    pango_layout_set_width(layout, width * PANGO_SCALE);
-    pango_layout_set_single_paragraph_mode(layout, TRUE);
-    pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
-    gdk_draw_layout(pl->pl_widget.parent, pl->pl_widget.gc,
-                    pl->pl_widget.x + padding + (width_approx_letters / 4),
-                    pl->pl_widget.y + (line - 1) * pl->pl_fheight +
-                    ascent + abs(descent), layout);
-
-    g_object_unref(layout);
-}
-
-void
-playlist_list_draw(Widget * w)
-{
-    Playlist *playlist = playlist_get_active();
-    PlayList_List *pl = PLAYLIST_LIST(w);
-    GList *list;
-    GdkGC *gc;
-    GdkPixmap *obj;
-    PangoLayout *layout;
-    gchar *title;
-    gint width, height;
-    gint i, max_first;
-    guint padding, padding_dwidth, padding_plength;
-    guint max_time_len = 0;
-    gfloat queue_tailpadding = 0;
-    gint tpadding; 
-    gsize tpadding_dwidth = 0;
-    gint x, y;
-    guint tail_width;
-    guint tail_len;
-
-    gchar tail[100];
-    gchar queuepos[255];
-    gchar length[40];
-
-    gchar **frags;
-    gchar *frag0;
-
-    gint plw_w, plw_h;
-
-    GdkRectangle *playlist_rect;
-
-    gc = pl->pl_widget.gc;
-
-    width = pl->pl_widget.width;
-    height = pl->pl_widget.height;
-
-    obj = pl->pl_widget.parent;
-
-    plw_w = playlistwin_get_width();
-    plw_h = playlistwin_get_height();
-
-    playlist_rect = g_new0(GdkRectangle, 1);
-
-    playlist_rect->x = 0;
-    playlist_rect->y = 0;
-    playlist_rect->width = plw_w - 17;
-    playlist_rect->height = plw_h - 36;
-
-    gdk_gc_set_clip_origin(gc, 31, 58);
-    gdk_gc_set_clip_rectangle(gc, playlist_rect);
-
-    gdk_gc_set_foreground(gc,
-                          skin_get_color(bmp_active_skin,
-                                         SKIN_PLEDIT_NORMALBG));
-    gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x, pl->pl_widget.y,
-                       width, height);
-
-    if (!playlist_list_font) {
-        g_critical("Couldn't open playlist font");
-        return;
-    }
-
-    pl->pl_fheight = (ascent + abs(descent));
-    pl->pl_num_visible = height / pl->pl_fheight;
-
-    max_first = playlist_get_length(playlist) - pl->pl_num_visible;
-    max_first = MAX(max_first, 0);
-
-    pl->pl_first = CLAMP(pl->pl_first, 0, max_first);
-
-    PLAYLIST_LOCK(playlist->mutex);
-    list = playlist->entries;
-    list = g_list_nth(list, pl->pl_first);
-
-    /* It sucks having to run the iteration twice but this is the only
-       way you can reliably get the maximum width so we can get our
-       playlist nice and aligned... -- plasmaroo */
-
-    for (i = pl->pl_first;
-         list && i < pl->pl_first + pl->pl_num_visible;
-         list = g_list_next(list), i++) {
-        PlaylistEntry *entry = list->data;
-
-        if (entry->length != -1)
-        {
-            g_snprintf(length, sizeof(length), "%d:%-2.2d",
-                       entry->length / 60000, (entry->length / 1000) % 60);
-            tpadding_dwidth = MAX(tpadding_dwidth, strlen(length));
-        }
-    }
-
-    /* Reset */
-    list = playlist->entries;
-    list = g_list_nth(list, pl->pl_first);
-
-    for (i = pl->pl_first;
-         list && i < pl->pl_first + pl->pl_num_visible;
-         list = g_list_next(list), i++) {
-        gint pos;
-        PlaylistEntry *entry = list->data;
-
-        if (entry->selected) {
-            gdk_gc_set_foreground(gc,
-                                  skin_get_color(bmp_active_skin,
-                                                 SKIN_PLEDIT_SELECTEDBG));
-            gdk_draw_rectangle(obj, gc, TRUE, pl->pl_widget.x,
-                               pl->pl_widget.y +
-                               ((i - pl->pl_first) * pl->pl_fheight),
-                               width, pl->pl_fheight);
-        }
-
-        /* FIXME: entry->title should NEVER be NULL, and there should
-           NEVER be a need to do a UTF-8 conversion. Playlist title
-           strings should be kept properly. */
-
-        if (!entry->title) {
-            gchar *realfn = g_filename_from_uri(entry->filename, NULL, NULL);
-            gchar *basename = g_path_get_basename(realfn ? realfn : entry->filename);
-            title = filename_to_utf8(basename);
-            g_free(basename); g_free(realfn);
-        }
-        else
-            title = str_to_utf8(entry->title);
-
-        title = convert_title_text(title);
-
-        pos = playlist_get_queue_position(playlist, entry);
-
-        tail[0] = 0;
-        queuepos[0] = 0;
-        length[0] = 0;
-
-        if (pos != -1)
-            g_snprintf(queuepos, sizeof(queuepos), "%d", pos + 1);
-
-        if (entry->length != -1)
-        {
-            g_snprintf(length, sizeof(length), "%d:%-2.2d",
-                       entry->length / 60000, (entry->length / 1000) % 60);
-        }
-
-        strncat(tail, length, sizeof(tail) - 1);
-        tail_len = strlen(tail);
-
-        max_time_len = MAX(max_time_len, tail_len);
-
-        if (pos != -1 && tpadding_dwidth <= 0)
-            tail_width = width - (width_approx_digits * (strlen(queuepos) + 2.25));
-        else if (pos != -1)
-            tail_width = width - (width_approx_digits * (tpadding_dwidth + strlen(queuepos) + 4));
-        else if (tpadding_dwidth > 0)
-            tail_width = width - (width_approx_digits * (tpadding_dwidth + 2.5));
-        else
-            tail_width = width;
-
-        if (i == playlist_get_position_nolock(playlist))
-            gdk_gc_set_foreground(gc,
-                                  skin_get_color(bmp_active_skin,
-                                                 SKIN_PLEDIT_CURRENT));
-        else
-            gdk_gc_set_foreground(gc,
-                                  skin_get_color(bmp_active_skin,
-                                                 SKIN_PLEDIT_NORMAL));
-        playlist_list_draw_string(pl, playlist_list_font,
-                                  i - pl->pl_first, tail_width, title,
-                                  i + 1);
-
-        x = pl->pl_widget.x + width - width_approx_digits * 2;
-        y = pl->pl_widget.y + ((i - pl->pl_first) -
-                               1) * pl->pl_fheight + ascent;
-
-        frags = NULL;
-        frag0 = NULL;
-
-        if ((strlen(tail) > 0) && (tail != NULL)) {
-            frags = g_strsplit(tail, ":", 0);
-            frag0 = g_strconcat(frags[0], ":", NULL);
-
-            layout = gtk_widget_create_pango_layout(playlistwin, frags[1]);
-            pango_layout_set_font_description(layout, playlist_list_font);
-            pango_layout_set_width(layout, tail_len * 100);
-            pango_layout_set_alignment(layout, PANGO_ALIGN_LEFT);
-            gdk_draw_layout(obj, gc, x - (0.5 * width_approx_digits),
-                            y + abs(descent), layout);
-            g_object_unref(layout);
-
-            layout = gtk_widget_create_pango_layout(playlistwin, frag0);
-            pango_layout_set_font_description(layout, playlist_list_font);
-            pango_layout_set_width(layout, tail_len * 100);
-            pango_layout_set_alignment(layout, PANGO_ALIGN_RIGHT);
-            gdk_draw_layout(obj, gc, x - (0.75 * width_approx_digits),
-                            y + abs(descent), layout);
-            g_object_unref(layout);
-
-            g_free(frag0);
-            g_strfreev(frags);
-        }
-
-        if (pos != -1) {
-
-            /* DON'T remove the commented code yet please     -- Milosz */
-
-            if (tpadding_dwidth > 0)
-                queue_tailpadding = tpadding_dwidth + 1;
-            else
-                queue_tailpadding = -0.75;
-
-            gdk_draw_rectangle(obj, gc, FALSE,
-                               x -
-                               (((queue_tailpadding +
-                                  strlen(queuepos)) *
-                                 width_approx_digits) +
-                                (width_approx_digits / 4)),
-                               y + abs(descent),
-                               (strlen(queuepos)) *
-                               width_approx_digits +
-                               (width_approx_digits / 2),
-                               pl->pl_fheight - 2);
-
-            layout =
-                gtk_widget_create_pango_layout(playlistwin, queuepos);
-            pango_layout_set_font_description(layout, playlist_list_font);
-            pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
-
-            gdk_draw_layout(obj, gc,
-                            x -
-                            ((queue_tailpadding +
-                              strlen(queuepos)) * width_approx_digits) +
-                            (width_approx_digits / 4),
-                            y + abs(descent), layout);
-            g_object_unref(layout);
-        }
-
-        g_free(title);
-    }
-
-
-    /*
-     * Drop target hovering over the playlist, so draw some hint where the
-     * drop will occur.
-     *
-     * This is (currently? unfixably?) broken when dragging files from Qt/KDE apps,
-     * probably due to DnD signaling problems (actually i have no clue).
-     *
-     */
-
-    if (pl->pl_drag_motion) {
-        guint pos, plength, lpadding;
-	gint x, y, plx, ply;
-
-        if (cfg.show_numbers_in_pl) {
-            lpadding = gint_count_digits(playlist_get_length(playlist)) + 1;
-            lpadding = ((lpadding + 1) * width_approx_digits);
-        }
-        else {
-            lpadding = 3;
-        };
-
-        /* We already hold the mutex and have the playlist locked, so call
-           the non-locking function. */
-        plength = playlist_get_length(playlist);
-
-        x = pl->drag_motion_x;
-        y = pl->drag_motion_y;
-
-        plx = pl->pl_widget.x;
-        ply = pl->pl_widget.y;
-
-        if ((x > pl->pl_widget.x) && !(x > pl->pl_widget.width)) {
-
-            if ((y > pl->pl_widget.y)
-                && !(y > (pl->pl_widget.height + ply))) {
-
-                pos = ((y - ((Widget *) pl)->y) / pl->pl_fheight) +
-                    pl->pl_first;
-
-                if (pos > (plength)) {
-                    pos = plength;
-                }
-
-                gdk_gc_set_foreground(gc,
-                                      skin_get_color(bmp_active_skin,
-                                                     SKIN_PLEDIT_CURRENT));
-
-                gdk_draw_line(obj, gc, pl->pl_widget.x,
-			      pl->pl_widget.y + ((pos - pl->pl_first) * pl->pl_fheight),
-                              pl->pl_widget.width + pl->pl_widget.x - 1,
-                              pl->pl_widget.y +
-                              ((pos - pl->pl_first) * pl->pl_fheight));
-            }
-
-        }
-
-        /* When dropping on the borders of the playlist, outside the text area,
-         * files get appended at the end of the list. Show that too.
-         */
-
-        if ((y < ply) || (y > pl->pl_widget.height + ply)) {
-            if ((y >= 0) || (y <= (pl->pl_widget.height + ply))) {
-                pos = plength;
-                gdk_gc_set_foreground(gc,
-                                      skin_get_color(bmp_active_skin,
-                                                     SKIN_PLEDIT_CURRENT));
-
-                gdk_draw_line(obj, gc, pl->pl_widget.x,
-                              pl->pl_widget.y +
-                              ((pos - pl->pl_first) * pl->pl_fheight),
-                              pl->pl_widget.width + pl->pl_widget.x - 1,
-                              pl->pl_widget.y +
-                              ((pos - pl->pl_first) * pl->pl_fheight));
-
-            }
-        }
-    }
-
-    gdk_gc_set_foreground(gc,
-                          skin_get_color(bmp_active_skin,
-                                         SKIN_PLEDIT_NORMAL));
-
-    if (cfg.show_numbers_in_pl)
-    {
-        padding_plength = playlist_get_length(playlist);
-
-        if (padding_plength == 0) {
-            padding_dwidth = 0;
-        }
-        else {
-            padding_dwidth = gint_count_digits(playlist_get_length(playlist));
-        }
-
-        padding =
-            (padding_dwidth *
-             width_approx_digits) + width_approx_digits;
-
-
-        /* For italic or oblique fonts we add another half of the
-         * approximate width */
-        if (has_slant)
-            padding += width_approx_digits_half;
-
-        if (cfg.show_separator_in_pl) {
-            gdk_draw_line(obj, gc,
-                          pl->pl_widget.x + padding,
-                          pl->pl_widget.y,
-                          pl->pl_widget.x + padding,
-                          pl->pl_widget.y + pl->pl_widget.height - 1);
-        }
-    }
-
-    if (tpadding_dwidth != 0)
-    {
-        tpadding = (tpadding_dwidth * width_approx_digits) + (width_approx_digits * 1.5);
-
-        if (has_slant)
-            tpadding += width_approx_digits_half;
-
-        if (cfg.show_separator_in_pl) {
-            gdk_draw_line(obj, gc,
-                          pl->pl_widget.x + pl->pl_widget.width - tpadding,
-                          pl->pl_widget.y,
-                          pl->pl_widget.x + pl->pl_widget.width - tpadding,
-                          pl->pl_widget.y + pl->pl_widget.height - 1);
-        }
-    }
-
-    gdk_gc_set_clip_origin(gc, 0, 0);
-    gdk_gc_set_clip_rectangle(gc, NULL);
-
-    PLAYLIST_UNLOCK(playlist->mutex);
-
-    gdk_flush();
-
-    g_free(playlist_rect);
-}
-
-
-PlayList_List *
-create_playlist_list(GList ** wlist,
-                     GdkPixmap * parent,
-                     GdkGC * gc,
-                     gint x, gint y,
-                     gint w, gint h)
-{
-    PlayList_List *pl;
-
-    pl = g_new0(PlayList_List, 1);
-    widget_init(&pl->pl_widget, parent, gc, x, y, w, h, TRUE);
-
-    pl->pl_widget.button_press_cb =
-        (WidgetButtonPressFunc) playlist_list_button_press_cb;
-    pl->pl_widget.button_release_cb =
-        (WidgetButtonReleaseFunc) playlist_list_button_release_cb;
-    pl->pl_widget.motion_cb = (WidgetMotionFunc) playlist_list_motion_cb;
-    pl->pl_widget.draw = playlist_list_draw;
-
-    pl->pl_prev_selected = -1;
-    pl->pl_prev_min = -1;
-    pl->pl_prev_max = -1;
-
-    widget_list_add(wlist, WIDGET(pl));
-
-    return pl;
-}
-
-void
-playlist_list_set_font(const gchar * font)
-{
-
-    /* Welcome to bad hack central 2k3 */
-
-    gchar *font_lower;
-    gint width_temp;
-    gint width_temp_0;
-
-    playlist_list_font = pango_font_description_from_string(font);
-
-    text_get_extents(font,
-                     "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ",
-                     &width_approx_letters, NULL, &ascent, &descent);
-
-    width_approx_letters = (width_approx_letters / 53);
-
-    /* Experimental: We don't weigh the 1 into total because it's width is almost always
-     * very different from the rest
-     */
-    text_get_extents(font, "023456789", &width_approx_digits, NULL, NULL,
-                     NULL);
-    width_approx_digits = (width_approx_digits / 9);
-
-    /* Precache some often used calculations */
-    width_approx_digits_half = width_approx_digits / 2;
-
-    /* FIXME: We assume that any other number is broader than the "1" */
-    text_get_extents(font, "1", &width_temp, NULL, NULL, NULL);
-    text_get_extents(font, "2", &width_temp_0, NULL, NULL, NULL);
-
-    if (abs(width_temp_0 - width_temp) < 2) {
-        width_delta_digit_one = 0;
-    }
-    else {
-        width_delta_digit_one = ((width_temp_0 - width_temp) / 2) + 2;
-    }
-
-    text_get_extents(font, ":", &width_colon, NULL, NULL, NULL);
-    width_colon_third = width_colon / 4;
-
-    font_lower = g_utf8_strdown(font, strlen(font));
-    /* This doesn't take any i18n into account, but i think there is none with TTF fonts
-     * FIXME: This can probably be retrieved trough Pango too
-     */
-    has_slant = g_strstr_len(font_lower, strlen(font_lower), "oblique")
-        || g_strstr_len(font_lower, strlen(font_lower), "italic");
-
-    g_free(font_lower);
-}
--- a/src/audacious/widgets/playlist_list.h	Thu Aug 02 02:03:35 2007 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*  Audacious
- *  Copyright (C) 2005-2007  Audacious development team.
- *
- *  BMP - Cross-platform multimedia player
- *  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 <http://www.gnu.org/licenses>.
- *
- *  The Audacious team does not consider modular code linking to
- *  Audacious or using our public API to be a derived work.
- */
-
-#ifndef _WIDGETCORE_H_
-#error Please do not include me directly! Use widgetcore.h instead!
-#endif
-
-#ifndef PLAYLIST_LIST_H
-#define PLAYLIST_LIST_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
-
-#include "widget.h"
-
-#define PLAYLIST_LIST(x)    ((PlayList_List *)(x))
-struct _PlayList_List {
-    Widget pl_widget;
-    gint pl_first, pl_fheight, pl_prev_selected, pl_prev_min, pl_prev_max;
-    gint pl_num_visible, pl_drag_pos;
-    gboolean pl_dragging, pl_auto_drag_down, pl_auto_drag_up;
-    gint pl_auto_drag_up_tag, pl_auto_drag_down_tag;
-    gboolean pl_drag_motion;
-    gint drag_motion_x, drag_motion_y;
-    gboolean pl_tooltips;
-};
-
-typedef struct _PlayList_List PlayList_List;
-
-PlayList_List *create_playlist_list(GList ** wlist, GdkPixmap * parent,
-                                    GdkGC * gc, gint x, gint y, gint w,
-                                    gint h);
-void playlist_list_move_up(PlayList_List * pl);
-void playlist_list_move_down(PlayList_List * pl);
-int playlist_list_get_playlist_position(PlayList_List * pl, gint x, gint y);
-void playlist_list_set_font(const gchar * font);
-GdkPixmap *rootpix;
-GdkPixmap *shade_pixmap(GdkDrawable *in, gint x, gint y, gint x_offset, gint y_offset, gint w, gint h, GdkColor *shade_color);
-GdkDrawable *get_transparency_pixmap(void);
-
-#endif
--- a/src/audacious/widgets/widgetcore.h	Thu Aug 02 02:03:35 2007 -0500
+++ b/src/audacious/widgets/widgetcore.h	Thu Aug 02 14:14:32 2007 +0200
@@ -21,7 +21,6 @@
 #ifndef _WIDGETCORE_H_
 #define _WIDGETCORE_H_
 
-#include "playlist_list.h"
 #include "skin.h"
 #include "widget.h"