changeset 4548:d85316d57a02

Automated merge with ssh://hg.atheme.org//hg/audacious
author Jonathan Schleifer <js-audacious@webkeks.org>
date Thu, 15 May 2008 19:25:45 +0200
parents d4c5719d30d1 (diff) 024be3d7ef4c (current diff)
children 8445515efab1
files
diffstat 26 files changed, 959 insertions(+), 847 deletions(-) [+]
line wrap: on
line diff
--- a/HACKING	Thu May 15 19:25:29 2008 +0200
+++ b/HACKING	Thu May 15 19:25:45 2008 +0200
@@ -22,6 +22,13 @@
 
 Coding guidelines
 =================
+- Public functions in Audacious core SHOULD be documented via Doxygen
+  comments! In this case "public" means any functions that span modules
+  OR are available to plugins.
+
+  Of course, most functions currently lack documentation. If you have
+  spare time, improve the situation.
+
 
 - We use Glib for portability. This means that we have sized integer types
   such as gint{16,32,64}, etc. and shorthand types like guint and guchar
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TODO	Thu May 15 19:25:45 2008 +0200
@@ -0,0 +1,63 @@
+Long-term "TODO"
+================
+- URIs with "?" are stripped (the subtune support uses that), which is bad,
+  because some (a lot) of real-world URLs use 'GET' arguments. this breaks
+  probing, but current input probing is confusing (and possibly broken anyway)
+  and should be refactored.
+
+
+- mime-types support:
+  * there is already code for mime support, but I think it may not be
+    sufficient as it is designed for input plugins only -- 
+    also playlist containers etc. need this (IMHO)
+
+  * might be nicer to have the type registrations in plugin struct
+    instead of a separate function, a'la vfs_extensions.
+
+
+- document the different APIs via Doxygen
+
+
+- unified debugging/message system, for core and plugins
+  * something like glib logging system, with logging levels
+  * hardcoded "debugging" levels and/or macro-wrappers that would
+    disable superfluous debugging output compile-time.
+  --- being planned by ccr
+
+
+- audacious VFS is not 64-bit offset safe, breakage will most likely occur,
+  if files larger than 2^31 are used (rather unlikely, tho, but still...)
+
+  * nenolod says: current vfs sucks, it needs a "rewrite":
+    - buffering support
+    - non-blocking I/O support
+
+
+- {core,plugins}/configure.ac need some cleanup loving.
+  * make session management (SM) optional.
+  * build system cleanups .. extra.mk.in? wtf?
+  --- this is in progress, worked on by ccr
+
+
+- plugin rewrites:
+  * madplug
+  * modplug (in progress by ccr)
+  * scrobbler
+
+
+- playlist.c: playlist_clear() is VERY slow, possible reasons?
+  * GList sucks? (it does, but is it the reason here?)
+  * playlist_entry_free()?
+  * mowgli_heap_free()?
+
+  possible solutions?
+  * mempools for playlist data? not sure if possible, the tuple heaps
+    should then somehow be collected into pools...
+  * storing the playlist as a GtkTreeModel seems to be fairly fast (at least
+    in mudkip-player it is) --nenolod
+
+- playlist.c: racecondition in scanner thread vs. playlist manipulation
+  (playlist_clear(), free, etc.)
+  * go through scanner thread code and revise it.
+  * also all playlist manipulation should be double-checked.
+  * .. actually, the whole playlist.c should be refactored completely.
--- a/acinclude.m4	Thu May 15 19:25:29 2008 +0200
+++ b/acinclude.m4	Thu May 15 19:25:45 2008 +0200
@@ -36,7 +36,6 @@
 
 dnl ** Simplifying wrapper
 AC_DEFUN([AUD_CONDITIONAL],
-dnl [AM_CONDITIONAL([$1],[test "x${$2}" = m4_ifval([$3], ["x$3"],["xyes"])])
 [if test "x${$2}" = m4_ifval([$3], ["x$3"],["xyes"]) ; then
     $1="yes"
 else
@@ -119,3 +118,55 @@
 AC_SUBST(Name[]_PLUGIN_DIR)dnl
 define([aud_plugin_dirs_defined],[1])dnl
 ])dnl
+
+
+dnl ***
+dnl *** Common checks
+dnl ***
+AC_DEFUN([AUD_COMMON_PROGS], [
+
+dnl Check for C and C++ compilers
+dnl =============================
+AUD_CHECK_GNU_MAKE
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_AS
+AC_ISC_POSIX
+AC_C_BIGENDIAN
+
+if test "x$GCC" = "xyes"; then
+    CFLAGS="$CFLAGS -Wall -pipe"
+    CXXFLAGS="$CXXFLAGS -pipe -Wall"
+fi
+
+dnl Checks for various programs
+dnl ===========================
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PATH_PROG([RM], [rm])
+AC_PATH_PROG([MV], [mv])
+AC_PATH_PROG([CP], [cp])
+AC_PATH_PROG([AR], [ar])
+AC_PATH_PROG([RANLIB], [ranlib])
+
+
+dnl Check for Gtk+/GLib and pals
+dnl ============================
+AUD_CHECK_MODULE([GLIB], [glib-2.0], [>= 2.14.0], [Glib2])
+AUD_CHECK_MODULE([GTHREAD], [gthread-2.0], [>= 2.14.0], [gthread-2.0])
+AUD_CHECK_MODULE([GTK], [gtk+-2.0], [>= 2.10.0], [Gtk+2])
+AUD_CHECK_MODULE([PANGO], [pango], [>= 1.8.0], [Pango])
+AUD_CHECK_MODULE([CAIRO], [cairo], [>= 1.2.4], [Cairo])
+
+
+dnl Check for libmowgli
+dnl ===================
+AUD_CHECK_MODULE([MOWGLI], [libmowgli], [>= 0.4.0], [libmowgli],
+    [http://www.atheme.org/projects/mowgli.shtml])
+
+
+dnl Check for libmcs
+dnl ================
+AUD_CHECK_MODULE([LIBMCS], [libmcs >= 0.7], [libmcs],
+    [http://www.atheme.org/projects/mcs.shtml])
+])
--- a/configure.ac	Thu May 15 19:25:29 2008 +0200
+++ b/configure.ac	Thu May 15 19:25:45 2008 +0200
@@ -57,30 +57,9 @@
 AM_GNU_GETTEXT
 AM_GNU_GETTEXT_VERSION([0.14.0])
 
-
-dnl Check for C and C++ compilers
-dnl =============================
-AUD_CHECK_GNU_MAKE
-AC_PROG_CC
-AC_PROG_CXX
-AM_PROG_AS
-AC_ISC_POSIX
-AC_C_BIGENDIAN
-
-if test "x$GCC" = "xyes"; then
-    CFLAGS="$CFLAGS -Wall -pipe"
-fi
-
-
-dnl Checks for various programs
-dnl ===========================
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_PATH_PROG([RM], [rm])
-AC_PATH_PROG([MV], [mv])
-AC_PATH_PROG([CP], [cp])
-AC_PATH_PROG([AR], [ar])
-AC_PATH_PROG([RANLIB], [ranlib])
+dnl Checks common for core and plugins
+dnl ==================================
+AUD_COMMON_PROGS
 
 
 dnl Check for headers and functions
@@ -107,28 +86,6 @@
 
 
 ### ---------------------------------------------------------------------------
-dnl Check for Gtk+/GLib and pals
-dnl ============================
-AUD_CHECK_MODULE([GLIB], [glib-2.0], [>= 2.14.0], [Glib2])
-AUD_CHECK_MODULE([GTHREAD], [gthread-2.0], [>= 2.14.0], [gthread-2.0])
-AUD_CHECK_MODULE([GTK], [gtk+-2.0], [>= 2.10.0], [Gtk+2])
-AUD_CHECK_MODULE([PANGO], [pango], [>= 1.8.0], [Pango])
-AUD_CHECK_MODULE([CAIRO], [cairo], [>= 1.2.4], [Cairo])
-
-
-dnl Check for libmowgli
-dnl ===================
-AUD_CHECK_MODULE([MOWGLI], [libmowgli], [>= 0.4.0], [libmowgli],
-    [http://www.atheme.org/projects/mowgli.shtml])
-
-
-dnl Check for libmcs
-dnl ================
-AUD_CHECK_MODULE([LIBMCS], [libmcs >= 0.7], [libmcs],
-    [http://www.atheme.org/projects/mcs.shtml])
-
-
-### ---------------------------------------------------------------------------
 dnl Chardet support
 dnl ===============
 AUD_ARG_ENABLE([chardet], [yes],
@@ -159,6 +116,8 @@
     if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$GLIB_GENMARSHAL" = "xno" || test "x$enable_dbus" = "xno" ; then
         enable_dbus="no"
     else
+        ADD_PC_REQUIRES([dbus-1 >= 0.60])
+        ADD_PC_REQUIRES([dbus-glib-1 >= 0.60])
         AC_DEFINE([USE_DBUS], 1, [Define if D-Bus support enabled])
         AC_DEFINE([DBUS_SERVICES_DIR], "$datadir/dbus-1/services",
             [Location of D-Bus services directory])
--- a/src/audacious/Makefile	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/Makefile	Thu May 15 19:25:45 2008 +0200
@@ -11,7 +11,6 @@
        custom_uri.c						\
        discovery.c						\
        dnd.c							\
-       dock.c							\
        effect.c							\
        equalizer_flow.c					\
        eventqueue.c						\
@@ -41,6 +40,7 @@
        ui_about.c						\
        ui_albumart.c					\
        ui_credits.c						\
+       ui_dock.c						\
        ui_equalizer.c					\
        ui_fileinfo.c					\
        ui_fileinfopopup.c				\
--- a/src/audacious/audconfig.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/audconfig.c	Thu May 15 19:25:45 2008 +0200
@@ -103,7 +103,7 @@
     .close_dialog_add = TRUE,
     .equalizer_preamp = 0.0,
     .equalizer_bands = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
-    .scale_factor = 1.2, /* GUI scale factor, hardcoded for testing purposes --majeru */
+    .scale_factor = 2.0,
     .skin = NULL,
     .outputplugin = NULL,
     .filesel_path = NULL,
--- a/src/audacious/auddrct.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/auddrct.c	Thu May 15 19:25:45 2008 +0200
@@ -25,10 +25,6 @@
 #include "main.h"
 #include "input.h"
 #include "playback.h"
-#include "ui_main.h"
-#include "ui_playlist.h"
-#include "ui_equalizer.h"
-#include "ui_jumptotrack.h"
 #include "auddrct.h"
 #include "playlist.h"
 
@@ -37,69 +33,57 @@
 void
 drct_quit ( void )
 {
-  aud_quit();
+    aud_quit();
 }
 
 void
 drct_eject ( void )
 {
-  if (has_x11_connection)
-    mainwin_eject_pushed();
-  return;
+    gboolean play_button = FALSE;
+    hook_call("filebrowser show", &play_button);
 }
 
 void
 drct_jtf_show ( void )
 {
-  if (has_x11_connection)
-    ui_jump_to_track();
-  return;
+    gboolean show = TRUE;
+    hook_call("ui jump to track show", &show);
 }
 
 gboolean
 drct_main_win_is_visible ( void )
 {
-  return cfg.player_visible;
+    return cfg.player_visible;
 }
 
 void
 drct_main_win_toggle ( gboolean show )
 {
-  if (has_x11_connection)
-    mainwin_show(show);
-  return;
+    hook_call("mainwin show", &show);
 }
 
 gboolean
 drct_eq_win_is_visible ( void )
 {
-  return cfg.equalizer_visible;
+    return cfg.equalizer_visible;
 }
 
 void
 drct_eq_win_toggle ( gboolean show )
 {
-  if (has_x11_connection)
-    equalizerwin_show(show);
-  return;
+    hook_call("equalizerwin show", &show);
 }
 
 gboolean
 drct_pl_win_is_visible ( void )
 {
-  return cfg.playlist_visible;
+    return cfg.playlist_visible;
 }
 
 void
 drct_pl_win_toggle ( gboolean show )
 {
-  if (has_x11_connection) {
-    if (show)
-      playlistwin_show();
-    else
-      playlistwin_hide();
-  }
-  return;
+    hook_call("playlistwin show", &show);
 }
 
 void drct_activate(void)
@@ -112,48 +96,48 @@
 void
 drct_play ( void )
 {
-  if (playback_get_paused())
-    playback_pause();
-  else if (playlist_get_length(playlist_get_active()))
-    event_queue("playback initiate", (gpointer)0xdeadbeef); // to avoid crash at startup. --yaz
-  else
-    mainwin_eject_pushed();
-  return;
+    if (playback_get_paused())
+        playback_pause();
+    else if (playlist_get_length(playlist_get_active()))
+        event_queue("playback initiate", (gpointer)0xdeadbeef); // to avoid crash at startup. --yaz
+    else
+        mainwin_eject_pushed();
+    return;
 }
 
 void
 drct_pause ( void )
 {
-  playback_pause();
-  return;
+    playback_pause();
+    return;
 }
 
 void
 drct_stop ( void )
 {
-  ip_data.stop = TRUE;
-  playback_stop();
-  ip_data.stop = FALSE;
-  mainwin_clear_song_info();
-  return;
+    ip_data.stop = TRUE;
+    playback_stop();
+    ip_data.stop = FALSE;
+    mainwin_clear_song_info();
+    return;
 }
 
 gboolean
 drct_get_playing ( void )
 {
-  return playback_get_playing();
+    return playback_get_playing();
 }
 
 gboolean
 drct_get_paused ( void )
 {
-  return playback_get_paused();
+    return playback_get_paused();
 }
 
 gboolean
 drct_get_stopped ( void )
 {
-  return !playback_get_playing();
+    return !playback_get_playing();
 }
 
 void
@@ -165,108 +149,108 @@
 gint
 drct_get_time ( void )
 {
-  gint time;
-  if (playback_get_playing())
-    time = playback_get_time();
-  else
-    time = 0;
-  return time;
+    gint time;
+    if (playback_get_playing())
+        time = playback_get_time();
+    else
+        time = 0;
+    return time;
 }
 
 void
 drct_seek ( guint pos )
 {
-  if (playlist_get_current_length(playlist_get_active()) > 0 &&
-      pos < (guint)playlist_get_current_length(playlist_get_active()))
-    playback_seek(pos / 1000);
-  return;
+    if (playlist_get_current_length(playlist_get_active()) > 0 &&
+        pos < (guint)playlist_get_current_length(playlist_get_active()))
+        playback_seek(pos / 1000);
+    return;
 }
 
 void
 drct_get_volume ( gint *vl, gint *vr )
 {
-  input_get_volume(vl, vr);
-  return;
+    input_get_volume(vl, vr);
+    return;
 }
 
 void
 drct_set_volume ( gint vl, gint vr )
 {
-  if (vl > 100)
-    vl = 100;
-  if (vr > 100)
-    vr = 100;
-  input_set_volume(vl, vr);
-  return;
+    if (vl > 100)
+        vl = 100;
+    if (vr > 100)
+        vr = 100;
+    input_set_volume(vl, vr);
+    return;
 }
 
 void
 drct_get_volume_main( gint *v )
 {
-  gint vl, vr;
-  drct_get_volume(&vl, &vr);
-  *v = (vl > vr) ? vl : vr;
-  return;
+    gint vl, vr;
+    drct_get_volume(&vl, &vr);
+    *v = (vl > vr) ? vl : vr;
+    return;
 }
 
 void
 drct_set_volume_main ( gint v )
 {
-  gint b, vl, vr;
-  drct_get_volume_balance(&b);
-  if (b < 0) {
-    vl = v;
-    vr = (v * (100 - abs(b))) / 100;
-  }
-  else if (b > 0) {
-    vl = (v * (100 - b)) / 100;
-    vr = v;
-  }
-  else
-    vl = vr = v;
-  drct_set_volume(vl, vr);
+    gint b, vl, vr;
+    drct_get_volume_balance(&b);
+    if (b < 0) {
+        vl = v;
+        vr = (v * (100 - abs(b))) / 100;
+    }
+    else if (b > 0) {
+        vl = (v * (100 - b)) / 100;
+        vr = v;
+    }
+    else
+        vl = vr = v;
+    drct_set_volume(vl, vr);
 }
 
 void
 drct_get_volume_balance ( gint *b )
 {
-  gint vl, vr;
-  input_get_volume(&vl, &vr);
-  if (vl < 0 || vr < 0)
-    *b = 0;
-  else if (vl > vr)
-    *b = -100 + ((vr * 100) / vl);
-  else if (vr > vl)
-    *b = 100 - ((vl * 100) / vr);
-  else
-    *b = 0;
-  return;
+    gint vl, vr;
+    input_get_volume(&vl, &vr);
+    if (vl < 0 || vr < 0)
+        *b = 0;
+    else if (vl > vr)
+        *b = -100 + ((vr * 100) / vl);
+    else if (vr > vl)
+        *b = 100 - ((vl * 100) / vr);
+    else
+        *b = 0;
+    return;
 }
 
 void
 drct_set_volume_balance ( gint b )
 {
-  gint v, vl, vr;
-  if (b < -100)
-    b = -100;
-  if (b > 100)
-    b = 100;
-  drct_get_volume_main(&v);
-  if (b < 0) {
-    vl = v;
-    vr = (v * (100 - abs(b))) / 100;
-  }
-  else if (b > 0) {
-    vl = (v * (100 - b)) / 100;
-    vr = v;
-  }
-  else
-  {
-    vl = v;
-    vr = v;
-  }
-  drct_set_volume(vl, vr);
-  return;
+    gint v, vl, vr;
+    if (b < -100)
+        b = -100;
+    if (b > 100)
+        b = 100;
+    drct_get_volume_main(&v);
+    if (b < 0) {
+        vl = v;
+        vr = (v * (100 - abs(b))) / 100;
+    }
+    else if (b > 0) {
+        vl = (v * (100 - b)) / 100;
+        vr = v;
+    }
+    else
+    {
+        vl = v;
+        vr = v;
+    }
+    drct_set_volume(vl, vr);
+    return;
 }
 
 
@@ -275,15 +259,15 @@
 void
 drct_pl_next ( void )
 {
-  playlist_next(playlist_get_active());
-  return;
+    playlist_next(playlist_get_active());
+    return;
 }
 
 void
 drct_pl_prev ( void )
 {
-  playlist_prev(playlist_get_active());
-  return;
+    playlist_prev(playlist_get_active());
+    return;
 }
 
 gboolean
@@ -295,8 +279,8 @@
 void
 drct_pl_repeat_toggle( void )
 {
-  mainwin_repeat_pushed(!cfg.repeat);
-  return;
+    mainwin_repeat_pushed(!cfg.repeat);
+    return;
 }
 
 gboolean
@@ -308,8 +292,8 @@
 void
 drct_pl_shuffle_toggle( void )
 {
-  mainwin_shuffle_pushed(!cfg.shuffle);
-  return;
+    mainwin_shuffle_pushed(!cfg.shuffle);
+    return;
 }
 
 gchar *
@@ -339,21 +323,21 @@
 void
 drct_pl_add ( GList * list )
 {
-  GList *node = list;
-  while ( node != NULL )
-  {
-    playlist_add_url(playlist_get_active(), (gchar*)node->data);
-    node = g_list_next(node);
-  }
-  return;
+    GList *node = list;
+    while ( node != NULL )
+    {
+        playlist_add_url(playlist_get_active(), (gchar*)node->data);
+        node = g_list_next(node);
+    }
+    return;
 }
 
 void
 drct_pl_clear ( void )
 {
-  playlist_clear(playlist_get_active());
-  mainwin_clear_song_info();
-  return;
+    playlist_clear(playlist_get_active());
+    mainwin_clear_song_info();
+    return;
 }
 
 
--- a/src/audacious/dbus.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/dbus.c	Thu May 15 19:25:45 2008 +0200
@@ -33,19 +33,13 @@
 
 #include <math.h>
 #include "main.h"
-#include "ui_equalizer.h"
-#include "ui_main.h"
 #include "input.h"
 #include "playback.h"
 #include "playlist.h"
-#include "ui_playlist.h"
-#include "ui_preferences.h"
 #include "tuple.h"
-#include "ui_jumptotrack.h"
 #include "strings.h"
-#include "ui_credits.h"
+#include "ui_equalizer.h"
 #include "ui_skin.h"
-#include "ui_fileopener.h"
 
 static DBusGConnection *dbus_conn = NULL;
 static guint signals[LAST_SIG] = { 0 };
@@ -523,23 +517,19 @@
 }
 
 gboolean audacious_rc_eject(RemoteObject *obj, GError **error) {
-    if (has_x11_connection)
-        mainwin_eject_pushed();
+    drct_eject();
     return TRUE;
 }
 
 gboolean audacious_rc_main_win_visible(RemoteObject *obj,
                                        gboolean *is_main_win, GError **error) {
     *is_main_win = cfg.player_visible;
-    g_message("main win %s\n", (cfg.player_visible? "visible" : "hidden"));
     return TRUE;
 }
 
 gboolean audacious_rc_show_main_win(RemoteObject *obj, gboolean show,
                                     GError **error) {
-    g_message("%s main win\n", (show? "showing": "hiding"));
-    if (has_x11_connection)
-        mainwin_show(show);
+    drct_main_win_toggle(show);
     return TRUE;
 }
 
@@ -551,8 +541,7 @@
 
 gboolean audacious_rc_show_equalizer(RemoteObject *obj, gboolean show,
                                      GError **error) {
-    if (has_x11_connection)
-        equalizerwin_show(show);
+    drct_eq_win_toggle(show);
     return TRUE;
 }
 
@@ -564,12 +553,7 @@
 
 gboolean audacious_rc_show_playlist(RemoteObject *obj, gboolean show,
                                     GError **error) {
-    if (has_x11_connection) {
-        if (show)
-            playlistwin_show();
-        else
-            playlistwin_hide();
-    }
+    drct_pl_win_toggle(show);
     return TRUE;
 }
 
@@ -821,42 +805,27 @@
 
 /* New on Oct 5 */
 gboolean audacious_rc_show_prefs_box(RemoteObject *obj, gboolean show, GError **error) {
-    if (has_x11_connection) {
-        if (show)
-            show_prefs_window();
-        else
-            hide_prefs_window();
-    }
+    hook_call("prefswin show", &show);
     return TRUE;
 }
+
 gboolean audacious_rc_show_about_box(RemoteObject *obj, gboolean show, GError **error) {
-    if (has_x11_connection) {
-        if (show)
-            show_about_window();
-        else
-            hide_about_window();
-    }
+    hook_call("aboutwin show", &show);
     return TRUE;
 }
 
 gboolean audacious_rc_show_jtf_box(RemoteObject *obj, gboolean show, GError **error) {
-    if (has_x11_connection) {
-        if (show)
-            ui_jump_to_track();
-        else
-            ui_jump_to_track_hide();
-    }
+    hook_call("ui jump to track show", &show);
     return TRUE;
 }
 
 gboolean audacious_rc_show_filebrowser(RemoteObject *obj, gboolean show, GError **error)
 {
-    if (has_x11_connection) {
-        if (show)
-            run_filebrowser(FALSE);
-        else
-            hide_filebrowser();
-    }
+    gboolean play_button = FALSE;
+    if (show)
+        hook_call("filebrowser show", &play_button);
+    else
+        hook_call("filebrowser hide", NULL);
     return TRUE;
 }
 
@@ -873,14 +842,15 @@
     return TRUE;
 }
 
+/* TODO: these skin functions should be removed when skin functionality
+ * disappears --mf0102 */
 gboolean audacious_rc_get_skin(RemoteObject *obj, gchar **skin, GError **error) {
     *skin = g_strdup(aud_active_skin->path);
     return TRUE;
 }
 
 gboolean audacious_rc_set_skin(RemoteObject *obj, gchar *skin, GError **error) {
-    if (has_x11_connection == TRUE)
-        aud_active_skin_load(skin);
+    aud_active_skin_load(skin);
     return TRUE;
 }
 
@@ -890,9 +860,7 @@
 }
 
 gboolean audacious_rc_toggle_aot(RemoteObject *obj, gboolean ontop, GError **error) {
-    if (has_x11_connection) {
-        mainwin_set_always_on_top(ontop);
-    }
+    hook_call("mainwin set always on top", &ontop);
     return TRUE;
 }
 
--- a/src/audacious/dock.c	Thu May 15 19:25:29 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,531 +0,0 @@
-/*  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 <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.
- */
-
-#include "dock.h"
-
-#include <gdk/gdk.h>
-#include <stdlib.h>
-#include "main.h"
-#include "ui_skinned_window.h"
-
-#include "platform/smartinclude.h"
-
-static GList *dock_window_list = NULL;
-
-struct _DockedWindow {
-    GtkWindow *w;
-    gint offset_x, offset_y;
-};
-
-typedef struct _DockedWindow DockedWindow;
-
-
-static gint
-docked_list_compare(DockedWindow * a, DockedWindow * b)
-{
-    if (a->w == b->w)
-        return 0;
-    return 1;
-}
-
-static void
-snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by,
-          gint bw, gint bh)
-{
-    gint sd = cfg.snap_distance;
-
-    if ((*x + w > bx - sd) && (*x + w < bx + sd) &&
-        (*y > by - h - sd) && (*y < by + bh + sd)) {
-        *x = bx - w;
-        if ((*y > by - sd) && (*y < by + sd))
-            *y = by;
-        if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
-            *y = by + bh - h;
-    }
-    if ((*x > bx + bw - sd) && (*x < bx + bw + sd) &&
-        (*y > by - h - sd) && (*y < by + bh + sd)) {
-        *x = bx + bw;
-        if ((*y > by - sd) && (*y < by + sd))
-            *y = by;
-        if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
-            *y = by + bh - h;
-    }
-}
-
-static void
-snap(gint * x, gint * y, gint w, gint h, gint bx, gint by, gint bw, gint bh)
-{
-    snap_edge(x, y, w, h, bx, by, bw, bh);
-    snap_edge(y, x, h, w, by, bx, bh, bw);
-}
-
-static void
-calc_snap_offset(GList * dlist, GList * wlist, gint x, gint y,
-                 gint * off_x, gint * off_y)
-{
-    gint nx, ny, nw, nh, sx, sy, sw, sh;
-    GtkWindow *w;
-    GList *dnode, *wnode;
-    DockedWindow temp, *dw;
-
-
-    *off_x = 0;
-    *off_y = 0;
-
-    if (!cfg.snap_windows)
-        return;
-
-    /*
-     * FIXME: Why not break out of the loop when we find someting
-     * to snap to?
-     */
-    for (dnode = dlist; dnode; dnode = g_list_next(dnode)) {
-        dw = dnode->data;
-        gtk_window_get_size(dw->w, &nw, &nh);
-
-        nx = dw->offset_x + *off_x + x;
-        ny = dw->offset_y + *off_y + y;
-
-        /* Snap to screen edges */
-        if (abs(nx) < cfg.snap_distance)
-            *off_x -= nx;
-        if (abs(ny) < cfg.snap_distance)
-            *off_y -= ny;
-        if (abs(nx + nw - gdk_screen_width()) < cfg.snap_distance)
-            *off_x -= nx + nw - gdk_screen_width();
-        if (abs(ny + nh - gdk_screen_height()) < cfg.snap_distance)
-            *off_y -= ny + nh - gdk_screen_height();
-
-        /* Snap to other windows */
-        for (wnode = wlist; wnode; wnode = g_list_next(wnode)) {
-            temp.w = wnode->data;
-            if (g_list_find_custom
-                (dlist, &temp, (GCompareFunc) docked_list_compare))
-                /* These windows are already docked */
-                continue;
-
-            w = GTK_WINDOW(wnode->data);
-            gtk_window_get_position(w, &sx, &sy);
-            gtk_window_get_size(w, &sw, &sh);
-
-            nx = dw->offset_x + *off_x + x;
-            ny = dw->offset_y + *off_y + y;
-
-            snap(&nx, &ny, nw, nh, sx, sy, sw, sh);
-
-            *off_x += nx - (dw->offset_x + *off_x + x);
-            *off_y += ny - (dw->offset_y + *off_y + y);
-        }
-    }
-}
-
-
-static gboolean
-is_docked(gint a_x, gint a_y, gint a_w, gint a_h,
-          gint b_x, gint b_y, gint b_w, gint b_h)
-{
-    if (((a_x == b_x + b_w) || (a_x + a_w == b_x)) &&
-        (b_y + b_h >= a_y) && (b_y <= a_y + a_h))
-        return TRUE;
-
-    if (((a_y == b_y + b_h) || (a_y + a_h == b_y)) &&
-        (b_x >= a_x - b_w) && (b_x <= a_x + a_w))
-        return TRUE;
-
-    return FALSE;
-}
-
-/*
- * Builds a list of all windows that are docked to the window "w".
- * Recursively adds all windows that are docked to the windows that are
- * docked to "w" and so on...
- * FIXME: init_off_?  ?
- */
-
-static GList *
-get_docked_list(GList * dlist, GList * wlist, GtkWindow * w,
-                gint init_off_x, gint init_off_y)
-{
-    GList *node;
-    DockedWindow *dwin, temp;
-    gint w_x, w_y, w_width, w_height;
-    gint t_x, t_y, t_width, t_height;
-
-
-    gtk_window_get_position(w, &w_x, &w_y);
-    gtk_window_get_size(w, &w_width, &w_height);
-    if (!dlist) {
-        dwin = g_new0(DockedWindow, 1);
-        dwin->w = w;
-        dlist = g_list_append(dlist, dwin);
-    }
-
-    for (node = wlist; node; node = g_list_next(node)) {
-        temp.w = node->data;
-        if (g_list_find_custom
-            (dlist, &temp, (GCompareFunc) docked_list_compare))
-            continue;
-
-        gtk_window_get_position(GTK_WINDOW(node->data), &t_x, &t_y);
-        gtk_window_get_size(GTK_WINDOW(node->data), &t_width, &t_height);
-        if (is_docked
-            (w_x, w_y, w_width, w_height, t_x, t_y, t_width, t_height)) {
-            dwin = g_new0(DockedWindow, 1);
-            dwin->w = node->data;
-
-            dwin->offset_x = t_x - w_x + init_off_x;
-            dwin->offset_y = t_y - w_y + init_off_y;
-
-            dlist = g_list_append(dlist, dwin);
-
-            dlist =
-                get_docked_list(dlist, wlist, dwin->w, dwin->offset_x,
-                                dwin->offset_y);
-        }
-    }
-    return dlist;
-}
-
-static void
-free_docked_list(GList * dlist)
-{
-    GList *node;
-
-    for (node = dlist; node; node = g_list_next(node))
-        g_free(node->data);
-    g_list_free(dlist);
-}
-
-static void
-docked_list_move(GList * list, gint x, gint y)
-{
-    GList *node;
-    DockedWindow *dw;
-
-    for (node = list; node; node = g_list_next(node)) {
-        dw = node->data;
-        gtk_window_move(dw->w, x + dw->offset_x, y + dw->offset_y);
-
-        SkinnedWindow *window = SKINNED_WINDOW(dw->w);
-        if (window) {
-            switch(window->type) {
-
-            case WINDOW_MAIN:
-                cfg.player_x = x + dw->offset_x;
-                cfg.player_y = y + dw->offset_y;
-                break;
-            case WINDOW_EQ:
-                cfg.equalizer_x = x + dw->offset_x;
-                cfg.equalizer_y = y + dw->offset_y;
-                break;
-            case WINDOW_PLAYLIST:
-                cfg.playlist_x = x + dw->offset_x;
-                cfg.playlist_y = y + dw->offset_y;
-                break;
-            }
-
-            window->x = x + dw->offset_x;
-            window->y = y + dw->offset_y;
-        }
-    }
-}
-
-static GList *
-shade_move_list(GList * list, GtkWindow * widget, gint offset)
-{
-    gint x, y, w, h;
-    GList *node;
-    DockedWindow *dw;
-
-    gtk_window_get_position(widget, &x, &y);
-    gtk_window_get_size(widget, &w, &h);
-
-
-    for (node = list; node;) {
-        gint dx, dy, dwidth, dheight;
-
-        dw = node->data;
-        gtk_window_get_position(dw->w, &dx, &dy);
-        gtk_window_get_size(dw->w, &dwidth, &dheight);
-        if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
-            ((dx + dwidth) > x && dx < (x + w))) {
-            list = g_list_remove_link(list, node);
-            g_list_free_1(node);
-
-            node = list = shade_move_list(list, dw->w, offset);
-        }
-        else
-            node = g_list_next(node);
-    }
-    gtk_window_move(widget, x, y + offset);
-    return list;
-}
-
-/*
- * Builds a list of the windows in the list of DockedWindows "winlist"
- * that are docked to the top or bottom of the window, and recursively
- * adds all windows that are docked to the top or bottom of that window,
- * and so on...
- * Note: The data in "winlist" is not copied.
- */
-static GList *
-find_shade_list(GtkWindow * widget, GList * winlist, GList * shade_list)
-{
-    gint x, y, w, h;
-    gint dx, dy, dwidth, dheight;
-    GList *node;
-
-    gtk_window_get_position(widget, &x, &y);
-    gtk_window_get_size(widget, &w, &h);
-    for (node = winlist; node; node = g_list_next(node)) {
-        DockedWindow *dw = node->data;
-        if (g_list_find_custom
-            (shade_list, dw, (GCompareFunc) docked_list_compare))
-            continue;
-        gtk_window_get_position(dw->w, &dx, &dy);
-        gtk_window_get_size(dw->w, &dwidth, &dheight);
-
-        /* FIXME. Is the is_docked() necessary? */
-        if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
-            ((dx + dwidth) > x && dx < (x + w))) {
-            shade_list = g_list_append(shade_list, dw);
-            shade_list = find_shade_list(dw->w, winlist, shade_list);
-        }
-    }
-    return shade_list;
-}
-
-void
-dock_window_resize(GtkWindow * widget, gint new_w, gint new_h, gint w, gint h)
-{
-    gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, MIN(w, new_w),
-                         MIN(h, new_h), MAX(w, new_w), MAX(h, new_h),
-                         GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
-    gdk_window_resize(GTK_WIDGET(widget)->window, new_w, new_h);
-    gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, new_w, new_h,
-                         new_w, new_h, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
-}
-
-void
-dock_shade(GList * window_list, GtkWindow * widget, gint new_h)
-{
-    gint x, y, w, h, off_y, orig_off_y;
-    GList *node, *docked_list, *slist;
-    DockedWindow *dw;
-
-    gtk_window_get_position(widget, &x, &y);
-    gtk_window_get_size(widget, &w, &h);
-
-    if (cfg.show_wm_decorations) {
-        dock_window_resize(widget, w, new_h, w, h);
-        return;
-    }
-
-    docked_list = get_docked_list(NULL, window_list, widget, 0, 0);
-    slist = find_shade_list(widget, docked_list, NULL);
-
-    off_y = new_h - h;
-    do {
-        orig_off_y = off_y;
-        for (node = slist; node; node = g_list_next(node)) {
-            gint dx, dy, dwidth, dheight;
-
-            dw = node->data;
-            if (dw->w == widget)
-                continue;
-            gtk_window_get_position(dw->w, &dx, &dy);
-            gtk_window_get_size(dw->w, &dwidth, &dheight);
-            if ((dy >= y) && ((dy + off_y + dheight) > gdk_screen_height()))
-                off_y -= (dy + off_y + dheight) - gdk_screen_height();
-            else if ((dy >= y) && ((dy + dheight) == gdk_screen_height()))
-                off_y = 0;
-
-            if (((dy >= y) && ((dy + off_y) < 0)))
-                off_y -= dy + off_y;
-            if ((dy < y) && ((dy + (off_y - (new_h - h))) < 0))
-                off_y -= dy + (off_y - (new_h - h));
-        }
-    } while (orig_off_y != off_y);
-    if (slist) {
-        GList *mlist = g_list_copy(slist);
-
-        /* Remove this widget from the list */
-        for (node = mlist; node; node = g_list_next(node)) {
-            dw = node->data;
-            if (dw->w == widget) {
-                mlist = g_list_remove_link(mlist, node);
-                g_list_free_1(node);
-                break;
-            }
-        }
-        for (node = mlist; node;) {
-            GList *temp;
-            gint dx, dy, dwidth, dheight;
-
-            dw = node->data;
-
-            gtk_window_get_position(dw->w, &dx, &dy);
-            gtk_window_get_size(dw->w, &dwidth, &dheight);
-            /*
-             * Find windows that are directly docked to this window,
-             * move it, and any windows docked to that window again
-             */
-            if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
-                ((dx + dwidth) > x && dx < (x + w))) {
-                mlist = g_list_remove_link(mlist, node);
-                g_list_free_1(node);
-                if (dy > y)
-                    temp = shade_move_list(mlist, dw->w, off_y);
-                else if (off_y - (new_h - h) != 0)
-                    temp = shade_move_list(mlist, dw->w, off_y - (new_h - h));
-                else
-                    temp = mlist;
-                node = mlist = temp;
-            }
-            else
-                node = g_list_next(node);
-        }
-        g_list_free(mlist);
-    }
-    g_list_free(slist);
-    free_docked_list(docked_list);
-    gtk_window_move(widget, x, y + off_y - (new_h - h));
-    dock_window_resize(widget, w, new_h, w, h);
-}
-
-void
-dock_move_press(GList * window_list, GtkWindow * w,
-                GdkEventButton * event, gboolean move_list)
-{
-    gint mx, my;
-    DockedWindow *dwin;
-
-    if (cfg.show_wm_decorations)
-        return;
-
-    gtk_window_present(w);
-    mx = event->x;
-    my = event->y;
-    gtk_object_set_data(GTK_OBJECT(w), "move_offset_x", GINT_TO_POINTER(mx));
-    gtk_object_set_data(GTK_OBJECT(w), "move_offset_y", GINT_TO_POINTER(my));
-    if (move_list)
-        gtk_object_set_data(GTK_OBJECT(w), "docked_list",
-                            get_docked_list(NULL, window_list, w, 0, 0));
-    else {
-        dwin = g_new0(DockedWindow, 1);
-        dwin->w = w;
-        gtk_object_set_data(GTK_OBJECT(w), "docked_list",
-                            g_list_append(NULL, dwin));
-    }
-    gtk_object_set_data(GTK_OBJECT(w), "window_list", window_list);
-    gtk_object_set_data(GTK_OBJECT(w), "is_moving", GINT_TO_POINTER(1));
-}
-
-void
-dock_move_motion(GtkWindow * w, GdkEventMotion * event)
-{
-    gint offset_x, offset_y, x, y;
-    GList *dlist;
-    GList *window_list;
-
-    if (!gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
-        return;
-
-    offset_x =
-        GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_x"));
-    offset_y =
-        GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_y"));
-    dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list");
-    window_list = gtk_object_get_data(GTK_OBJECT(w), "window_list");
-
-    x = event->x_root - offset_x;
-    y = event->y_root - offset_y;
-
-    calc_snap_offset(dlist, window_list, x, y, &offset_x, &offset_y);
-    x += offset_x;
-    y += offset_y;
-
-    docked_list_move(dlist, x, y);
-}
-
-void
-dock_move_release(GtkWindow * w)
-{
-    GList *dlist;
-    gtk_object_remove_data(GTK_OBJECT(w), "is_moving");
-    gtk_object_remove_data(GTK_OBJECT(w), "move_offset_x");
-    gtk_object_remove_data(GTK_OBJECT(w), "move_offset_y");
-    if ((dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list")) != NULL)
-        free_docked_list(dlist);
-    gtk_object_remove_data(GTK_OBJECT(w), "docked_list");
-    gtk_object_remove_data(GTK_OBJECT(w), "window_list");
-}
-
-gboolean
-dock_is_moving(GtkWindow * w)
-{
-    if (gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
-        return TRUE;
-    return FALSE;
-}
-
-GList *
-dock_add_window(GList * list, GtkWindow * window)
-{
-    return g_list_append(list, window);
-}
-
-GList *
-dock_remove_window(GList * list, GtkWindow * window)
-{
-    return g_list_remove(list, window);
-}
-
-GList *
-dock_window_set_decorated(GList * list, GtkWindow * window,
-                          gboolean decorated)
-{
-    if (gtk_window_get_decorated(window) == decorated)
-        return list;
-
-    if (decorated)
-        list = dock_remove_window(list, window);
-    else
-        list = dock_add_window(list, window);
-
-    gtk_window_set_decorated(window, decorated);
-
-    return list;
-}
-
-GList *
-get_dock_window_list() {
-    return dock_window_list;
-}
-
-void
-set_dock_window_list(GList * list) {
-    dock_window_list = list;
-}
--- a/src/audacious/dock.h	Thu May 15 19:25:29 2008 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*  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 <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 DOCK_H
-#define DOCK_H
-
-#include <glib.h>
-#include <gtk/gtk.h>
-
-void dock_set_uposition(GtkWindow * widget, gint x, gint y);
-GList *dock_add_window(GList * window_list, GtkWindow * window);
-GList *dock_remove_window(GList * window_list, GtkWindow * window);
-void dock_move_press(GList * window_list, GtkWindow * w,
-                     GdkEventButton * event, gboolean move_list);
-void dock_move_motion(GtkWindow * w, GdkEventMotion * event);
-void dock_move_release(GtkWindow * w);
-void dock_get_widget_pos(GtkWindow * w, gint * x, gint * y);
-gboolean dock_is_moving(GtkWindow * w);
-void dock_shade(GList * window_list, GtkWindow * widget, gint new_h);
-
-GList *dock_window_set_decorated(GList * list, GtkWindow * window,
-                                 gboolean decorated);
-void dock_window_resize(GtkWindow * widget, gint new_w, gint new_h, gint w, gint h);
-
-GList *get_dock_window_list();
-void set_dock_window_list(GList * list);
-
-#endif
--- a/src/audacious/input.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/input.c	Thu May 15 19:25:45 2008 +0200
@@ -399,18 +399,18 @@
 
     // apply mimetype check. note that stdio does not support mimetype check.
     mimetype = vfs_get_metadata(fd, "content-type");
-    if ((ip = mime_get_plugin(mimetype)) != NULL && ip->enabled) {
-        while(1) {
-            if (!ip || !ip->enabled)
-                continue;
-
-            pr = input_do_check_file(ip, fd, filename_proxy, loading);
-
-            if(pr) {
-                g_free(filename_proxy);
-                vfs_fclose(fd);
-                return pr;
-            }
+    if (mimetype) {
+        ip = mime_get_plugin(mimetype);
+        g_free(mimetype);
+    } else
+        ip = NULL;
+    
+    if (ip && ip->enabled) {
+        pr = input_do_check_file(ip, fd, filename_proxy, loading);
+        if (pr) {
+            g_free(filename_proxy);
+            vfs_fclose(fd);
+            return pr;
         }
     }
 
--- a/src/audacious/main.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/main.c	Thu May 15 19:25:45 2008 +0200
@@ -89,7 +89,6 @@
 #include "icons-stock.h"
 #include "images/audacious_player.xpm"
 
-gboolean has_x11_connection = FALSE;  /* do we have an X11 connection? */
 static const gchar *application_name = N_("Audacious");
 
 struct _AudCmdLineOpt {
@@ -105,12 +104,10 @@
     gchar *previous_session_id;
     gboolean macpack;
 };
-
 typedef struct _AudCmdLineOpt AudCmdLineOpt;
 
 static AudCmdLineOpt options;
 
-
 gchar *aud_paths[BMP_PATH_COUNT] = {};
 
 GCond *cond_scan;
@@ -120,7 +117,7 @@
 #endif
 
 static void
-dump_version(void)
+print_version(void)
 {
     g_printf("%s %s [%s]\n", _(application_name), VERSION, svn_stamp);
 }
@@ -205,7 +202,6 @@
     g_atexit(aud_free_paths);
 }
 
-
 static void
 aud_set_default_icon(void)
 {
@@ -278,7 +274,7 @@
     {"activate", 'a', 0, G_OPTION_ARG_NONE, &options.activate, N_("Display all open Audacious windows"), NULL},
     {"headless", 'H', 0, G_OPTION_ARG_NONE, &options.headless, N_("Enable headless operation"), NULL},
     {"no-log", 'N', 0, G_OPTION_ARG_NONE, &options.no_log, N_("Print all errors and warnings to stdout"), NULL},
-    {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version and builtin features"), NULL},
+    {"version", 'v', 0, G_OPTION_ARG_NONE, &options.version, N_("Show version"), NULL},
 #ifdef GDK_WINDOWING_QUARTZ
     {"macpack", 'n', 0, G_OPTION_ARG_NONE, &options.macpack, N_("Used in macpacking"), NULL}, /* Make this hidden */
 #endif
@@ -329,7 +325,7 @@
 
     if (options.version)
     {
-        dump_version();
+        print_version();
         exit(EXIT_SUCCESS);
     }
 
@@ -792,8 +788,6 @@
 
         hint_set_always(cfg.always_on_top);
 
-        has_x11_connection = TRUE;
-
         resume_playback_on_startup();
         
         gtk_main();
--- a/src/audacious/main.h	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/main.h	Thu May 15 19:25:45 2008 +0200
@@ -76,8 +76,6 @@
 
 extern gchar *aud_paths[];
 
-extern gboolean has_x11_connection;
-
 extern GCond *cond_scan;
 extern GMutex *mutex_scan;
 #if defined(USE_DBUS) && defined(_AUDACIOUS_CORE)
--- a/src/audacious/playlist.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/playlist.c	Thu May 15 19:25:45 2008 +0200
@@ -61,7 +61,6 @@
 #include "playlist_evmessages.h"
 #include "pluginenum.h"
 #include "strings.h"
-#include "ui_main.h"
 #include "ui_playlist.h"
 #include "util.h"
 #include "vfs.h"
@@ -1487,7 +1486,6 @@
     if (cfg.stopaftersong) {
         PLAYLIST_UNLOCK(playlist);
         hook_call("playlist end reached", NULL);
-        mainwin_set_stopaftersong(FALSE);
         return;
     }
 
--- a/src/audacious/pluginenum.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/pluginenum.c	Thu May 15 19:25:45 2008 +0200
@@ -38,7 +38,6 @@
 #include <string.h>
 
 #include "main.h"
-#include "dock.h"
 #include "playback.h"
 #include "playlist.h"
 #include "strings.h"
@@ -56,6 +55,7 @@
 #include "vfs_buffer.h"
 #include "vfs_buffered_file.h"
 
+#include "ui_dock.h"
 #include "ui_preferences.h"
 #include "ui_fileinfo.h"
 #include "ui_fileinfopopup.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_dock.c	Thu May 15 19:25:45 2008 +0200
@@ -0,0 +1,531 @@
+/*  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 <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.
+ */
+
+#include "ui_dock.h"
+
+#include <gdk/gdk.h>
+#include <stdlib.h>
+#include "main.h"
+#include "ui_skinned_window.h"
+
+#include "platform/smartinclude.h"
+
+static GList *dock_window_list = NULL;
+
+struct _DockedWindow {
+    GtkWindow *w;
+    gint offset_x, offset_y;
+};
+
+typedef struct _DockedWindow DockedWindow;
+
+
+static gint
+docked_list_compare(DockedWindow * a, DockedWindow * b)
+{
+    if (a->w == b->w)
+        return 0;
+    return 1;
+}
+
+static void
+snap_edge(gint * x, gint * y, gint w, gint h, gint bx, gint by,
+          gint bw, gint bh)
+{
+    gint sd = cfg.snap_distance;
+
+    if ((*x + w > bx - sd) && (*x + w < bx + sd) &&
+        (*y > by - h - sd) && (*y < by + bh + sd)) {
+        *x = bx - w;
+        if ((*y > by - sd) && (*y < by + sd))
+            *y = by;
+        if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
+            *y = by + bh - h;
+    }
+    if ((*x > bx + bw - sd) && (*x < bx + bw + sd) &&
+        (*y > by - h - sd) && (*y < by + bh + sd)) {
+        *x = bx + bw;
+        if ((*y > by - sd) && (*y < by + sd))
+            *y = by;
+        if ((*y + h > by + bh - sd) && (*y + h < by + bh + sd))
+            *y = by + bh - h;
+    }
+}
+
+static void
+snap(gint * x, gint * y, gint w, gint h, gint bx, gint by, gint bw, gint bh)
+{
+    snap_edge(x, y, w, h, bx, by, bw, bh);
+    snap_edge(y, x, h, w, by, bx, bh, bw);
+}
+
+static void
+calc_snap_offset(GList * dlist, GList * wlist, gint x, gint y,
+                 gint * off_x, gint * off_y)
+{
+    gint nx, ny, nw, nh, sx, sy, sw, sh;
+    GtkWindow *w;
+    GList *dnode, *wnode;
+    DockedWindow temp, *dw;
+
+
+    *off_x = 0;
+    *off_y = 0;
+
+    if (!cfg.snap_windows)
+        return;
+
+    /*
+     * FIXME: Why not break out of the loop when we find someting
+     * to snap to?
+     */
+    for (dnode = dlist; dnode; dnode = g_list_next(dnode)) {
+        dw = dnode->data;
+        gtk_window_get_size(dw->w, &nw, &nh);
+
+        nx = dw->offset_x + *off_x + x;
+        ny = dw->offset_y + *off_y + y;
+
+        /* Snap to screen edges */
+        if (abs(nx) < cfg.snap_distance)
+            *off_x -= nx;
+        if (abs(ny) < cfg.snap_distance)
+            *off_y -= ny;
+        if (abs(nx + nw - gdk_screen_width()) < cfg.snap_distance)
+            *off_x -= nx + nw - gdk_screen_width();
+        if (abs(ny + nh - gdk_screen_height()) < cfg.snap_distance)
+            *off_y -= ny + nh - gdk_screen_height();
+
+        /* Snap to other windows */
+        for (wnode = wlist; wnode; wnode = g_list_next(wnode)) {
+            temp.w = wnode->data;
+            if (g_list_find_custom
+                (dlist, &temp, (GCompareFunc) docked_list_compare))
+                /* These windows are already docked */
+                continue;
+
+            w = GTK_WINDOW(wnode->data);
+            gtk_window_get_position(w, &sx, &sy);
+            gtk_window_get_size(w, &sw, &sh);
+
+            nx = dw->offset_x + *off_x + x;
+            ny = dw->offset_y + *off_y + y;
+
+            snap(&nx, &ny, nw, nh, sx, sy, sw, sh);
+
+            *off_x += nx - (dw->offset_x + *off_x + x);
+            *off_y += ny - (dw->offset_y + *off_y + y);
+        }
+    }
+}
+
+
+static gboolean
+is_docked(gint a_x, gint a_y, gint a_w, gint a_h,
+          gint b_x, gint b_y, gint b_w, gint b_h)
+{
+    if (((a_x == b_x + b_w) || (a_x + a_w == b_x)) &&
+        (b_y + b_h >= a_y) && (b_y <= a_y + a_h))
+        return TRUE;
+
+    if (((a_y == b_y + b_h) || (a_y + a_h == b_y)) &&
+        (b_x >= a_x - b_w) && (b_x <= a_x + a_w))
+        return TRUE;
+
+    return FALSE;
+}
+
+/*
+ * Builds a list of all windows that are docked to the window "w".
+ * Recursively adds all windows that are docked to the windows that are
+ * docked to "w" and so on...
+ * FIXME: init_off_?  ?
+ */
+
+static GList *
+get_docked_list(GList * dlist, GList * wlist, GtkWindow * w,
+                gint init_off_x, gint init_off_y)
+{
+    GList *node;
+    DockedWindow *dwin, temp;
+    gint w_x, w_y, w_width, w_height;
+    gint t_x, t_y, t_width, t_height;
+
+
+    gtk_window_get_position(w, &w_x, &w_y);
+    gtk_window_get_size(w, &w_width, &w_height);
+    if (!dlist) {
+        dwin = g_new0(DockedWindow, 1);
+        dwin->w = w;
+        dlist = g_list_append(dlist, dwin);
+    }
+
+    for (node = wlist; node; node = g_list_next(node)) {
+        temp.w = node->data;
+        if (g_list_find_custom
+            (dlist, &temp, (GCompareFunc) docked_list_compare))
+            continue;
+
+        gtk_window_get_position(GTK_WINDOW(node->data), &t_x, &t_y);
+        gtk_window_get_size(GTK_WINDOW(node->data), &t_width, &t_height);
+        if (is_docked
+            (w_x, w_y, w_width, w_height, t_x, t_y, t_width, t_height)) {
+            dwin = g_new0(DockedWindow, 1);
+            dwin->w = node->data;
+
+            dwin->offset_x = t_x - w_x + init_off_x;
+            dwin->offset_y = t_y - w_y + init_off_y;
+
+            dlist = g_list_append(dlist, dwin);
+
+            dlist =
+                get_docked_list(dlist, wlist, dwin->w, dwin->offset_x,
+                                dwin->offset_y);
+        }
+    }
+    return dlist;
+}
+
+static void
+free_docked_list(GList * dlist)
+{
+    GList *node;
+
+    for (node = dlist; node; node = g_list_next(node))
+        g_free(node->data);
+    g_list_free(dlist);
+}
+
+static void
+docked_list_move(GList * list, gint x, gint y)
+{
+    GList *node;
+    DockedWindow *dw;
+
+    for (node = list; node; node = g_list_next(node)) {
+        dw = node->data;
+        gtk_window_move(dw->w, x + dw->offset_x, y + dw->offset_y);
+
+        SkinnedWindow *window = SKINNED_WINDOW(dw->w);
+        if (window) {
+            switch(window->type) {
+
+            case WINDOW_MAIN:
+                cfg.player_x = x + dw->offset_x;
+                cfg.player_y = y + dw->offset_y;
+                break;
+            case WINDOW_EQ:
+                cfg.equalizer_x = x + dw->offset_x;
+                cfg.equalizer_y = y + dw->offset_y;
+                break;
+            case WINDOW_PLAYLIST:
+                cfg.playlist_x = x + dw->offset_x;
+                cfg.playlist_y = y + dw->offset_y;
+                break;
+            }
+
+            window->x = x + dw->offset_x;
+            window->y = y + dw->offset_y;
+        }
+    }
+}
+
+static GList *
+shade_move_list(GList * list, GtkWindow * widget, gint offset)
+{
+    gint x, y, w, h;
+    GList *node;
+    DockedWindow *dw;
+
+    gtk_window_get_position(widget, &x, &y);
+    gtk_window_get_size(widget, &w, &h);
+
+
+    for (node = list; node;) {
+        gint dx, dy, dwidth, dheight;
+
+        dw = node->data;
+        gtk_window_get_position(dw->w, &dx, &dy);
+        gtk_window_get_size(dw->w, &dwidth, &dheight);
+        if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
+            ((dx + dwidth) > x && dx < (x + w))) {
+            list = g_list_remove_link(list, node);
+            g_list_free_1(node);
+
+            node = list = shade_move_list(list, dw->w, offset);
+        }
+        else
+            node = g_list_next(node);
+    }
+    gtk_window_move(widget, x, y + offset);
+    return list;
+}
+
+/*
+ * Builds a list of the windows in the list of DockedWindows "winlist"
+ * that are docked to the top or bottom of the window, and recursively
+ * adds all windows that are docked to the top or bottom of that window,
+ * and so on...
+ * Note: The data in "winlist" is not copied.
+ */
+static GList *
+find_shade_list(GtkWindow * widget, GList * winlist, GList * shade_list)
+{
+    gint x, y, w, h;
+    gint dx, dy, dwidth, dheight;
+    GList *node;
+
+    gtk_window_get_position(widget, &x, &y);
+    gtk_window_get_size(widget, &w, &h);
+    for (node = winlist; node; node = g_list_next(node)) {
+        DockedWindow *dw = node->data;
+        if (g_list_find_custom
+            (shade_list, dw, (GCompareFunc) docked_list_compare))
+            continue;
+        gtk_window_get_position(dw->w, &dx, &dy);
+        gtk_window_get_size(dw->w, &dwidth, &dheight);
+
+        /* FIXME. Is the is_docked() necessary? */
+        if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
+            ((dx + dwidth) > x && dx < (x + w))) {
+            shade_list = g_list_append(shade_list, dw);
+            shade_list = find_shade_list(dw->w, winlist, shade_list);
+        }
+    }
+    return shade_list;
+}
+
+void
+dock_window_resize(GtkWindow * widget, gint new_w, gint new_h, gint w, gint h)
+{
+    gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, MIN(w, new_w),
+                         MIN(h, new_h), MAX(w, new_w), MAX(h, new_h),
+                         GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
+    gdk_window_resize(GTK_WIDGET(widget)->window, new_w, new_h);
+    gdk_window_set_hints(GTK_WIDGET(widget)->window, 0, 0, new_w, new_h,
+                         new_w, new_h, GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
+}
+
+void
+dock_shade(GList * window_list, GtkWindow * widget, gint new_h)
+{
+    gint x, y, w, h, off_y, orig_off_y;
+    GList *node, *docked_list, *slist;
+    DockedWindow *dw;
+
+    gtk_window_get_position(widget, &x, &y);
+    gtk_window_get_size(widget, &w, &h);
+
+    if (cfg.show_wm_decorations) {
+        dock_window_resize(widget, w, new_h, w, h);
+        return;
+    }
+
+    docked_list = get_docked_list(NULL, window_list, widget, 0, 0);
+    slist = find_shade_list(widget, docked_list, NULL);
+
+    off_y = new_h - h;
+    do {
+        orig_off_y = off_y;
+        for (node = slist; node; node = g_list_next(node)) {
+            gint dx, dy, dwidth, dheight;
+
+            dw = node->data;
+            if (dw->w == widget)
+                continue;
+            gtk_window_get_position(dw->w, &dx, &dy);
+            gtk_window_get_size(dw->w, &dwidth, &dheight);
+            if ((dy >= y) && ((dy + off_y + dheight) > gdk_screen_height()))
+                off_y -= (dy + off_y + dheight) - gdk_screen_height();
+            else if ((dy >= y) && ((dy + dheight) == gdk_screen_height()))
+                off_y = 0;
+
+            if (((dy >= y) && ((dy + off_y) < 0)))
+                off_y -= dy + off_y;
+            if ((dy < y) && ((dy + (off_y - (new_h - h))) < 0))
+                off_y -= dy + (off_y - (new_h - h));
+        }
+    } while (orig_off_y != off_y);
+    if (slist) {
+        GList *mlist = g_list_copy(slist);
+
+        /* Remove this widget from the list */
+        for (node = mlist; node; node = g_list_next(node)) {
+            dw = node->data;
+            if (dw->w == widget) {
+                mlist = g_list_remove_link(mlist, node);
+                g_list_free_1(node);
+                break;
+            }
+        }
+        for (node = mlist; node;) {
+            GList *temp;
+            gint dx, dy, dwidth, dheight;
+
+            dw = node->data;
+
+            gtk_window_get_position(dw->w, &dx, &dy);
+            gtk_window_get_size(dw->w, &dwidth, &dheight);
+            /*
+             * Find windows that are directly docked to this window,
+             * move it, and any windows docked to that window again
+             */
+            if (is_docked(x, y, w, h, dx, dy, dwidth, dheight) &&
+                ((dx + dwidth) > x && dx < (x + w))) {
+                mlist = g_list_remove_link(mlist, node);
+                g_list_free_1(node);
+                if (dy > y)
+                    temp = shade_move_list(mlist, dw->w, off_y);
+                else if (off_y - (new_h - h) != 0)
+                    temp = shade_move_list(mlist, dw->w, off_y - (new_h - h));
+                else
+                    temp = mlist;
+                node = mlist = temp;
+            }
+            else
+                node = g_list_next(node);
+        }
+        g_list_free(mlist);
+    }
+    g_list_free(slist);
+    free_docked_list(docked_list);
+    gtk_window_move(widget, x, y + off_y - (new_h - h));
+    dock_window_resize(widget, w, new_h, w, h);
+}
+
+void
+dock_move_press(GList * window_list, GtkWindow * w,
+                GdkEventButton * event, gboolean move_list)
+{
+    gint mx, my;
+    DockedWindow *dwin;
+
+    if (cfg.show_wm_decorations)
+        return;
+
+    gtk_window_present(w);
+    mx = event->x;
+    my = event->y;
+    gtk_object_set_data(GTK_OBJECT(w), "move_offset_x", GINT_TO_POINTER(mx));
+    gtk_object_set_data(GTK_OBJECT(w), "move_offset_y", GINT_TO_POINTER(my));
+    if (move_list)
+        gtk_object_set_data(GTK_OBJECT(w), "docked_list",
+                            get_docked_list(NULL, window_list, w, 0, 0));
+    else {
+        dwin = g_new0(DockedWindow, 1);
+        dwin->w = w;
+        gtk_object_set_data(GTK_OBJECT(w), "docked_list",
+                            g_list_append(NULL, dwin));
+    }
+    gtk_object_set_data(GTK_OBJECT(w), "window_list", window_list);
+    gtk_object_set_data(GTK_OBJECT(w), "is_moving", GINT_TO_POINTER(1));
+}
+
+void
+dock_move_motion(GtkWindow * w, GdkEventMotion * event)
+{
+    gint offset_x, offset_y, x, y;
+    GList *dlist;
+    GList *window_list;
+
+    if (!gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
+        return;
+
+    offset_x =
+        GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_x"));
+    offset_y =
+        GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(w), "move_offset_y"));
+    dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list");
+    window_list = gtk_object_get_data(GTK_OBJECT(w), "window_list");
+
+    x = event->x_root - offset_x;
+    y = event->y_root - offset_y;
+
+    calc_snap_offset(dlist, window_list, x, y, &offset_x, &offset_y);
+    x += offset_x;
+    y += offset_y;
+
+    docked_list_move(dlist, x, y);
+}
+
+void
+dock_move_release(GtkWindow * w)
+{
+    GList *dlist;
+    gtk_object_remove_data(GTK_OBJECT(w), "is_moving");
+    gtk_object_remove_data(GTK_OBJECT(w), "move_offset_x");
+    gtk_object_remove_data(GTK_OBJECT(w), "move_offset_y");
+    if ((dlist = gtk_object_get_data(GTK_OBJECT(w), "docked_list")) != NULL)
+        free_docked_list(dlist);
+    gtk_object_remove_data(GTK_OBJECT(w), "docked_list");
+    gtk_object_remove_data(GTK_OBJECT(w), "window_list");
+}
+
+gboolean
+dock_is_moving(GtkWindow * w)
+{
+    if (gtk_object_get_data(GTK_OBJECT(w), "is_moving"))
+        return TRUE;
+    return FALSE;
+}
+
+GList *
+dock_add_window(GList * list, GtkWindow * window)
+{
+    return g_list_append(list, window);
+}
+
+GList *
+dock_remove_window(GList * list, GtkWindow * window)
+{
+    return g_list_remove(list, window);
+}
+
+GList *
+dock_window_set_decorated(GList * list, GtkWindow * window,
+                          gboolean decorated)
+{
+    if (gtk_window_get_decorated(window) == decorated)
+        return list;
+
+    if (decorated)
+        list = dock_remove_window(list, window);
+    else
+        list = dock_add_window(list, window);
+
+    gtk_window_set_decorated(window, decorated);
+
+    return list;
+}
+
+GList *
+get_dock_window_list() {
+    return dock_window_list;
+}
+
+void
+set_dock_window_list(GList * list) {
+    dock_window_list = list;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/audacious/ui_dock.h	Thu May 15 19:25:45 2008 +0200
@@ -0,0 +1,50 @@
+/*  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 <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 DOCK_H
+#define DOCK_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+void dock_set_uposition(GtkWindow * widget, gint x, gint y);
+GList *dock_add_window(GList * window_list, GtkWindow * window);
+GList *dock_remove_window(GList * window_list, GtkWindow * window);
+void dock_move_press(GList * window_list, GtkWindow * w,
+                     GdkEventButton * event, gboolean move_list);
+void dock_move_motion(GtkWindow * w, GdkEventMotion * event);
+void dock_move_release(GtkWindow * w);
+void dock_get_widget_pos(GtkWindow * w, gint * x, gint * y);
+gboolean dock_is_moving(GtkWindow * w);
+void dock_shade(GList * window_list, GtkWindow * widget, gint new_h);
+
+GList *dock_window_set_decorated(GList * list, GtkWindow * window,
+                                 gboolean decorated);
+void dock_window_resize(GtkWindow * widget, gint new_w, gint new_h, gint w, gint h);
+
+GList *get_dock_window_list();
+void set_dock_window_list(GList * list);
+
+#endif
--- a/src/audacious/ui_equalizer.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_equalizer.c	Thu May 15 19:25:45 2008 +0200
@@ -40,7 +40,6 @@
 
 #include "platform/smartinclude.h"
 #include "ui_skin.h"
-#include "dock.h"
 #include "input.h"
 #include "main.h"
 #include "ui_manager.h"
@@ -56,6 +55,7 @@
 
 #include "images/audacious_eq.xpm"
 
+#include "ui_dock.h"
 #include "ui_skinned_window.h"
 #include "ui_skinned_button.h"
 #include "ui_skinned_horizontal_slider.h"
--- a/src/audacious/ui_jumptotrack.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_jumptotrack.c	Thu May 15 19:25:45 2008 +0200
@@ -59,12 +59,12 @@
 #include "main.h"
 
 #include "dnd.h"
-#include "dock.h"
 #include "input.h"
 #include "playback.h"
 #include "playlist.h"
 #include "pluginenum.h"
 #include "ui_credits.h"
+#include "ui_dock.h"
 #include "ui_equalizer.h"
 #include "ui_fileopener.h"
 #include "ui_manager.h"
--- a/src/audacious/ui_main.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_main.c	Thu May 15 19:25:45 2008 +0200
@@ -54,7 +54,6 @@
 #include "actions-mainwin.h"
 #include "configdb.h"
 #include "dnd.h"
-#include "dock.h"
 #include "input.h"
 #include "main.h"
 #include "playback.h"
@@ -62,6 +61,7 @@
 #include "pluginenum.h"
 #include "strings.h"
 #include "ui_credits.h"
+#include "ui_dock.h"
 #include "ui_equalizer.h"
 #include "ui_fileinfo.h"
 #include "ui_fileopener.h"
--- a/src/audacious/ui_main_evlisteners.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_main_evlisteners.c	Thu May 15 19:25:45 2008 +0200
@@ -29,12 +29,16 @@
 #include "playlist_evmessages.h"
 #include "visualization.h"
 
+#include "ui_credits.h"
+#include "ui_equalizer.h"
+#include "ui_fileopener.h"
+#include "ui_jumptotrack.h"
 #include "ui_main.h"
-#include "ui_equalizer.h"
+#include "ui_playlist.h"
+#include "ui_preferences.h"
 #include "ui_skinned_playstatus.h"
 #include "ui_skinned_textbox.h"
 #include "ui_skinned_window.h"
-#include "ui_playlist.h"
 
 static gint song_info_timeout_source = 0;
 static gint update_vis_timeout_source = 0;
@@ -178,6 +182,9 @@
 ui_main_evlistener_playlist_end_reached(gpointer hook_data, gpointer user_data)
 {
     mainwin_clear_song_info();
+
+    if (cfg.stopaftersong)
+        mainwin_set_stopaftersong(FALSE);
 }
 
 static void
@@ -191,6 +198,71 @@
 }
 
 static void
+ui_main_evlistener_mainwin_set_always_on_top(gpointer hook_data, gpointer user_data)
+{
+    gboolean *ontop = (gboolean*)hook_data;
+    mainwin_set_always_on_top(*ontop);
+}
+
+static void
+ui_main_evlistener_mainwin_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    mainwin_show(*show);
+}
+
+static void
+ui_main_evlistener_equalizerwin_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    equalizerwin_show(*show);
+}
+
+static void
+ui_main_evlistener_prefswin_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    if (*show == TRUE)
+        show_prefs_window();
+    else
+        hide_prefs_window();
+}
+
+static void
+ui_main_evlistener_aboutwin_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    if (*show == TRUE)
+        show_about_window();
+    else
+        hide_about_window();
+}
+
+
+static void
+ui_main_evlistener_ui_jump_to_track_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    if (*show == TRUE)
+        ui_jump_to_track();
+    else
+        ui_jump_to_track_hide();
+}
+
+static void
+ui_main_evlistener_filebrowser_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *play_button = (gboolean*)hook_data;
+    run_filebrowser(*play_button);
+}
+
+static void
+ui_main_evlistener_filebrowser_hide(gpointer hook_data, gpointer user_data)
+{
+    hide_filebrowser();
+}
+
+static void
 ui_main_evlistener_config_save(gpointer hook_data, gpointer user_data)
 {
     ConfigDb *db = (ConfigDb *) hook_data;
@@ -221,6 +293,14 @@
     hook_associate("playback play file", ui_main_evlistener_playback_play_file, NULL);
     hook_associate("playlist end reached", ui_main_evlistener_playlist_end_reached, NULL);
     hook_associate("playlist info change", ui_main_evlistener_playlist_info_change, NULL);
+    hook_associate("mainwin set always on top", ui_main_evlistener_mainwin_set_always_on_top, NULL);
+    hook_associate("mainwin show", ui_main_evlistener_mainwin_show, NULL);
+    hook_associate("equalizerwin show", ui_main_evlistener_equalizerwin_show, NULL);
+    hook_associate("prefswin show", ui_main_evlistener_prefswin_show, NULL);
+    hook_associate("aboutwin show", ui_main_evlistener_aboutwin_show, NULL);
+    hook_associate("ui jump to track show", ui_main_evlistener_ui_jump_to_track_show, NULL);
+    hook_associate("filebrowser show", ui_main_evlistener_filebrowser_show, NULL);
+    hook_associate("filebrowser hide", ui_main_evlistener_filebrowser_hide, NULL);
     hook_associate("config save", ui_main_evlistener_config_save, NULL);
 }
 
--- a/src/audacious/ui_playlist.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_playlist.c	Thu May 15 19:25:45 2008 +0200
@@ -41,13 +41,13 @@
 
 #include "actions-playlist.h"
 #include "dnd.h"
-#include "dock.h"
 #include "input.h"
 #include "main.h"
 #include "playback.h"
 #include "playlist.h"
 #include "playlist_container.h"
 #include "strings.h"
+#include "ui_dock.h"
 #include "ui_equalizer.h"
 #include "ui_fileinfo.h"
 #include "ui_fileopener.h"
--- a/src/audacious/ui_playlist_evlisteners.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_playlist_evlisteners.c	Thu May 15 19:25:45 2008 +0200
@@ -37,8 +37,18 @@
     playlist_manager_update();
 }
 
+static void
+ui_playlist_evlistener_playlistwin_show(gpointer hook_data, gpointer user_data)
+{
+    gboolean *show = (gboolean*)hook_data;
+    if (*show == TRUE)
+        playlistwin_show();
+    else
+        playlistwin_hide();
+}
+
 void ui_playlist_evlistener_init(void)
 {
-    hook_associate("playlist update",
-                   ui_playlist_evlistener_playlist_update, NULL);
+    hook_associate("playlist update", ui_playlist_evlistener_playlist_update, NULL);
+    hook_associate("playlistwin show", ui_playlist_evlistener_playlistwin_show, NULL);
 }
--- a/src/audacious/ui_skin.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_skin.c	Thu May 15 19:25:45 2008 +0200
@@ -2075,8 +2075,8 @@
     g_return_if_fail(obj != NULL);
 
     if (scale) {
-        GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * cfg.scale_factor, height* cfg.scale_factor, GDK_INTERP_BILINEAR);
-        gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * cfg.scale_factor , height * cfg.scale_factor, GDK_RGB_DITHER_NORMAL, 0, 0);
+        GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * cfg.scale_factor, height* cfg.scale_factor, GDK_INTERP_NEAREST);
+        gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * cfg.scale_factor , height * cfg.scale_factor, GDK_RGB_DITHER_NONE, 0, 0);
         g_object_unref(image);
     } else {
         gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0);
--- a/src/audacious/ui_skinned_cursor.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_skinned_cursor.c	Thu May 15 19:25:45 2008 +0200
@@ -27,7 +27,7 @@
 #include <gtk/gtkwindow.h>
 
 #include "main.h"
-#include "dock.h"
+#include "ui_dock.h"
 #include "ui_skinned_window.h"
 #include "ui_skinned_cursor.h"
 
--- a/src/audacious/ui_skinned_window.c	Thu May 15 19:25:29 2008 +0200
+++ b/src/audacious/ui_skinned_window.c	Thu May 15 19:25:45 2008 +0200
@@ -29,7 +29,7 @@
 #include <string.h>
 
 #include "main.h"
-#include "dock.h"
+#include "ui_dock.h"
 #include "ui_skinned_window.h"
 #include "ui_skinned_cursor.h"
 #include "ui_playlist.h"