[Goodies-commits] r2067 - in xfce4-xmms-plugin/trunk: . panel-plugin pixmaps

Tomohisa Iwanabe gaso at xfce.org
Sat Sep 23 16:08:53 CEST 2006


Author: gaso
Date: 2006-09-23 14:08:40 +0000 (Sat, 23 Sep 2006)
New Revision: 2067

Added:
   xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.c
   xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.h
   xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.c
   xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.h
   xfce4-xmms-plugin/trunk/panel-plugin/preferences.c
   xfce4-xmms-plugin/trunk/panel-plugin/preferences.h
   xfce4-xmms-plugin/trunk/pixmaps/xmms-plugin-menu.png
Modified:
   xfce4-xmms-plugin/trunk/ChangeLog
   xfce4-xmms-plugin/trunk/configure.in.in
   xfce4-xmms-plugin/trunk/panel-plugin/Makefile.am
   xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.c
   xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.h
   xfce4-xmms-plugin/trunk/pixmaps/Makefile.am
Log:
Split source file. Add new features, please see ChangeLog.

Modified: xfce4-xmms-plugin/trunk/ChangeLog
===================================================================
--- xfce4-xmms-plugin/trunk/ChangeLog	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/ChangeLog	2006-09-23 14:08:40 UTC (rev 2067)
@@ -1,3 +1,12 @@
+2006-09-23 gaso <ganchang_mrlbr at ybb.ne.jp>
+
+	* split panel-plugin/xmms_plugin.c into panel-plugin/xmms_plugin.c and
+	  panel-plugin/preferences.c
+	* loading libraries has changed to dynamic loading by using gmodule and
+	  remove --with-player option from configure script 
+	* add Audacious support
+	* add menu button for popupmenu
+
 2006-09-12 Kemal Ilgar Eroglu <kieroglu at math.washington.edu>
 
 	* Version 0.4.2

Modified: xfce4-xmms-plugin/trunk/configure.in.in
===================================================================
--- xfce4-xmms-plugin/trunk/configure.in.in	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/configure.in.in	2006-09-23 14:08:40 UTC (rev 2067)
@@ -7,8 +7,8 @@
 
 dnl version info
 m4_define([xfce4_xmms_version_major], [0])
-m4_define([xfce4_xmms_version_minor], [4])
-m4_define([xfce4_xmms_version_micro], [2])
+m4_define([xfce4_xmms_version_minor], [5])
+m4_define([xfce4_xmms_version_micro], [0])
 m4_define([xfce4_xmms_version_build], [@REVISION@])
 m4_define([xfce4_xmms_version_tag], [svn])
 m4_define([xfce4_xmms_version], [xfce4_xmms_version_major().xfce4_xmms_version_minor().xfce4_xmms_version_micro()ifelse(xfce4_xmms_version_tag(), [svn], [xfce4_xmms_version_tag()-xfce4_xmms_version_build()], [xfce4_xmms_version_tag()])])
@@ -46,6 +46,7 @@
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.20])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.3.0])
 XDT_CHECK_PACKAGE([PANGO], [pango], [1.8.0])
+XDT_CHECK_PACKAGE([GMODULE], [gmodule-2.0], [2.4.0])
 
 dnl Set PACKAGE_LOCALE_DIR in config.h.
 if test "x${prefix}" = "xNONE"; then
@@ -61,33 +62,33 @@
 dnl PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 3.8.0, CAIRO_LIBS = CAIRO_L, AC_MSG_RESULT())
 
 dnl check for player
-AC_MSG_CHECKING([what player to link with])
-AC_ARG_WITH([player], [  --with-player=xmms/beep Specify player to link with [default=xmms]])
-if test x"$with_player" == x"beep"; then
-  AC_MSG_RESULT([Beep media player])
-  XDT_CHECK_PACKAGE([PLAYER], [beep], [0.9.6.0])
-
-  PLAYER_CFLAGS="$PLAYER_CFLAGS -DPLAYER_COMMAND=\\\"beep-media-player\\\" -DPLAYER_BEEP"
-else
-  AC_MSG_RESULT([XMMS media player])
-
-  AC_CHECK_PROGS([XMMS_CONFIG], [xmms-config], [no])
-  if test x"$XMMS_CONFIG" == x"no"; then
-    AC_MSG_ERROR([*** XMMS not found. Please install XMMS first. ***])
-  fi
-
-  AC_MSG_CHECKING([PLAYER_CFLAGS])
-  PLAYER_CFLAGS=`$XMMS_CONFIG --cflags`
-  AC_MSG_RESULT([$PLAYER_CFLAGS])
-
-  AC_MSG_CHECKING([PLAYER_LIBS])
-  PLAYER_LIBS=`$XMMS_CONFIG --libs`
-  AC_MSG_RESULT([$PLAYER_LIBS])
-
-  PLAYER_CFLAGS="$PLAYER_CFLAGS -DPLAYER_COMMAND=\\\"xmms\\\" -DPLAYER_XMMS"
-fi
-AC_SUBST([PLAYER_CFLAGS])
-AC_SUBST([PLAYER_LIBS])
+dnl AC_MSG_CHECKING([what player to link with])
+dnl AC_ARG_WITH([player], [  --with-player=xmms/beep Specify player to link with [default=xmms]])
+dnl if test x"$with_player" == x"beep"; then
+dnl   AC_MSG_RESULT([Beep media player])
+dnl   XDT_CHECK_PACKAGE([PLAYER], [beep], [0.9.6.0])
+dnl 
+dnl   PLAYER_CFLAGS="$PLAYER_CFLAGS -DPLAYER_COMMAND=\\\"beep-media-player\\\" -DPLAYER_BEEP"
+dnl else
+dnl   AC_MSG_RESULT([XMMS media player])
+dnl 
+dnl   AC_CHECK_PROGS([XMMS_CONFIG], [xmms-config], [no])
+dnl   if test x"$XMMS_CONFIG" == x"no"; then
+dnl     AC_MSG_ERROR([*** XMMS not found. Please install XMMS first. ***])
+dnl   fi
+dnl 
+dnl   AC_MSG_CHECKING([PLAYER_CFLAGS])
+dnl   PLAYER_CFLAGS=`$XMMS_CONFIG --cflags`
+dnl   AC_MSG_RESULT([$PLAYER_CFLAGS])
+dnl 
+dnl   AC_MSG_CHECKING([PLAYER_LIBS])
+dnl   PLAYER_LIBS=`$XMMS_CONFIG --libs`
+dnl   AC_MSG_RESULT([$PLAYER_LIBS])
+dnl 
+dnl   PLAYER_CFLAGS="$PLAYER_CFLAGS -DPLAYER_COMMAND=\\\"xmms\\\" -DPLAYER_XMMS"
+dnl fi
+dnl AC_SUBST([PLAYER_CFLAGS])
+dnl AC_SUBST([PLAYER_LIBS])
 AC_SUBST([CAIRO_CFLAGS])
 AC_SUBST([CAIRO_LIBS])
 

Modified: xfce4-xmms-plugin/trunk/panel-plugin/Makefile.am
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/Makefile.am	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/panel-plugin/Makefile.am	2006-09-23 14:08:40 UTC (rev 2067)
@@ -3,7 +3,13 @@
 
 xfce4_xmms_plugin_SOURCES = 						\
 		xmms_plugin.h						\
-		xmms_plugin.c
+		xmms_plugin.c \
+		popupmenu.h \
+		popupmenu.c \
+		preferences.h \
+		preferences.c \
+		playerctrl.h \
+		playerctrl.c
 
 xfce4_xmms_plugin_CFLAGS =						\
 	-I$(top_srcdir) 						\
@@ -13,15 +19,15 @@
 	-DLOCALEDIR=\"$(localedir)\" 					\
 	-DDATA_DIR=\"$(datadir)/xfce4/xfce4-xmms-plugin\"		\
 	@CAIRO_CFLAGS@							\
-	@PLAYER_CFLAGS@
+	@GMODULE_CFLAGS@
 
 xfce4_xmms_plugin_LDFLAGS =						\
 	@LIBXFCE4PANEL_LIBS@ 						\
 	@LIBXFCE4UTIL_LIBS@ 						\
-	@LIBXFCEGUI4_LIBS@
+	@LIBXFCEGUI4_LIBS@ \
+	@GMODULE_LIBS@
 	
 xfce4_xmms_plugin_LDADD = 						\
-	@PLAYER_LIBS@							\
 	@CAIRO_LIBS@
 
 desktop_in_in_files = xfce4-xmms-plugin.desktop.in.in

Added: xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.c
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.c	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.c	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,245 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <gmodule.h>
+
+#include "playerctrl.h"
+
+/**
+ * playerctrl.c
+ * This is wrapper functions for XMMS API.
+ * It enables dynamic loading of the player's library
+ */
+
+gchar * player_control_get_command(Players id) {
+	gchar *cmdstr;
+	switch (id) {
+		case PLAYER_XMMS:
+			cmdstr = CMD_XMMS;
+			break;
+		case PLAYER_BEEP:
+			cmdstr = CMD_BEEP;
+			break;
+		case PLAYER_AUDACIOUS:
+			cmdstr = CMD_AUDACIOUS;
+			break;
+		default:
+			return NULL;
+			break;
+	}
+	return cmdstr;
+}
+
+PlayerCtrl * player_control_get_instance(Players id) {
+	gchar *libname;
+	switch (id) {
+		case PLAYER_XMMS:
+			libname = LIB_XMMS;
+			break;
+		case PLAYER_BEEP:
+			libname = LIB_BEEP;
+			break;
+		case PLAYER_AUDACIOUS:
+			libname = LIB_AUDACIOUS;
+			break;
+		default:
+			return NULL;
+			break;
+	}
+	return player_control_load_library(libname);
+}
+
+void player_control_close(PlayerCtrl *instance) {
+	if (instance->library)
+		g_module_close(instance->library);
+	g_free(instance);
+}
+
+gboolean player_control_has_library(gchar *libname) {
+	GModule *library;
+	gchar *filename;
+
+	filename = g_module_build_path(NULL, libname);
+	library = g_module_open(filename, G_MODULE_BIND_LAZY);
+	g_free(filename);
+
+	if (library) {
+		g_module_close(library);
+		return TRUE;
+	} else {
+		return FALSE;
+	}
+}
+
+PlayerCtrl * player_control_load_library(gchar *libname) {
+	PlayerCtrl *instance;
+	gchar *filename;
+
+	instance = g_new0(PlayerCtrl, 1);
+
+	filename = g_module_build_path(NULL, libname);
+	instance->library = g_module_open(filename, G_MODULE_BIND_LAZY);
+	g_free(filename);
+
+	if (! instance->library)
+		return NULL;
+
+	/********************* start binding *********************/
+
+	g_module_symbol(instance->library, "xmms_remote_playlist",
+			(gpointer *) &instance->player_playlist);
+	g_module_symbol(instance->library, "xmms_remote_get_version",
+			(gpointer *) &instance->player_get_version);
+	g_module_symbol(instance->library, "xmms_remote_playlist_add",
+			(gpointer *) &instance->player_playlist_add);
+	g_module_symbol(instance->library, "xmms_remote_playlist_delete",
+			(gpointer *) &instance->player_playlist_delete);
+	g_module_symbol(instance->library, "xmms_remote_play",
+			(gpointer *) &instance->player_play);
+	g_module_symbol(instance->library, "xmms_remote_pause",
+			(gpointer *) &instance->player_pause);
+	g_module_symbol(instance->library, "xmms_remote_stop",
+			(gpointer *) &instance->player_stop);
+	g_module_symbol(instance->library, "xmms_remote_is_playing",
+			(gpointer *) &instance->player_is_playing);
+	g_module_symbol(instance->library, "xmms_remote_is_paused",
+			(gpointer *) &instance->player_is_paused);
+	g_module_symbol(instance->library, "xmms_remote_get_playlist_pos",
+			(gpointer *) &instance->player_get_playlist_pos);
+	g_module_symbol(instance->library, "xmms_remote_set_playlist_pos",
+			(gpointer *) &instance->player_set_playlist_pos);
+	g_module_symbol(instance->library, "xmms_remote_get_playlist_length",
+			(gpointer *) &instance->player_get_playlist_length);
+	g_module_symbol(instance->library, "xmms_remote_playlist_clear",
+			(gpointer *) &instance->player_playlist_clear);
+	g_module_symbol(instance->library, "xmms_remote_get_output_time",
+			(gpointer *) &instance->player_get_output_time);
+	g_module_symbol(instance->library, "xmms_remote_jump_to_time",
+			(gpointer *) &instance->player_jump_to_time);
+	g_module_symbol(instance->library, "xmms_remote_get_volume",
+			(gpointer *) &instance->player_get_volume);
+	g_module_symbol(instance->library, "xmms_remote_get_main_volume",
+			(gpointer *) &instance->player_get_main_volume);
+	g_module_symbol(instance->library, "xmms_remote_get_balance",
+			(gpointer *) &instance->player_get_balance);
+	g_module_symbol(instance->library, "xmms_remote_set_volume",
+			(gpointer *) &instance->player_set_volume);
+	g_module_symbol(instance->library, "xmms_remote_set_main_volume",
+			(gpointer *) &instance->player_set_main_volume);
+	g_module_symbol(instance->library, "xmms_remote_set_balance",
+			(gpointer *) &instance->player_set_balance);
+	g_module_symbol(instance->library, "xmms_remote_get_skin",
+			(gpointer *) &instance->player_get_skin);
+	g_module_symbol(instance->library, "xmms_remote_set_skin",
+			(gpointer *) &instance->player_set_skin);
+	g_module_symbol(instance->library, "xmms_remote_get_playlist_file",
+			(gpointer *) &instance->player_get_playlist_file);
+	g_module_symbol(instance->library, "xmms_remote_get_playlist_title",
+			(gpointer *) &instance->player_get_playlist_title);
+	g_module_symbol(instance->library, "xmms_remote_get_playlist_time",
+			(gpointer *) &instance->player_get_playlist_time);
+	g_module_symbol(instance->library, "xmms_remote_get_info",
+			(gpointer *) &instance->player_get_info);
+	g_module_symbol(instance->library, "xmms_remote_main_win_toggle",
+			(gpointer *) &instance->player_main_win_toggle);
+	g_module_symbol(instance->library, "xmms_remote_pl_win_toggle",
+			(gpointer *) &instance->player_pl_win_toggle);
+	g_module_symbol(instance->library, "xmms_remote_eq_win_toggle",
+			(gpointer *) &instance->player_eq_win_toggle);
+	g_module_symbol(instance->library, "xmms_remote_is_main_win",
+			(gpointer *) &instance->player_is_main_win);
+	g_module_symbol(instance->library, "xmms_remote_is_pl_win",
+			(gpointer *) &instance->player_is_pl_win);
+	g_module_symbol(instance->library, "xmms_remote_is_eq_win",
+			(gpointer *) &instance->player_is_eq_win);
+	g_module_symbol(instance->library, "xmms_remote_show_prefs_box",
+			(gpointer *) &instance->player_show_prefs_box);
+	g_module_symbol(instance->library, "xmms_remote_toggle_aot",
+			(gpointer *) &instance->player_toggle_aot);
+	g_module_symbol(instance->library, "xmms_remote_eject",
+			(gpointer *) &instance->player_eject);
+	g_module_symbol(instance->library, "xmms_remote_playlist_prev",
+			(gpointer *) &instance->player_playlist_prev);
+	g_module_symbol(instance->library, "xmms_remote_playlist_next",
+			(gpointer *) &instance->player_playlist_next);
+	g_module_symbol(instance->library, "xmms_remote_playlist_add_url_string",
+			(gpointer *) &instance->player_playlist_add_url_string);
+	g_module_symbol(instance->library, "xmms_remote_is_running",
+			(gpointer *) &instance->player_is_running);
+	g_module_symbol(instance->library, "xmms_remote_toggle_repeat",
+			(gpointer *) &instance->player_toggle_repeat);
+	g_module_symbol(instance->library, "xmms_remote_toggle_shuffle",
+			(gpointer *) &instance->player_toggle_shuffle);
+	g_module_symbol(instance->library, "xmms_remote_is_repeat",
+			(gpointer *) &instance->player_is_repeat);
+	g_module_symbol(instance->library, "xmms_remote_is_shuffle",
+			(gpointer *) &instance->player_is_shuffle);
+	g_module_symbol(instance->library, "xmms_remote_get_eq",
+			(gpointer *) &instance->player_get_eq);
+	g_module_symbol(instance->library, "xmms_remote_get_eq_preamp",
+			(gpointer *) &instance->player_get_eq_preamp);
+	g_module_symbol(instance->library, "xmms_remote_get_eq_band",
+			(gpointer *) &instance->player_get_eq_band);
+	g_module_symbol(instance->library, "xmms_remote_set_eq",
+			(gpointer *) &instance->player_set_eq);
+	g_module_symbol(instance->library, "xmms_remote_set_eq_preamp",
+			(gpointer *) &instance->player_set_eq_preamp);
+	g_module_symbol(instance->library, "xmms_remote_set_eq_band",
+			(gpointer *) &instance->player_set_eq_band);
+	/* Added in XMMS 1.2.1 */
+	g_module_symbol(instance->library, "xmms_remote_quit",
+			(gpointer *) &instance->player_quit);
+	/* Added in XMMS 1.2.6 */
+	g_module_symbol(instance->library, "xmms_remote_play_pause",
+			(gpointer *) &instance->player_play_pause);
+	g_module_symbol(instance->library, "xmms_remote_playlist_ins_url_string",
+			(gpointer *) &instance->player_playlist_ins_url_string);
+	/* Added in XMMS 1.2.11 */
+	g_module_symbol(instance->library, "xmms_remote_playqueue_add",
+			(gpointer *) &instance->player_playqueue_add);
+	g_module_symbol(instance->library, "xmms_remote_playqueue_remove",
+			(gpointer *) &instance->player_playqueue_remove);
+	g_module_symbol(instance->library, "xmms_remote_get_playqueue_length",
+			(gpointer *) &instance->player_get_playqueue_length);
+	g_module_symbol(instance->library, "xmms_remote_toggle_advance",
+			(gpointer *) &instance->player_toggle_advance);
+	g_module_symbol(instance->library, "xmms_remote_is_advance",
+			(gpointer *) &instance->player_is_advance);
+	/* Added in BMP 0.9.7 */
+	g_module_symbol(instance->library, "xmms_remote_activate",
+			(gpointer *) &instance->player_activate);
+	/* Added in Audacious 1.1 */
+	g_module_symbol(instance->library, "xmms_remote_show_jtf_box",
+			(gpointer *) &instance->player_show_jtf_box);
+	g_module_symbol(instance->library, "xmms_remote_playqueue_clear",
+			(gpointer *) &instance->player_playqueue_clear);
+	g_module_symbol(instance->library, "xmms_remote_playqueue_is_queued",
+			(gpointer *) &instance->player_playqueue_is_queued);
+	g_module_symbol(instance->library, "xmms_remote_get_playqueue_position",
+			(gpointer *) &instance->player_get_playqueue_position);
+	g_module_symbol(instance->library, "xmms_remote_get_playqueue_queue_position",
+			(gpointer *) &instance->player_get_playqueue_queue_position);
+
+	/********************* end binding *********************/
+	
+	return instance;
+}
+
+/* <Leader>ere (create binding codes)
+File.open("/usr/include/audacious/beepctrl.h") {|file|
+	buf = ""
+	file.each() {|line|
+		case line
+		when /\s*.+(xmms_remote.+)\(.+/
+			print "g_module_symbol(instance->library, \"#{$1}\","
+			print "(gpointer *) &instance->player#{$1[11..-1]});"
+		when /\/\*.*\*\//
+			print(line.strip)
+		end
+	}
+}
+*/

Added: xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.h
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.h	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/playerctrl.h	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,237 @@
+#ifndef PLAYERCTRL_H
+#define PLAYERCTRL_H
+
+#include <glib.h>
+
+#define LIB_XMMS "xmms"
+#define LIB_BEEP "beep"
+#define LIB_AUDACIOUS "audacious"
+
+#define CMD_XMMS "xmms"
+#define CMD_BEEP "beep-media-player"
+#define CMD_AUDACIOUS "audacious"
+
+/**
+ * used to player_control_load_library()
+ */
+typedef enum {
+	PLAYER_XMMS,
+	PLAYER_BEEP,
+	PLAYER_AUDACIOUS
+} Players;
+
+// define functions
+typedef void  (* _player_playlist) (gint session, gchar ** list, gint num, gboolean enqueue);
+typedef gint  (* _player_get_version) (gint session);
+typedef void  (* _player_playlist_add) (gint session, GList * list);
+typedef void  (* _player_playlist_delete) (gint session, gint pos);
+typedef void  (* _player_play) (gint session);
+typedef void  (* _player_pause) (gint session);
+typedef void  (* _player_stop) (gint session);
+typedef gboolean  (* _player_is_playing) (gint session);
+typedef gboolean  (* _player_is_paused) (gint session);
+typedef gint  (* _player_get_playlist_pos) (gint session);
+typedef void  (* _player_set_playlist_pos) (gint session, gint pos);
+typedef gint  (* _player_get_playlist_length) (gint session);
+typedef void  (* _player_playlist_clear) (gint session);
+typedef gint  (* _player_get_output_time) (gint session);
+typedef void  (* _player_jump_to_time) (gint session, gint pos);
+typedef void  (* _player_get_volume) (gint session, gint * vl, gint * vr);
+typedef gint  (* _player_get_main_volume) (gint session);
+typedef gint  (* _player_get_balance) (gint session);
+typedef void  (* _player_set_volume) (gint session, gint vl, gint vr);
+typedef void  (* _player_set_main_volume) (gint session, gint v);
+typedef void  (* _player_set_balance) (gint session, gint b);
+typedef gchar * (* _player_get_skin) (gint session);
+typedef void  (* _player_set_skin) (gint session, gchar * skinfile);
+typedef gchar * (* _player_get_playlist_file) (gint session, gint pos);
+typedef gchar * (* _player_get_playlist_title) (gint session, gint pos);
+typedef gint  (* _player_get_playlist_time) (gint session, gint pos);
+typedef void  (* _player_get_info) (gint session, gint * rate, gint * freq, gint * nch);
+typedef void  (* _player_main_win_toggle) (gint session, gboolean show);
+typedef void  (* _player_pl_win_toggle) (gint session, gboolean show);
+typedef void  (* _player_eq_win_toggle) (gint session, gboolean show);
+typedef gboolean  (* _player_is_main_win) (gint session);
+typedef gboolean  (* _player_is_pl_win) (gint session);
+typedef gboolean  (* _player_is_eq_win) (gint session);
+typedef void  (* _player_show_prefs_box) (gint session);
+typedef void  (* _player_toggle_aot) (gint session, gboolean ontop);
+typedef void  (* _player_eject) (gint session);
+typedef void  (* _player_playlist_prev) (gint session);
+typedef void  (* _player_playlist_next) (gint session);
+typedef void  (* _player_playlist_add_url_string) (gint session, gchar * string);
+typedef gboolean  (* _player_is_running) (gint session);
+typedef void  (* _player_toggle_repeat) (gint session);
+typedef void  (* _player_toggle_shuffle) (gint session);
+typedef gboolean  (* _player_is_repeat) (gint session);
+typedef gboolean  (* _player_is_shuffle) (gint session);
+typedef void  (* _player_get_eq) (gint session, gfloat * preamp, gfloat ** bands);
+typedef gfloat  (* _player_get_eq_preamp) (gint session);
+typedef gfloat  (* _player_get_eq_band) (gint session, gint band);
+typedef void  (* _player_set_eq) (gint session, gfloat preamp, gfloat * bands);
+typedef void  (* _player_set_eq_preamp) (gint session, gfloat preamp);
+typedef void  (* _player_set_eq_band) (gint session, gint band, gfloat value);
+/* Added in XMMS 1.2.1 */
+typedef void  (* _player_quit) (gint session);
+/* Added in XMMS 1.2.6 */
+typedef void  (* _player_play_pause) (gint session);
+typedef void  (* _player_playlist_ins_url_string) (gint session, gchar * string, gint pos);
+/* Added in XMMS 1.2.11 */
+typedef void  (* _player_playqueue_add) (gint session, gint pos);
+typedef void  (* _player_playqueue_remove) (gint session, gint pos);
+typedef gint  (* _player_get_playqueue_length) (gint session);
+typedef void  (* _player_toggle_advance) (gint session);
+typedef gboolean  (* _player_is_advance) (gint session);
+/* Added in BMP 0.9.7 */
+typedef void  (* _player_activate) (gint session);
+/* Added in Audacious 1.1 */
+typedef void  (* _player_show_jtf_box) (gint session);
+typedef void  (* _player_playqueue_clear) (gint session);
+typedef gboolean  (* _player_playqueue_is_queued) (gint session, gint pos);
+typedef gint  (* _player_get_playqueue_position) (gint session, gint pos);
+typedef gint  (* _player_get_playqueue_queue_position) (gint session, gint pos);
+
+/**
+ * player control functions
+ * filled by zero if a player not support specific function
+ * @see xmmsctrl.h or beepctrl.h
+ */
+typedef struct {
+	/** internally used. do not use directory */
+	GModule *library;
+
+	// functions
+	_player_playlist player_playlist;
+	_player_get_version player_get_version;
+	_player_playlist_add player_playlist_add;
+	_player_playlist_delete player_playlist_delete;
+	_player_play player_play;
+	_player_pause player_pause;
+	_player_stop player_stop;
+	_player_is_playing player_is_playing;
+	_player_is_paused player_is_paused;
+	_player_get_playlist_pos player_get_playlist_pos;
+	_player_set_playlist_pos player_set_playlist_pos;
+	_player_get_playlist_length player_get_playlist_length;
+	_player_playlist_clear player_playlist_clear;
+	_player_get_output_time player_get_output_time;
+	_player_jump_to_time player_jump_to_time;
+	_player_get_volume player_get_volume;
+	_player_get_main_volume player_get_main_volume;
+	_player_get_balance player_get_balance;
+	_player_set_volume player_set_volume;
+	_player_set_main_volume player_set_main_volume;
+	_player_set_balance player_set_balance;
+	_player_get_skin player_get_skin;
+	_player_set_skin player_set_skin;
+	_player_get_playlist_file player_get_playlist_file;
+	_player_get_playlist_title player_get_playlist_title;
+	_player_get_playlist_time player_get_playlist_time;
+	_player_get_info player_get_info;
+	_player_main_win_toggle player_main_win_toggle;
+	_player_pl_win_toggle player_pl_win_toggle;
+	_player_eq_win_toggle player_eq_win_toggle;
+	_player_is_main_win player_is_main_win;
+	_player_is_pl_win player_is_pl_win;
+	_player_is_eq_win player_is_eq_win;
+	_player_show_prefs_box player_show_prefs_box;
+	_player_toggle_aot player_toggle_aot;
+	_player_eject player_eject;
+	_player_playlist_prev player_playlist_prev;
+	_player_playlist_next player_playlist_next;
+	_player_playlist_add_url_string player_playlist_add_url_string;
+	_player_is_running player_is_running;
+	_player_toggle_repeat player_toggle_repeat;
+	_player_toggle_shuffle player_toggle_shuffle;
+	_player_is_repeat player_is_repeat;
+	_player_is_shuffle player_is_shuffle;
+	_player_get_eq player_get_eq;
+	_player_get_eq_preamp player_get_eq_preamp;
+	_player_get_eq_band player_get_eq_band;
+	_player_set_eq player_set_eq;
+	_player_set_eq_preamp player_set_eq_preamp;
+	_player_set_eq_band player_set_eq_band;
+	/* Added in XMMS 1.2.1 */
+	_player_quit player_quit;
+	/* Added in XMMS 1.2.6 */
+	_player_play_pause player_play_pause;
+	_player_playlist_ins_url_string player_playlist_ins_url_string;
+	/* Added in XMMS 1.2.11 */
+	_player_playqueue_add player_playqueue_add;
+	_player_playqueue_remove player_playqueue_remove;
+	_player_get_playqueue_length player_get_playqueue_length;
+	_player_toggle_advance player_toggle_advance;
+	_player_is_advance player_is_advance;
+	/* Added in BMP 0.9.7 */
+	_player_activate player_activate;
+	/* Added in Audacious 1.1 */
+	_player_show_jtf_box player_show_jtf_box;
+	_player_playqueue_clear player_playqueue_clear;
+	_player_playqueue_is_queued player_playqueue_is_queued;
+	_player_get_playqueue_position player_get_playqueue_position;
+	_player_get_playqueue_queue_position player_get_playqueue_queue_position;
+} PlayerCtrl;
+
+/**
+ * get command name from ID
+ */
+gchar * player_control_get_command(Players id);
+
+/**
+ * load library from ID
+ * @return returns NULL if library is not found
+ */
+PlayerCtrl * player_control_get_instance(Players id);
+
+/**
+ * unload library
+ * must call this function after using PlayerCtrl instance
+ * @see player_control_get_instance(), player_control_load_library()
+ */
+void player_control_close(PlayerCtrl *instance);
+
+/**
+ * check whether a library is exist or not
+ */
+gboolean player_control_has_library(gchar *libname);
+
+/**
+ * load library
+ * @param lib_name player library name (Eg. "xmms", "beep", "audacious")
+ * @return returns NULL if library is not found
+ */
+PlayerCtrl * player_control_load_library(gchar *libname);
+
+#endif
+
+/* <Leader>ere (create struct members)
+File.open("/usr/include/audacious/beepctrl.h") {|file|
+	buf = ""
+	file.each() {|line|
+		case line
+		when /\s*.+(xmms_remote.+)\(.+/
+			print "_player#{$1[11..-1]} player#{$1[11..-1]};"
+		when /\/\*.*\*\//
+			print(line.strip)
+		end
+	}
+}
+*/
+
+/* <Leader>ere (create typedefs)
+File.open("/usr/include/audacious/beepctrl.h") {|file|
+buf = ""
+	file.each() {|line|
+		case line
+		when /\s*(.+)(xmms_remote.+)(\(.+\);)/
+			print "typedef #{$1} (* _player#{$2[11..-1]}) #{$3}"
+		when /\s*(.+)(xmms_.+)(\(.+)/
+			buf = "typedef #{$1} (* _player#{$2[11..-1]}) #{$3}"
+		when /\);/
+			print buf + " " + line.strip
+		when /\/\*.*\*\//
+			print(line.strip)
+		end
+	}
+}
+*/

Added: xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.c
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.c	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.c	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,310 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdarg.h>
+
+#include <gtk/gtk.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "popupmenu.h"
+#include "xmms_plugin.h"
+#include "playerctrl.h"
+
+/* file chooser dialog  */
+
+enum {
+	RESPONSE_OPEN,	/// Open button
+	RESPONSE_ADD	/// Add button
+};
+
+static void file_chooser_response_cb(GtkDialog *dialog, gint code, gpointer data) {
+	GSList *list, *li;
+	gchar *uri;
+	plugin_data *pd = (plugin_data *)data;
+
+	if (code == RESPONSE_OPEN || code == RESPONSE_ADD) {
+		list = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(dialog));
+		for (li = list; li != NULL; li = g_slist_next(li)) {
+			uri = (gchar *)li->data;
+			pd->pctrl->player_playlist_add_url_string(pd->xmms_session, uri);
+			g_free(uri);
+		}
+		g_slist_free(list);
+	}
+
+	if (code == RESPONSE_ADD)
+		return;
+
+	gtk_widget_destroy(GTK_WIDGET(dialog));
+}
+
+/**
+ * @param name displayed label
+ * @param ... mimetype or pattern (gchar *)
+ */
+static void add_file_filter(GtkFileChooser *chooser, gchar *name, ...) {
+	GtkFileFilter *filter;
+	va_list ap;
+	gchar *mask;
+
+	filter = gtk_file_filter_new();
+	gtk_file_filter_set_name(filter, name);
+
+	va_start(ap, name);
+	while ((mask = va_arg(ap, gchar *)) != NULL) {
+		if (g_strrstr(mask, "/") != NULL)
+			gtk_file_filter_add_mime_type(filter, mask);
+		else
+			gtk_file_filter_add_pattern(filter, mask);
+	}
+	va_end(ap);
+	
+	gtk_file_chooser_add_filter(chooser, filter);
+}
+
+/* callback funcs */
+
+/**
+ * show add files dialog
+ */
+static void show_file_chooser(GtkWidget *widget, gpointer data) {
+	static GtkWidget * dialog = NULL;
+	GtkFileFilter *filter;
+	plugin_data *pd = (plugin_data *) data;
+
+	if (! pd->pctrl->player_is_running(pd->xmms_session))
+		return;
+
+	if (GTK_IS_WINDOW(dialog)) {
+		gtk_window_present(GTK_WINDOW(dialog));
+		return;
+	}
+
+	dialog = gtk_file_chooser_dialog_new(_("Add files"), NULL,
+			GTK_FILE_CHOOSER_ACTION_OPEN,
+			GTK_STOCK_OPEN, RESPONSE_OPEN,
+			GTK_STOCK_ADD, RESPONSE_ADD,
+			GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
+			NULL);
+	gtk_window_set_skip_taskbar_hint(GTK_WINDOW(dialog), TRUE);
+	gtk_window_set_skip_pager_hint(GTK_WINDOW(dialog), TRUE);
+	gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), TRUE);
+	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), g_get_home_dir());
+	
+	add_file_filter(GTK_FILE_CHOOSER(dialog), _("Audio files"), "audio/*", NULL);
+	add_file_filter(GTK_FILE_CHOOSER(dialog), _("Playlist files"), "*.m3u", "*.pls", NULL);
+	add_file_filter(GTK_FILE_CHOOSER(dialog), _("All files"), "*", NULL);
+
+	g_signal_connect(G_OBJECT(dialog), "response",
+			G_CALLBACK(file_chooser_response_cb), pd);
+	gtk_widget_show(dialog);
+}
+
+/*
+static void show_open_file(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_eject(pd->xmms_session);
+}
+*/
+
+/**
+ * open xmms preference window
+ */
+static void show_xmms_preferences(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_show_prefs_box(pd->xmms_session);
+}
+
+/**
+ * crear current playlist
+ */
+static void clear_playlist(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_playlist_clear(pd->xmms_session);
+}
+
+/**
+ * startup xmms
+ */
+static void exec_xmms(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	
+	exec_command(player_control_get_command(pd->player));
+}
+
+/**
+ * shutdown xmms
+ */
+static void quit_xmms(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_quit(pd->xmms_session);
+}
+
+/**
+ * toggle repeat state
+ */
+static void toggle_repeat(GtkCheckMenuItem *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_toggle_repeat(pd->xmms_session);
+}
+
+/**
+ * toggle shuffle state
+ */
+static void toggle_shuffle(GtkCheckMenuItem *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_toggle_shuffle(pd->xmms_session);
+}
+
+/**
+ * toggle main window visibility
+ */
+static void toggle_main_win(GtkCheckMenuItem *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_main_win_toggle(pd->xmms_session,
+			! pd->pctrl->player_is_main_win(pd->xmms_session));
+}
+
+/**
+ * toggle playlist window visibility
+ */
+static void toggle_pl_win(GtkCheckMenuItem *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_pl_win_toggle(pd->xmms_session,
+			! pd->pctrl->player_is_pl_win(pd->xmms_session));
+}
+
+/**
+ * toggle equalizer window visibility
+ */
+static void toggle_eq_win(GtkCheckMenuItem *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_eq_win_toggle(pd->xmms_session,
+			! pd->pctrl->player_is_eq_win(pd->xmms_session));
+}
+
+/**
+ * show "Jump to File" dialog
+ */
+static void show_jtf_box(GtkWidget *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_show_jtf_box(pd->xmms_session);
+}
+
+/**
+ * selection-done callback
+ */
+static void destroy_popupmenu(GtkWidget *widget, gpointer data) {
+	gtk_widget_destroy(widget);
+}
+
+
+/* menu creation */
+
+/**
+ * create a image item
+ * @param label label with mnemonic char
+ * @param stock_id GtkStockItem ID
+ * @param data must be plugin_data
+ * @see http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html
+ */
+static void
+add_image_item_from_stock(GtkWidget *menu, gchar *label, const gchar *stock_id, GCallback cb, gpointer data) {
+	GtkWidget *mi, *img;
+	mi = gtk_image_menu_item_new_with_mnemonic(label);
+	img = gtk_image_new_from_stock(stock_id, GTK_ICON_SIZE_MENU);
+	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mi), img);
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+	g_signal_connect(G_OBJECT(mi), "activate", cb, data);
+	gtk_widget_show(mi);
+}
+
+/**
+ * create a check item
+ * @param label label with mnemonic char
+ * @param data must be plugin_data
+ */
+static void
+add_check_item(GtkWidget *menu, gchar *label, gboolean active, GCallback cb, gpointer data) {
+	GtkWidget *mi = gtk_check_menu_item_new_with_mnemonic(label);
+	gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mi), active);
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+	g_signal_connect(G_OBJECT(mi), "toggled", cb, data);
+	gtk_widget_show(mi);
+}
+
+/**
+ * create popupmenu
+ * this menu is automatically destroyed when selection is done.
+ * @return popupmenu widget
+ */
+GtkWidget * create_popupmenu(plugin_data *pd) {
+	GtkWidget *menu, *submenu, *mi, *img;
+
+	menu = gtk_menu_new();
+	gtk_widget_show(menu);
+	g_signal_connect(G_OBJECT(menu), "selection-done",
+			G_CALLBACK(destroy_popupmenu), NULL);
+
+	// add files button
+	add_image_item_from_stock(menu, _("_Add files"), GTK_STOCK_OPEN,
+			G_CALLBACK(show_file_chooser), pd);
+
+	// jtf button (audacious 1.1)
+	if (pd->pctrl->player_show_jtf_box)
+		add_image_item_from_stock(menu, _("_Jump to File"), GTK_STOCK_JUMP_TO,
+				G_CALLBACK(show_jtf_box), pd);
+
+	// clear pl button
+	add_image_item_from_stock(menu, _("_Clear Playlist"), GTK_STOCK_CLEAR,
+			G_CALLBACK(clear_playlist), pd);
+
+	// repeate button
+	add_check_item(menu, _("_Repeat"), pd->pctrl->player_is_repeat(pd->xmms_session),
+			G_CALLBACK(toggle_repeat), pd);
+
+	// shuffle button
+	add_check_item(menu, _("_Shuffle"), pd->pctrl->player_is_shuffle(pd->xmms_session),
+			G_CALLBACK(toggle_shuffle), pd);
+
+	// view menu
+	submenu = gtk_menu_new();
+	gtk_widget_show(submenu);
+
+	// main window button
+	add_check_item(submenu, _("_Main Window"), pd->pctrl->player_is_main_win(pd->xmms_session),
+			G_CALLBACK(toggle_main_win), pd);
+	
+	// playlist button
+	add_check_item(submenu, _("_Playlist"), pd->pctrl->player_is_pl_win(pd->xmms_session),
+			G_CALLBACK(toggle_pl_win), pd);
+
+	// equalizer button
+	add_check_item(submenu, _("_Equalizer"), pd->pctrl->player_is_eq_win(pd->xmms_session),
+			G_CALLBACK(toggle_eq_win), pd);
+
+	mi = gtk_menu_item_new_with_mnemonic(_("_View"));
+	gtk_menu_item_set_submenu(GTK_MENU_ITEM(mi), submenu);
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+	gtk_widget_show(mi);
+
+	// separator
+	mi = gtk_separator_menu_item_new();
+	gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+	gtk_widget_show(mi);
+
+	// preference button
+	add_image_item_from_stock(menu, _("_Preferences"), GTK_STOCK_PREFERENCES,
+			G_CALLBACK(show_xmms_preferences), pd);
+
+	if (pd->pctrl->player_is_running(pd->xmms_session))
+		add_image_item_from_stock(menu, _("Power _Off"), GTK_STOCK_QUIT,
+				G_CALLBACK(quit_xmms), pd);
+	else
+		add_image_item_from_stock(menu, _("Power _On"), GTK_STOCK_EXECUTE,
+				G_CALLBACK(exec_xmms), pd);
+
+	return menu;
+}

Added: xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.h
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.h	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/popupmenu.h	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,16 @@
+#ifndef POPUPMENU_H
+#define POPUPMENU_H
+
+#include <gtk/gtk.h>
+
+#include "xmms_plugin.h"
+#include "playerctrl.h"
+
+/**
+ * create popupmenu
+ * this menu is automatically destroyed when selection is done.
+ * @return popupmenu widget
+ */
+GtkWidget * create_popupmenu(plugin_data *pd);
+
+#endif

Added: xfce4-xmms-plugin/trunk/panel-plugin/preferences.c
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/preferences.c	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/preferences.c	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,526 @@
+/*
+ * Copyright (c) 2003 Patrick van Staveren <pvanstav at cs.wmich.edu>
+ * Copyright (c) 2005 Kemal Ilgar Eroglu <kieroglu at math.washington.edu>
+ * Copyright (c) 2005 Mario Streiber <mario.streiber at gmx.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+
+#include <libxfce4util/libxfce4util.h>
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+#include "preferences.h"
+#include "xmms_plugin.h"
+#include "playerctrl.h"
+
+
+/************************************/
+/* callback to change the font size */
+/************************************/
+static void set_font_size(GtkSpinButton *spin, gpointer data) {
+	plugin_data *pd     = (plugin_data*) data;
+	PangoAttrSize *attr = (PangoAttrSize*) pd->labelattr;
+	pd->titletextsize   = gtk_spin_button_get_value_as_int(spin);
+
+	if (pd->titletextsize < MIN_TITLE_SIZE) pd->titletextsize = 1;
+	if (pd->titletextsize > MAX_TITLE_SIZE) pd->titletextsize = MAX_TITLE_SIZE;
+	attr->size = pd->titletextsize * PANGO_SCALE;
+	gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
+	gtk_widget_hide(pd->viewport);
+	gtk_widget_show(pd->viewport);
+}
+
+
+/***************************************/
+/* callback to change the scroll speed */
+/***************************************/
+static void set_scroll_speed(GtkSpinButton *spin, gpointer data) {
+	plugin_data *pd  = (plugin_data*) data;
+	pd->scroll_speed = gtk_spin_button_get_value_as_int(spin);
+
+	if (pd->scroll_speed < MIN_SCROLL_SPEED) pd->scroll_speed = MIN_SCROLL_SPEED;
+	if (pd->scroll_speed > MAX_SCROLL_SPEED) pd->scroll_speed = MAX_SCROLL_SPEED;
+	pd->timer_reset = TRUE;
+}
+
+
+/********************************************/
+/* callback to change the scroll step width */
+/********************************************/
+static void set_scroll_step(GtkSpinButton *spin, gpointer data) {
+	plugin_data *pd             = (plugin_data*) data;
+	gint s                      = gtk_spin_button_get_value_as_int(spin);
+
+	if (s < MIN_SCROLL_STEP) s  = MIN_SCROLL_STEP;
+	if (s > MAX_SCROLL_STEP) s  = MAX_SCROLL_STEP;
+	pd->scroll_step = s;
+	if (s == 0) pd->title_scroll_position = 0;
+}
+
+
+/***************************************/
+/* callback to change the scroll delay */
+/***************************************/
+static void set_scroll_delay(GtkSpinButton *spin, gpointer data) {
+	plugin_data *pd             = (plugin_data*) data;
+	gint d                      = gtk_spin_button_get_value_as_int(spin);
+
+	if (d < MIN_SCROLL_DELAY) d = MIN_SCROLL_DELAY;
+	if (d > MAX_SCROLL_DELAY) d = MAX_SCROLL_DELAY;
+	pd->scroll_delay            = d;
+	pd->step_delay              = d * pd->scroll_speed * pd->scroll_step;
+	pd->title_scroll_position   = 0;
+}
+
+
+/***************************************************************/
+/* callback to toggle the visibility of the scrolled songtitle */
+/***************************************************************/
+static void show_title(GtkToggleButton *check, gpointer data) {
+	plugin_data *pd             = (plugin_data*) data;
+	pd->show_scrolledtitle      = gtk_toggle_button_get_active(check);
+
+	/* show/hide the event box parent of the scrolled title */
+	if (pd->show_scrolledtitle)   gtk_widget_show_all(pd->viewport);
+	else                          gtk_widget_hide_all(pd->viewport);
+}
+
+
+/***************************************/
+/* callback to change quit xmms option */
+/***************************************/
+static void quit_xmms_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd = (plugin_data*) data;
+	pd->quit_xmms   = gtk_toggle_button_get_active(button);
+}
+
+
+/******************************************/
+/* callback to change simple title option */
+/******************************************/
+static void simple_title_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd    = (plugin_data*) data;
+	pd->simple_title   = gtk_toggle_button_get_active(button);
+	set_song_title(pd);
+}
+
+/*********************************************************/
+/* callback for show track postion (pbar_visible) option */
+/*********************************************************/
+static void pbar_visible_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd   = (plugin_data*) data;
+	pd->pbar_visible  = gtk_toggle_button_get_active(button);
+
+	if(pd->pbar_visible)
+		gtk_widget_show_all (pd->pbar);
+	else
+		gtk_widget_hide_all (pd->pbar);
+}
+
+/******************************************************/
+/* callback for show volume (vol_pbar_visible) option */
+/******************************************************/
+static void vol_pbar_visible_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd        = (plugin_data*) data;
+	pd->vol_pbar_visible   = gtk_toggle_button_get_active(button);
+
+	if(pd->vol_pbar_visible)
+		gtk_widget_show_all (pd->vol_pbar);
+	else
+		gtk_widget_hide_all (pd->vol_pbar);
+}
+
+/********************************************/
+/* callback for "hor_vol_if_vertical" option */
+/*********************************************/
+static void hor_vol_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd  = (plugin_data*) data;
+	pd->hor_vol_if_vertical   = gtk_toggle_button_get_active(button);
+	adjust_vol_pbar(pd);
+}
+
+/**
+ * callback for "Show menu button" option
+ */
+static void menu_btn_visible_toggled(GtkToggleButton *button, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	pd->menu_btn_visible = gtk_toggle_button_get_active(button);
+
+	if (pd->menu_btn_visible)
+		gtk_widget_show(pd->menu_btn);
+	else
+		gtk_widget_hide(pd->menu_btn);
+}
+
+/**
+ * callback for "Media Player" option
+ */
+static void player_selection_changed(GtkComboBox *widget, gpointer data) {
+	plugin_data *pd = (plugin_data *) data;
+	GtkTreeIter iter;
+	GValue val = {0};
+
+	gtk_combo_box_get_active_iter(widget, &iter);
+	gtk_tree_model_get_value(gtk_combo_box_get_model(widget), &iter, 0, &val);
+	pd->player = g_value_get_int(&val);
+	g_value_unset(&val);
+	player_control_close(pd->pctrl);
+	pd->pctrl = player_control_get_instance(pd->player);
+}
+
+/*****************************************************/
+/* add label to the left column of the options table */
+/*****************************************************/
+static void add_label(GtkWidget *table, gchar *text, gint pos) {
+	gint att_opts               = GTK_SHRINK | GTK_EXPAND | GTK_FILL;
+	GtkWidget *label            = gtk_label_new(text);
+
+	gtk_misc_set_alignment        (GTK_MISC(label), 0.0, 0.5);
+	gtk_table_attach              (GTK_TABLE(table), label, 0, 1, pos, pos+1, att_opts, att_opts, 0, 0);
+}
+
+
+/*************************************************************/
+/* add spin button to the right columns of the options table */
+/*************************************************************/
+static void add_spin(GtkWidget *table, gint min, gint max, gint value, GCallback cb, gpointer data, gint pos) {
+	gint att_opts               = GTK_SHRINK/* | GTK_EXPAND | GTK_FILL*/;
+	GtkWidget *spin             = gtk_spin_button_new_with_range(min, max, 1.0);
+
+	gtk_spin_button_set_value     (GTK_SPIN_BUTTON(spin), value);
+	gtk_table_attach              (GTK_TABLE(table), spin, 1, 2, pos, pos+1, att_opts, att_opts, 0, 0);
+	g_signal_connect              (G_OBJECT(spin), "value-changed", cb, data);
+}
+
+/********************/
+/* add check button */
+/********************/
+static void add_check(GtkWidget *parent, gchar *title, gboolean active, GCallback cb, gpointer data, const char* tip_title) {
+	GtkWidget *check            = gtk_check_button_new_with_label(title);
+
+	gtk_toggle_button_set_active  (GTK_TOGGLE_BUTTON(check), active);
+	gtk_box_pack_start            (GTK_BOX(parent), check, DOEXPAND, DOFILL, PADDING);
+	if(tip_title)
+		gtk_tooltips_set_tip    (((plugin_data *) data)->tooltip, check, tip_title, NULL);
+	g_signal_connect              (G_OBJECT(check), "toggled", cb, data);
+}
+
+/**
+ * add media player selection combo box
+ */
+static void add_player_selection_box(GtkWidget *parent, plugin_data *pd) {
+	GtkListStore *store;
+	GtkTreeIter iter, a_iter;
+	GtkCellRenderer *renderer;
+	GtkWidget *combo, *ebox;
+
+	store = gtk_list_store_new(2, G_TYPE_INT, G_TYPE_STRING);
+	combo = gtk_combo_box_new_with_model(GTK_TREE_MODEL(store));
+	g_signal_connect(G_OBJECT(combo), "changed",
+			G_CALLBACK(player_selection_changed), pd);
+
+	// invisible column stores player ID
+	renderer = gtk_cell_renderer_text_new();
+	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
+	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 0, NULL);
+	g_object_set (renderer, "visible", FALSE, NULL);
+
+	// player name column
+	renderer = gtk_cell_renderer_text_new();
+	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combo), renderer, FALSE);
+	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo), renderer, "text", 1, NULL);
+
+	// add items
+	if (player_control_has_library("xmms")) {
+		gtk_list_store_append(store, &iter);
+		gtk_list_store_set(store, &iter, 0, PLAYER_XMMS, 1, "XMMS", -1);
+		if (pd->player == PLAYER_XMMS)
+			gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
+	}
+	if (player_control_has_library("beep")) {
+		gtk_list_store_append(store, &iter);
+		gtk_list_store_set(store, &iter, 0, PLAYER_BEEP, 1, "BeepMediaPlayer", -1);
+		if (pd->player == PLAYER_BEEP)
+			gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
+	}
+	if (player_control_has_library("audacious")) {
+		gtk_list_store_append(store, &iter);
+		gtk_list_store_set(store, &iter, 0, PLAYER_AUDACIOUS, 1, "Audacious", -1);
+		if (pd->player == PLAYER_AUDACIOUS)
+			gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo), &iter);
+	}
+
+	ebox = gtk_event_box_new();
+	gtk_tooltips_set_tip(pd->tooltip, ebox, _(
+				"Notice:\n"
+				"Do not change this property from XMMS or BeepMediaPlayer to the other one when either one of these is running. It will crash because they use same socket address. For the same reason, you cannot run the other player when this plugin is running."), NULL);
+	gtk_container_add(GTK_CONTAINER(ebox), combo);
+	gtk_widget_show(combo);
+	gtk_box_pack_start(GTK_BOX(parent), ebox, DOEXPAND, DOFILL, PADDING);
+	gtk_widget_show(ebox);
+}
+
+/***************************/
+/* options dialog response */
+/***************************/
+static void
+options_dialog_response (GtkWidget *dlg, int reponse, plugin_data *pd)
+{
+	gtk_widget_destroy (dlg);
+	xfce_panel_plugin_unblock_menu (pd->base);
+	xmms_plugin_write_config(pd->base,pd);
+}
+
+/**********************/
+/* preferences dialog */
+/**********************/
+void xmms_plugin_create_options (XfcePanelPlugin *plugin, plugin_data *pd) {
+
+	GtkWidget *vbox, *table, *label, *size, *speed, *step, *delay, *hbox;
+	gint att_opts = GTK_SHRINK | GTK_EXPAND | GTK_FILL;
+
+	GtkWidget *dlg, *header;
+
+
+	gtk_tooltips_disable(pd->tooltip);
+	gtk_tooltips_enable(pd->tooltip);
+
+	xfce_panel_plugin_block_menu (plugin);
+
+	dlg = gtk_dialog_new_with_buttons (_("Properties"), 
+			GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
+			GTK_DIALOG_DESTROY_WITH_PARENT |
+			GTK_DIALOG_NO_SEPARATOR,
+			GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+			NULL);
+
+	g_signal_connect (dlg, "response", G_CALLBACK (options_dialog_response),
+			pd);
+
+	gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
+
+	header = xfce_create_header (NULL, _("Xfce4 XMMS Plugin Options"));
+	gtk_widget_set_size_request (GTK_BIN (header)->child, 200, 32);
+	gtk_container_set_border_width (GTK_CONTAINER (header), 6);
+	gtk_widget_show (header);
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header,
+			FALSE, TRUE, 0);
+
+	vbox  = gtk_vbox_new      (FALSE, 4);
+	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox,
+			FALSE, TRUE, 0);
+
+	/* media player selection */
+	hbox = gtk_hbox_new(FALSE, 6);
+	label = gtk_label_new(_("Media Player"));
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, PADDING);
+	add_player_selection_box(hbox, pd);
+	gtk_box_pack_start(GTK_BOX(vbox), hbox, DOEXPAND, DOFILL, PADDING);
+
+	/* separator */
+	gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), DOEXPAND, DOFILL, PADDING);
+
+	table = gtk_table_new     (4, 2, FALSE);
+
+	/* add table */
+	gtk_box_pack_start        (GTK_BOX(vbox), table, DOEXPAND, DOFILL, PADDING);
+
+	/* put labels into the left column of our table */
+	add_label(table, _("Font Size"),        0);
+	add_label(table, _("Scroll Speed"),     1);
+	add_label(table, _("Scroll Stepwidth"), 2);
+	add_label(table, _("Scroll Delay"),     3);
+
+	/* put spin buttons into the right column */
+	add_spin(table, MIN_TITLE_SIZE,   MAX_TITLE_SIZE,   pd->titletextsize, G_CALLBACK(set_font_size),    pd, 0);
+	add_spin(table, MIN_SCROLL_SPEED, MAX_SCROLL_SPEED, pd->scroll_speed,  G_CALLBACK(set_scroll_speed), pd, 1);
+	add_spin(table, MIN_SCROLL_STEP,  MAX_SCROLL_STEP,  pd->scroll_step,   G_CALLBACK(set_scroll_step),  pd, 2);
+	add_spin(table, MIN_SCROLL_DELAY, MAX_SCROLL_DELAY, pd->scroll_delay,  G_CALLBACK(set_scroll_delay), pd, 3);
+
+	/*new separator*/
+	gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), DOEXPAND, DOFILL, PADDING);
+
+	/* add check buttons for the scrolled title, progressbar and volume bar */
+	add_check(vbox, _("Show scrolled song title"), pd->show_scrolledtitle, G_CALLBACK(show_title), pd, NULL);
+	add_check(vbox, _("Show track position"), pd->pbar_visible, G_CALLBACK(pbar_visible_toggled), pd, NULL);
+	add_check(vbox, _("Show volume level"), pd->vol_pbar_visible, G_CALLBACK(vol_pbar_visible_toggled), pd, NULL);
+	/* add check button for show menu button option */
+	add_check(vbox, _("Show menu button"), pd->menu_btn_visible,
+			G_CALLBACK(menu_btn_visible_toggled), pd, NULL);
+	/* add check button for simple title option */
+	add_check(vbox, _("Simple song title format"), pd->simple_title, G_CALLBACK(simple_title_toggled), pd, NULL);
+	/* add check button for hor_vol_if_vertical option */
+	add_check(vbox, _("Horizontal volume bar"), 
+			pd->hor_vol_if_vertical, G_CALLBACK(hor_vol_toggled), pd, NULL);  
+	/* add check button for quit xmms option */
+	add_check(vbox, _("Quit the player when plugin terminates"), pd->quit_xmms, G_CALLBACK(quit_xmms_toggled), pd, NULL);
+
+	gtk_widget_show_all(GTK_WIDGET(dlg));
+
+}
+
+/*
+ * Store/Restore preferences
+ */
+
+/**************************/
+/* read plugin parameters */
+/**************************/
+void xmms_plugin_read_config(plugin_data *pd) {
+
+	XfceRc *rc;
+	char *file;
+	gint n;
+
+	if ((file = xfce_panel_plugin_lookup_rc_file (pd->base)) != NULL)
+	{
+		rc = xfce_rc_simple_open (file, TRUE);
+		g_free (file);
+
+		if (rc != NULL)
+		{
+			/* load title font size */
+			n = xfce_rc_read_int_entry (rc,"textsize",10);
+			if ((n >= MIN_TITLE_SIZE) && (n <= MAX_TITLE_SIZE))
+				pd->titletextsize = n;
+
+			/* load scroll speed */
+			n = xfce_rc_read_int_entry (rc, "scroll_speed",5);
+			if ((n >= MIN_SCROLL_SPEED) && (n <= MAX_SCROLL_SPEED)) {
+				pd->scroll_speed = n;
+				pd->timer_reset = TRUE;
+			}
+
+			/* load scroll step width */
+			n = xfce_rc_read_int_entry (rc,"scroll_step", 2);
+			if ((n >= MIN_SCROLL_STEP) && (n <= MAX_SCROLL_STEP)) pd->scroll_step = n;
+
+			/* load scroll delay */
+			n = xfce_rc_read_int_entry (rc,"scroll_delay", 0);
+			if ((n >= MIN_SCROLL_DELAY) && (n <= MAX_SCROLL_DELAY)) pd->scroll_delay = n;
+
+			/* load xmms window visibility */
+			pd->xmmsvisible = xfce_rc_read_bool_entry (rc, "xmms_visible", TRUE);
+
+			/* load visibility of scrolled sing title */
+			pd->show_scrolledtitle = xfce_rc_read_bool_entry (rc, "title_visible", TRUE);
+
+			/* load quit xmms option */
+			pd->quit_xmms = xfce_rc_read_bool_entry (rc, "quit_xmms", FALSE);
+
+			/* load simple title option */
+			pd->simple_title = xfce_rc_read_bool_entry (rc, "simple_title", TRUE);
+
+			/* load progressbar visibility option */
+			pd->pbar_visible = xfce_rc_read_bool_entry (rc, "pbar_visible", TRUE);
+
+
+			/* load volume progressbar visibility option */
+			pd->vol_pbar_visible =xfce_rc_read_bool_entry(rc,"vol_pbar_visible",TRUE);   	  
+
+			/* load horizontal volume bar if vertical panel option */
+			pd->hor_vol_if_vertical = 
+				xfce_rc_read_bool_entry (rc, "hor_vol_if_vertical",TRUE);
+
+			/* load show menu button option*/
+			pd->menu_btn_visible = xfce_rc_read_bool_entry(rc, "menu_btn_visible", TRUE);
+
+			/* load player option */
+			n = xfce_rc_read_int_entry(rc, "player", PLAYER_XMMS);
+			if ((n >= PLAYER_XMMS) && (n <= PLAYER_AUDACIOUS))
+				pd->player = n;
+
+			xfce_rc_close(rc);
+		}	
+
+	}
+
+}
+
+
+/**************************/
+/* save plugin parameters */
+/**************************/
+void xmms_plugin_write_config(XfcePanelPlugin *plugin, plugin_data *pd) {
+
+	XfceRc *rc;
+	char *file;
+
+	g_return_if_fail(plugin!=NULL);
+
+	if (!(file = xfce_panel_plugin_save_location (plugin, TRUE)))
+		return;
+
+	rc = xfce_rc_simple_open (file, FALSE);
+	g_free (file);
+
+	if (!rc)
+		return;
+
+
+	/* save title font size */
+	xfce_rc_write_int_entry (rc,"textsize",pd->titletextsize);
+
+	/* save scroll speed */
+	xfce_rc_write_int_entry (rc, "scroll_speed",pd->scroll_speed);
+
+	/* save scroll step width */
+	xfce_rc_write_int_entry (rc,"scroll_step", pd->scroll_step);
+
+	/* save scroll delay */
+	xfce_rc_write_int_entry (rc,"scroll_delay", pd->scroll_delay);
+
+	/* save xmms window visibility */
+	xfce_rc_write_bool_entry (rc, "xmms_visible", pd->xmmsvisible);
+
+	/* save visibility of scrolled sing title */
+	xfce_rc_write_bool_entry (rc, "title_visible", pd->show_scrolledtitle);
+
+	/* save quit xmms option */
+	xfce_rc_write_bool_entry (rc, "quit_xmms", pd->quit_xmms);
+
+	/* save simple title option */
+	xfce_rc_write_bool_entry (rc, "simple_title", pd->simple_title);
+
+	/* save progressbar visibility option */
+	xfce_rc_write_bool_entry (rc, "pbar_visible", pd->pbar_visible);  
+
+	/* save volume progressbar visibility option */
+	xfce_rc_write_bool_entry (rc, "vol_pbar_visible", pd->vol_pbar_visible);  
+
+	/* save horizontal volume bar if vertical panel option */
+	xfce_rc_write_bool_entry (rc, "hor_vol_if_vertical", pd->hor_vol_if_vertical);
+
+	/* save show menu button option */
+	xfce_rc_write_bool_entry(rc, "menu_btn_visible", pd->menu_btn_visible);
+
+	/* save player option */
+	xfce_rc_write_int_entry(rc, "player", pd->player);
+
+	xfce_rc_close(rc);   
+}

Added: xfce4-xmms-plugin/trunk/panel-plugin/preferences.h
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/preferences.h	                        (rev 0)
+++ xfce4-xmms-plugin/trunk/panel-plugin/preferences.h	2006-09-23 14:08:40 UTC (rev 2067)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2003 Patrick van Staveren <pvanstav at cs.wmich.edu>
+ * Copyright (c) 2005 Kemal Ilgar Eroglu <kieroglu at math.washington.edu>
+ * Copyright (c) 2005 Mario Streiber <mario.streiber at gmx.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PREFERENCES_H
+#define PREFERENCES_H
+
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+#include "xmms_plugin.h"
+
+/**
+ * callback for "configure-plugin" signal
+ */
+void xmms_plugin_create_options(XfcePanelPlugin *plugin, plugin_data *pd);
+
+/**
+ * restore params to plugin_data struct
+ */
+void xmms_plugin_read_config(plugin_data *pd);
+
+/**
+ * callback for "save" signal
+ */
+void xmms_plugin_write_config(XfcePanelPlugin *plugin, plugin_data *pd);
+
+#endif

Modified: xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.c
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.c	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.c	2006-09-23 14:08:40 UTC (rev 2067)
@@ -39,12 +39,13 @@
 /*#include <panel/plugins.h>
 #include <panel/xfce.h>*/
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/xfce_iconbutton.h>
+#include <libxfcegui4/libxfcegui4.h>
 #include <libxfce4panel/xfce-panel-plugin.h>
 
-#include <xmmsctrl.h>
-
 #include "xmms_plugin.h"
+#include "popupmenu.h"
+#include "preferences.h"
+#include "playerctrl.h"
 
 gboolean xmms_plugin_control_new(XfcePanelPlugin *plugin);
 XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL(xmms_plugin_control_new);
@@ -53,45 +54,59 @@
 /* xmms_control.c */
 /******************/
 
+
 /**************************************/
 /* displays or hides the xmms windows */
 /**************************************/
 static void display_xmms(plugin_data *pd, gboolean show) {
-  /* do nothing if xmms is not running */
-  if (!xmms_remote_is_running(pd->xmms_session)) return;
+	/* do nothing if xmms is not running */
+	if (!pd->pctrl->player_is_running(pd->xmms_session)) return;
 
-  if (show) {
-    /* display xmms windows based on their prior status */
-    if (pd->show_mw) xmms_remote_main_win_toggle(pd->xmms_session, TRUE);
-    if (pd->show_pl) xmms_remote_pl_win_toggle  (pd->xmms_session, TRUE);
-    if (pd->show_eq) xmms_remote_eq_win_toggle  (pd->xmms_session, TRUE);
-    pd->xmmsvisible = TRUE;
-  }
-  else {
-    /* save status of each xmms window */
-    pd->show_mw = xmms_remote_is_main_win(pd->xmms_session);
-    pd->show_pl = xmms_remote_is_pl_win  (pd->xmms_session);
-    pd->show_eq = xmms_remote_is_eq_win  (pd->xmms_session);
+	if (show) {
+		/* display xmms windows based on their prior status */
+		if (pd->show_mw) pd->pctrl->player_main_win_toggle(pd->xmms_session, TRUE);
+		if (pd->show_pl) pd->pctrl->player_pl_win_toggle  (pd->xmms_session, TRUE);
+		if (pd->show_eq) pd->pctrl->player_eq_win_toggle  (pd->xmms_session, TRUE);
+		pd->xmmsvisible = TRUE;
+	}
+	else {
+		/* save status of each xmms window */
+		pd->show_mw = pd->pctrl->player_is_main_win(pd->xmms_session);
+		pd->show_pl = pd->pctrl->player_is_pl_win  (pd->xmms_session);
+		pd->show_eq = pd->pctrl->player_is_eq_win  (pd->xmms_session);
 
-    /* make sure at least the main window is shown on redisplay */
-    if (!(pd->show_pl || pd->show_eq)) pd->show_mw = TRUE;
+		/* make sure at least the main window is shown on redisplay */
+		if (!(pd->show_pl || pd->show_eq)) pd->show_mw = TRUE;
 
-    /* hide all */
-    xmms_remote_main_win_toggle(pd->xmms_session, FALSE);
-    xmms_remote_pl_win_toggle  (pd->xmms_session, FALSE);
-    xmms_remote_eq_win_toggle  (pd->xmms_session, FALSE);
-    pd->xmmsvisible = FALSE;
-  }
+		/* hide all */
+		pd->pctrl->player_pl_win_toggle  (pd->xmms_session, FALSE);
+		pd->pctrl->player_eq_win_toggle  (pd->xmms_session, FALSE);
+		// should hide main window at the end of process
+		// if not, audacious cannot store the window position
+		pd->pctrl->player_main_win_toggle(pd->xmms_session, FALSE);
+		pd->xmmsvisible = FALSE;
+	}
 }
 
 
-
 /*********************************************************/
 /* callback to jump to the previous song in the playlist */
+/* left click - simply jump                              */
+/* middle click - jump and remove current song           */
 /*********************************************************/
 static void prev(GtkWidget *widget, GdkEventButton* event, gpointer data) {
-  if (event->button != 1) return;
-  xmms_remote_playlist_prev(((plugin_data*) data)->xmms_session);
+	gint pos;
+	plugin_data *pd = (plugin_data *) data;
+	switch (event->button) {
+		case 1: // left click
+			pd->pctrl->player_playlist_prev(pd->xmms_session);
+			break;
+		case 2: // middle click
+			pos = pd->pctrl->player_get_playlist_pos(pd->xmms_session);
+			pd->pctrl->player_playlist_prev(pd->xmms_session);
+			pd->pctrl->player_playlist_delete(pd->xmms_session, pos);
+			break;
+	}
 }
 
 
@@ -99,25 +114,28 @@
 /* callback to start playing; if xmms is not running it will be started */
 /************************************************************************/
 static void play(GtkWidget *widget, GdkEventButton* event, gpointer data) {
-  plugin_data *pd = (plugin_data*) data;
-  int i=0;
-  pid_t pid;
-  int status;
+	plugin_data *pd = (plugin_data*) data;
+	int i=0;
+	pid_t pid;
+	int status;
+	gchar *cmd;
 
-  if (event->button != 1) return;
+	if (event->button != 1) return;
 
-  /* start xmms and hide its windows if not already running */
-  if (!xmms_remote_is_running(pd->xmms_session)) {
-    if (exec_command( (pd->use_bmp)? "beep-media-player -p" : "xmms -p")) {
-      while (!xmms_remote_is_running(pd->xmms_session) && (i <= 5)) {
-        sleep(1);
-        i++;
-      }
-    }
-    if ((i < 5) && (!pd->xmmsvisible))
-      display_xmms(pd, FALSE);
-  }
-  else xmms_remote_play(pd->xmms_session);
+	/* start xmms and hide its windows if not already running */
+	if (!pd->pctrl->player_is_running(pd->xmms_session)) {
+		cmd = g_strconcat(player_control_get_command(pd->player), " -p", NULL);
+		if (exec_command(cmd)) {
+			while (!pd->pctrl->player_is_running(pd->xmms_session) && (i <= 5)) {
+				sleep(1);
+				i++;
+			}
+		}
+		g_free(cmd);
+		if ((i < 5) && (!pd->xmmsvisible))
+			display_xmms(pd, FALSE);
+	}
+		else pd->pctrl->player_play(pd->xmms_session);
 }
 
 
@@ -125,8 +143,9 @@
 /* callback for pausing xmms */
 /*****************************/
 static void paus(GtkWidget *widget, GdkEventButton* event, gpointer data) {
-  if (event->button != 1) return;
-  xmms_remote_pause(((plugin_data*) data)->xmms_session);
+	if (event->button != 1) return;
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_pause(pd->xmms_session);
 }
 
 
@@ -134,67 +153,124 @@
 /* callback for stopping xmms */
 /******************************/
 static void stop(GtkWidget *widget, GdkEventButton* event, gpointer data) {
-  if (event->button != 1) return;
-  xmms_remote_stop(((plugin_data*) data)->xmms_session);
+	if (event->button != 1) return;
+	plugin_data *pd = (plugin_data *) data;
+	pd->pctrl->player_stop(pd->xmms_session);
 }
 
 /*****************************************************/
 /* callback to jump to the next song in the playlist */
+/* left click - simply jump                          */
+/* middle click - jump and remove current song       */
 /*****************************************************/
 static void next(GtkWidget *widget, GdkEventButton* event, gpointer data) {
-  if (event->button != 1) return;
-  xmms_remote_playlist_next(((plugin_data*) data)->xmms_session);
+	gint pos;
+	plugin_data *pd = (plugin_data *) data;
+	switch (event->button) {
+		case 1: // left click
+			pd->pctrl->player_playlist_next(pd->xmms_session);
+			break;
+		case 2: // middle click
+			pos = pd->pctrl->player_get_playlist_pos(pd->xmms_session);
+			pd->pctrl->player_playlist_delete(pd->xmms_session, pos);
+			set_song_title(pd);
+			break;
+	}
 }
 
+/**
+ * callback for pressing menu button
+ * left click - popup menu
+ * middle click - toggle xmms window visibility
+ */
+static void menu_btn_pressed(GtkWidget *widget, GdkEventButton *event, gpointer data) {
+	gint pos;
+	plugin_data *pd = (plugin_data *) data;
+	switch (event->button) {
+		case 1: // left click
+			gtk_menu_popup(GTK_MENU(create_popupmenu(pd)),
+					NULL, NULL, NULL, NULL,
+					event->button, event->time);
+			break;
+		case 2: // middle click
+			display_xmms(pd, !pd->xmmsvisible);
+			break;
+	}
+}
 
 /****************************************************************/
 /* callback for changing the volume when using the scroll wheel */
 /****************************************************************/
 static void box_scroll(GtkWidget* widget, GdkEventScroll* event, gpointer data) {
-  gint vl, vr;
-  plugin_data *pd = (plugin_data*) data;
+	gint vl, vr;
+	plugin_data *pd = (plugin_data*) data;
 
-  if (!xmms_remote_is_running(pd->xmms_session))
-  	return;
+	if (! pd->pctrl->player_is_running(pd->xmms_session))
+		return;
 
-  xmms_remote_get_volume(pd->xmms_session, &vl, &vr);
-  /*g_fprintf(stderr,"\n\n\n********** vl=%d   vr=%d",vl, vr);*/
-  if(event->direction == GDK_SCROLL_UP) xmms_remote_set_volume(pd->xmms_session, vl+8, vr+8);
-  else                                  xmms_remote_set_volume(pd->xmms_session, vl-8, vr-8);
-  
-  xmms_remote_get_volume(pd->xmms_session, &vl, &vr);
+	pd->pctrl->player_get_volume(pd->xmms_session, &vl, &vr);
+	if(event->direction == GDK_SCROLL_UP)
+		pd->pctrl->player_set_volume(pd->xmms_session, vl+8, vr+8);
+	else
+		pd->pctrl->player_set_volume(pd->xmms_session, vl-8, vr-8);
 
-  /* XMMS may return -1 (Alsa/OSS output issue) */
-  if (vl >= 0)
-  	gtk_progress_bar_set_fraction     (GTK_PROGRESS_BAR(pd->vol_pbar), ((double)(MAX(vl,vr)))/100);
+	pd->pctrl->player_get_volume(pd->xmms_session, &vl, &vr);
+	/* XMMS may return -1 (Alsa/OSS output issue) */
+	if (vl >= 0)
+		gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pd->vol_pbar), ((double)(MAX(vl,vr)))/100);
 }
 
 /**********************************************/
 /* callback for clicking on the progress bar  */
 /* button 1: jump to time in the current song */
 /* button 2: toggle xmms window visibility    */
+/* button 3: popup menu                       */
 /**********************************************/
 static void pbar_click(GtkWidget* widget, GdkEventButton* event, gpointer data) {
-  gint width, time, total;
-  plugin_data *pd = (plugin_data *) data;
-  
-  switch (event->button) {
-  case 1:
-    // jump to time within this song
-    width = pd->pbar->allocation.width;
-    total = xmms_remote_get_playlist_time(pd->xmms_session,
-                                          xmms_remote_get_playlist_pos(pd->xmms_session));
-    time  = (int) (event->x * total / width);
-    xmms_remote_jump_to_time(pd->xmms_session, time);
-    break;
+	gint width, time, total;
+	plugin_data *pd = (plugin_data *) data;
 
-  case 2:
-    // toggle xmms window visibility
-    display_xmms(pd, !pd->xmmsvisible);
-  }
+	switch (event->button) {
+		case 1:
+			// jump to time within this song
+			width = pd->pbar->allocation.width;
+			total = pd->pctrl->player_get_playlist_time(pd->xmms_session,
+					pd->pctrl->player_get_playlist_pos(pd->xmms_session));
+			time  = (int) (event->x * total / width);
+			pd->pctrl->player_jump_to_time(pd->xmms_session, time);
+			break;
+		case 2:
+			// toggle xmms window visibility
+			display_xmms(pd, !pd->xmmsvisible);
+			break;
+		case 3:
+			// popup menu
+			gtk_menu_popup(GTK_MENU(create_popupmenu(pd)),
+					NULL, NULL, NULL, NULL,
+					event->button, event->time);
+			break;
+	}
 }
 
+/**
+ * callback for changing the volume when pressing the progress bar
+ */
+static void vol_pbar_pressed(GtkWidget *widget, GdkEventButton *event, gpointer data) {
+	gint vol;
+	plugin_data *pd = (plugin_data *) data;
 
+	if (event->button != 1) return;
+
+	if (gtk_progress_bar_get_orientation(GTK_PROGRESS_BAR(widget))
+				== GTK_PROGRESS_LEFT_TO_RIGHT)
+		vol = (gint) (event->x * 100 / widget->allocation.width);
+	else
+		vol = (gint) ((widget->allocation.height - event->y) * 100
+				/ widget->allocation.height);
+
+	pd->pctrl->player_set_main_volume(pd->xmms_session, vol);
+}
+
 /*******************/
 /* panel_display.c */
 /*******************/
@@ -204,32 +280,32 @@
 /* Set song title in tooltip and scrolled label */
 /************************************************/
 void set_song_title(plugin_data *pd) {
-  gchar    *title, *tooltip, *label;
-  gint     pos, time;
-  gboolean running = xmms_remote_is_running(pd->xmms_session);
+	gchar    *title, *tooltip, *label;
+	gint     pos, time;
+	gboolean running = pd->pctrl->player_is_running(pd->xmms_session);
 
-  if (running) {
-    pos        = xmms_remote_get_playlist_pos(pd->xmms_session);
-    time       = xmms_remote_get_playlist_time(pd->xmms_session, pos) / 1000;
-    title      = xmms_remote_get_playlist_title(pd->xmms_session, pos);
-    if (pd->simple_title)
-       tooltip = g_strdup_printf("%s", title);
-    else
-       tooltip = g_strdup_printf("%d: %s (%d:%02d)", pos, title, time/60, time%60);
-  }
-  else
-       tooltip = g_strdup_printf(TITLE_STRING);
-  gtk_tooltips_set_tip            (pd->tooltip, GTK_WIDGET(pd->base), tooltip, NULL);
+	if (running) {
+		pos        = pd->pctrl->player_get_playlist_pos(pd->xmms_session);
+		time       = pd->pctrl->player_get_playlist_time(pd->xmms_session, pos) / 1000;
+		title      = pd->pctrl->player_get_playlist_title(pd->xmms_session, pos);
+		if (pd->simple_title)
+			tooltip = g_strdup_printf("%s", title);
+		else
+			tooltip = g_strdup_printf("%d: %s (%d:%02d)", pos, title, time/60, time%60);
+	}
+	else
+		tooltip = g_strdup_printf(TITLE_STRING);
+	gtk_tooltips_set_tip            (pd->tooltip, GTK_WIDGET(pd->base), tooltip, NULL);
 
-  if (pd->simple_title) label   = g_strdup_printf("%s %s ", tooltip, tooltip);
-  else                  label   = g_strdup_printf("%s +++ %s +++", tooltip, tooltip);
-  pd->labelattr->start_index    = 0;
-  pd->labelattr->end_index      = strlen(label);
-  gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
-  gtk_label_set_text(GTK_LABEL(pd->label), label);
-  //g_free(title);
-  g_free(tooltip);
-  g_free(label);
+	if (pd->simple_title) label   = g_strdup_printf("%s %s ", tooltip, tooltip);
+	else                  label   = g_strdup_printf("%s +++ %s +++", tooltip, tooltip);
+	pd->labelattr->start_index    = 0;
+	pd->labelattr->end_index      = strlen(label);
+	gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
+	gtk_label_set_text(GTK_LABEL(pd->label), label);
+	//g_free(title);
+	g_free(tooltip);
+	g_free(label);
 }
 
 
@@ -237,763 +313,373 @@
 /* timeout function to update the plugin widgets */
 /*************************************************/
 gboolean pbar_label_update(gpointer data) {
-  plugin_data    *pd = (plugin_data*) data;
-  GtkAdjustment  *adj;
-  gint           sp, len, time = 1, pl_pos = -1, play_time=0, vl, vr;
-  gchar          *timestr;
-  PangoAttribute *attr;
-  gboolean       running, playing;
+	plugin_data    *pd = (plugin_data*) data;
+	GtkAdjustment  *adj;
+	gint           sp, len, time = 1, pl_pos = -1, play_time = 0, vl, vr;
+	gchar          *timestr;
+	PangoAttribute *attr;
+	gboolean       running, playing;
 
-  /* check xmms status */
-  running  = xmms_remote_is_running(pd->xmms_session);
-  playing  = (running && xmms_remote_is_playing(pd->xmms_session));
-  if (running) { /* get playlist position and song length */
-    pl_pos = xmms_remote_get_playlist_pos(pd->xmms_session);
-    time   = xmms_remote_get_playlist_time(pd->xmms_session, pl_pos) / 1000;
-  }
+	/* check xmms status */
+	running  = pd->pctrl->player_is_running(pd->xmms_session);
+	playing  = (running && pd->pctrl->player_is_playing(pd->xmms_session));
+	if (running) { /* get playlist position and song length */
+		pl_pos = pd->pctrl->player_get_playlist_pos(pd->xmms_session);
+		time   = pd->pctrl->player_get_playlist_time(pd->xmms_session, pl_pos) / 1000;
+	}
 
-  /* update tooltip and song title */
-  if (pd->playlist_position != pl_pos) {
-    pd->playlist_position     = pl_pos;
-    pd->title_scroll_position = 0;
-    set_song_title(pd);
-  }
+	/* update tooltip and song title */
+	if (pd->playlist_position != pl_pos) {
+		pd->playlist_position     = pl_pos;
+		pd->title_scroll_position = 0;
+		set_song_title(pd);
+	}
 
-  /* update progress bar */
-  if (playing) play_time = xmms_remote_get_output_time(pd->xmms_session) / 1000;
-  gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pd->pbar), (gdouble) play_time / time);
-  
-  /* scroll song title */
-  if ((pd->show_scrolledtitle) && (pd->scroll_step > 0)) {
-    adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(pd->viewport));
-    len = pd->label->allocation.width / 2;
-    sp  = pd->title_scroll_position - pd->step_delay;
-    sp  = (sp < 0) ? 0 : sp;
-    sp  = (len > 0) ? sp % len : 0;
-    gtk_adjustment_set_value(adj, sp);
-    pd->title_scroll_position += pd->scroll_step;
-  }
-  
+	/* update progress bar */
+	if (playing) play_time = pd->pctrl->player_get_output_time(pd->xmms_session) / 1000;
+	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(pd->pbar), (gdouble) play_time / time);
 
-  if((running) && (pd->vol_pbar_visible)){
-    xmms_remote_get_volume(pd->xmms_session, &vl, &vr);    
-    if ( vl >= 0 ) /* XMMS may return -1 (Alsa/OSS output issue) */
-    	gtk_progress_bar_set_fraction   (GTK_PROGRESS_BAR(pd->vol_pbar), 
-    					((double)(MAX	(vl,vr)))/100);    
-  }
+	/* scroll song title */
+	if ((pd->show_scrolledtitle) && (pd->scroll_step > 0)) {
+		adj = gtk_viewport_get_hadjustment(GTK_VIEWPORT(pd->viewport));
+		len = pd->label->allocation.width / 2;
+		sp  = pd->title_scroll_position - pd->step_delay;
+		sp  = (sp < 0) ? 0 : sp;
+		sp  = (len > 0) ? sp % len : 0;
+		gtk_adjustment_set_value(adj, sp);
+		pd->title_scroll_position += pd->scroll_step;
+	}
 
-  
-  /* set up new timer and destroy old if new scroll speed has been set */
-  if (pd->timer_reset) {
-    g_source_remove(pd->timeout);
-    pd->timeout = g_timeout_add(1000 / pd->scroll_speed, pbar_label_update, pd);
-    pd->timer_reset = FALSE;
-    return FALSE;
-  }
-  return TRUE;
-}
+	if((running) && (pd->vol_pbar_visible)){
+		pd->pctrl->player_get_volume(pd->xmms_session, &vl, &vr);
+		if ( vl >= 0 ) /* XMMS may return -1 (Alsa/OSS output issue) */
+		gtk_progress_bar_set_fraction     (GTK_PROGRESS_BAR(pd->vol_pbar), ((double)(MAX(vl,vr)))/100);    
+	}
 
-
-/***************************************************************/
-/* adds a new button with image and callback to the parent box */
-/***************************************************************/
-static void new_button_with_img(GtkWidget *box, gchar *filename, gpointer cb, gpointer data) {
-  GtkWidget *image, *eventbox;
-
-  eventbox            = gtk_event_box_new();
-  image               = gtk_image_new_from_file(filename);
-  gtk_widget_show       (image);
-  gtk_container_add     (GTK_CONTAINER(eventbox), image);
-  gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK);
-  g_signal_connect      (G_OBJECT(eventbox), "button_press_event", G_CALLBACK(cb), data);
-  gtk_box_pack_start    (GTK_BOX(box), eventbox, DOEXPAND, DOFILL, PADDING);
+	/* set up new timer and destroy old if new scroll speed has been set */
+	if (pd->timer_reset) {
+		g_source_remove(pd->timeout);
+		pd->timeout = g_timeout_add(1000 / pd->scroll_speed, pbar_label_update, pd);
+		pd->timer_reset = FALSE;
+		return FALSE;
+	}
+	return TRUE;
 }
 
 
 
+
 /******************************************************/
 /* frees all resources used by the plugin (I hope :-) */
 /******************************************************/
 static void xmms_plugin_free(XfcePanelPlugin *plugin, plugin_data *pd) {
 
-  g_return_if_fail(plugin != NULL);
+	g_return_if_fail(plugin != NULL);
 
-  /* remove timeout */
-  if (pd->timeout) g_source_remove(pd->timeout);
+	/* remove timeout */
+	if (pd->timeout) g_source_remove(pd->timeout);
 
-  /* destroy all widgets */
-  gtk_widget_destroy(pd->boxMain);
+	/* destroy all widgets */
+	gtk_widget_destroy(pd->boxMain);
 
-  /* destroy text attribute for the label widget */
-  pango_attribute_destroy(pd->labelattr);
+	/* destroy text attribute for the label widget */
+	pango_attribute_destroy(pd->labelattr);
 
-  /* destroy the tooltips */
-  gtk_object_destroy(GTK_OBJECT(pd->tooltip));
+	/* destroy the tooltips */
+	gtk_object_destroy(GTK_OBJECT(pd->tooltip));
 
-  /* let xmms exit if quit_xmms option is active */
-  if (pd->quit_xmms) xmms_remote_quit(pd->xmms_session);
+	/* let xmms exit if quit_xmms option is active */
+	if (pd->quit_xmms) pd->pctrl->player_quit(pd->xmms_session);
 
-  /* free the plugin data structure */
-  g_free(pd);
+	// unload library
+	player_control_close(pd->pctrl);
+
+	/* free the plugin data structure */
+	g_free(pd);
 }
-     
 
 /*************************************/
 /* Adjust the position of volume bar */
 /*************************************/
 
-adjust_vol_pbar(plugin_data *pd){
+void adjust_vol_pbar(plugin_data *pd) {
 
-  gtk_widget_hide(pd->vol_pbar);
+	gtk_widget_hide(pd->vol_pbar);
 
-  if( xfce_panel_plugin_get_orientation(pd->base)==GTK_ORIENTATION_VERTICAL)
-    gtk_widget_set_size_request
-    		(GTK_WIDGET(pd->base),xfce_panel_plugin_get_size(pd->base),50);
-  else
-    gtk_widget_set_size_request
-    		(GTK_WIDGET (pd->base),60,xfce_panel_plugin_get_size(pd->base)); 
-    		
-  if(pd->vol_pbar){
-    g_object_ref(G_OBJECT(pd->vol_pbar));
-    gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(pd->vol_pbar)),
-    								pd->vol_pbar);
-  }  
-  
-  /* Vertical panel and we want horizontal volume bar? */
-  if( (xfce_panel_plugin_get_orientation(pd->base)==GTK_ORIENTATION_VERTICAL) 
-  							&& pd->hor_vol_if_vertical ){
-  							
-  	gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR (pd->vol_pbar),
-  	 GTK_PROGRESS_LEFT_TO_RIGHT ) ;	
-  	gtk_widget_set_size_request
-  			(pd->vol_pbar,
-  			xfce_panel_plugin_get_size
-  			(pd-> base)-3,5);					
-  			
-  	gtk_box_pack_start(GTK_BOX(pd->boxV),pd->vol_pbar, DOEXPAND, DOFILL, PADDING);
-  /* Else horiz panel or vertical with vertical volume bar */
-  }else{
-  	gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR (pd->vol_pbar),
-  	 GTK_PROGRESS_BOTTOM_TO_TOP ) ;	
-  	 
-        if (xfce_panel_plugin_get_orientation(pd->base)==GTK_ORIENTATION_VERTICAL) {
-                // vertical panel
-                // if do not this, volume bar height will be set based on panel width
-                gtk_widget_set_size_request(pd->vol_pbar, 5, 0);
-        } else {
-        	// Horizontal panel
-	  	gtk_widget_set_size_request (pd->vol_pbar,5,
-	  			xfce_panel_plugin_get_size(pd->base)-3);		  	  }		    
+	if(pd->vol_pbar){
+		g_object_ref(G_OBJECT(pd->vol_pbar));
+		gtk_container_remove(GTK_CONTAINER(gtk_widget_get_parent(pd->vol_pbar)),
+				pd->vol_pbar);
+	}  
 
-  	gtk_box_pack_start(GTK_BOX(pd->boxMain),pd->vol_pbar, DOEXPAND, DOFILL, 
-  									1);    
-  }
+	/* use horizontal volume bar regardless of panel orientation */
+	if (pd->hor_vol_if_vertical) {
+		gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(pd->vol_pbar),
+				GTK_PROGRESS_LEFT_TO_RIGHT);
+		gtk_widget_set_size_request(pd->vol_pbar, 0, 4);
+		gtk_box_pack_start(GTK_BOX(pd->boxV), pd->vol_pbar, DOEXPAND, DOFILL, PADDING);
+	} else {
+		gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(pd->vol_pbar),
+				GTK_PROGRESS_BOTTOM_TO_TOP);
+		gtk_widget_set_size_request(pd->vol_pbar, 6, 0);
+		gtk_box_pack_start(GTK_BOX(pd->boxMain),pd->vol_pbar, FALSE, FALSE, PADDING);
+	}
+	if (pd->vol_pbar_visible)
+		gtk_widget_show(pd->vol_pbar);
 
-  // check "Show volume level" setting
-  if (pd->vol_pbar_visible)
-	  gtk_widget_show(pd->vol_pbar);
-   
+	if( xfce_panel_plugin_get_orientation(pd->base)==GTK_ORIENTATION_VERTICAL)
+		gtk_widget_set_size_request(GTK_WIDGET(pd->base),
+				xfce_panel_plugin_get_size(pd->base), -1);
+	else
+		gtk_widget_set_size_request(GTK_WIDGET(pd->base),
+				-1, xfce_panel_plugin_get_size(pd->base));  
+
 }
 
+/**
+ * panel resize callback
+ */
+static gboolean xmms_plugin_set_size(XfcePanelPlugin *plugin, int size, plugin_data *pd) {
+	adjust_vol_pbar(pd);
+	return TRUE;
+}
 
+/*************************************/
+/* Panel orientation change callback */
+/*************************************/
+static void orient_change(XfcePanelPlugin *plugin, GtkOrientation orient, plugin_data *pd){
+	adjust_vol_pbar(pd);
+}
 
 /*****************************/
 /* apply visibility settings */
 /*****************************/
 void apply_visibility_settings(plugin_data *pd) {
 
-  PangoAttrSize *attr = (PangoAttrSize*) pd->labelattr;
-    
-  attr->size = pd->titletextsize * PANGO_SCALE;
-  gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
-  
-  if(!pd->show_scrolledtitle)
-  gtk_widget_hide_all (pd->viewport);
-  /* show/hide the event box parent of the scrolled title */
-  if (pd->show_scrolledtitle)
- 	gtk_widget_show_all(gtk_widget_get_parent(pd->label));
-  else                          
- 	gtk_widget_hide_all(gtk_widget_get_parent(pd->label));
- 	
- 	
-  if(pd->pbar_visible)
- 	gtk_widget_show_all  (pd->pbar);
-  else
-  	gtk_widget_hide_all  (pd->pbar);   
-  	
-  if(pd->vol_pbar_visible)
-  	gtk_widget_show_all  (pd->vol_pbar);
-  else
-  	gtk_widget_hide_all  (pd->vol_pbar); 								 	
-}
+	PangoAttrSize *attr = (PangoAttrSize*) pd->labelattr;
 
-/**************************/
-/* read plugin parameters */
-/**************************/
-void xmms_plugin_read_config(plugin_data *pd) {
+	attr->size = pd->titletextsize * PANGO_SCALE;
+	gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
 
-  XfceRc *rc;
-  char *file;
-  gint n;
-  
-  if ((file = xfce_panel_plugin_lookup_rc_file (pd->base)) != NULL)
-  {
-  
-      rc = xfce_rc_simple_open (file, TRUE);
-      g_free (file);
+	if(!pd->show_scrolledtitle)
+		gtk_widget_hide_all (pd->viewport);
+	/* show/hide the event box parent of the scrolled title */
+	if (pd->show_scrolledtitle)
+		gtk_widget_show_all(gtk_widget_get_parent(pd->label));
+	else                          
+		gtk_widget_hide_all(gtk_widget_get_parent(pd->label));
 
-      if (rc != NULL)
-      {
-         /* load title font size */
- 	 n = xfce_rc_read_int_entry (rc,"textsize",10);
-	 if ((n >= MIN_TITLE_SIZE) && (n <= MAX_TITLE_SIZE))
-      	 	pd->titletextsize = n;
-      	 	
- 	 /* load scroll speed */
-	 n = xfce_rc_read_int_entry (rc, "scroll_speed",5);
-	 if ((n >= MIN_SCROLL_SPEED) && (n <= MAX_SCROLL_SPEED)) {
-      		pd->scroll_speed = n;
-      		pd->timer_reset = TRUE;
-    	 }
-    	 
- 	 /* load scroll step width */
- 	 n = xfce_rc_read_int_entry (rc,"scroll_step", 2);
-	 if ((n >= MIN_SCROLL_STEP) && (n <= MAX_SCROLL_STEP)) pd->scroll_step = n;
-	 
- 	 /* load scroll delay */
- 	 n = xfce_rc_read_int_entry (rc,"scroll_delay", 0);
         if ((n >= MIN_SCROLL_DELAY) && (n <= MAX_SCROLL_DELAY)) pd->scroll_delay = n;
-         
-  	 /* load xmms window visibility */
- 	 pd->xmmsvisible = xfce_rc_read_bool_entry (rc, "xmms_visible", TRUE);
 
- 	 /* load visibility of scrolled sing title */
- 	 pd->show_scrolledtitle = xfce_rc_read_bool_entry (rc, "title_visible", TRUE);
+	if(pd->pbar_visible)
+		gtk_widget_show_all  (pd->pbar);
+	else
+		gtk_widget_hide_all  (pd->pbar);   
 
- 	 /* load quit xmms option */
- 	 pd->quit_xmms = xfce_rc_read_bool_entry (rc, "quit_xmms", FALSE);
+	if(pd->vol_pbar_visible)
+		gtk_widget_show_all  (pd->vol_pbar);
+	else
+		gtk_widget_hide_all  (pd->vol_pbar); 								 	
 
-  	 /* load simple title option */
-  	 pd->simple_title = xfce_rc_read_bool_entry (rc, "simple_title", TRUE);
-  
- 	 /* load progressbar visibility option */
- 	 pd->pbar_visible = xfce_rc_read_bool_entry (rc, "pbar_visible", TRUE);
-
-  
-  	 /* load volume progressbar visibility option */
- 	 pd->vol_pbar_visible =xfce_rc_read_bool_entry(rc,"vol_pbar_visible",TRUE);   	  
-
-  	 /* load use bmp option */
- 	 pd->use_bmp = xfce_rc_read_bool_entry (rc, "use_bmp", FALSE);    
- 	 
-	 /* load horizontal volume bar if vertical panel option */
-	 pd->hor_vol_if_vertical = 
-	 		xfce_rc_read_bool_entry (rc, "hor_vol_if_vertical",TRUE);   	     
-	 		
-	 xfce_rc_close(rc);
-	}	
-    
-  }
-
+	if (pd->menu_btn_visible)
+		gtk_widget_show(pd->menu_btn);
+	else
+		gtk_widget_hide(pd->menu_btn);
 }
 
-
-/**************************/
-/* save plugin parameters */
-/**************************/
-void xmms_plugin_write_config(XfcePanelPlugin *plugin, plugin_data *pd) {
-
-  XfceRc *rc;
-  char *file;
-  
-  g_return_if_fail(plugin!=NULL);
- 
-  if (!(file = xfce_panel_plugin_save_location (plugin, TRUE)))
-    return;
-
-  rc = xfce_rc_simple_open (file, FALSE);
-  g_free (file);
-
-  if (!rc)
-    return;
-    
-  /* save title font size */
-  xfce_rc_write_int_entry (rc,"textsize",pd->titletextsize);
-
-  /* save scroll speed */
-  xfce_rc_write_int_entry (rc, "scroll_speed",pd->scroll_speed);
-
-  /* save scroll step width */
-  xfce_rc_write_int_entry (rc,"scroll_step", pd->scroll_step);
-
-  /* save scroll delay */
-  xfce_rc_write_int_entry (rc,"scroll_delay", pd->scroll_delay);
-  /* save xmms window visibility */
-  xfce_rc_write_bool_entry (rc, "xmms_visible", pd->xmmsvisible);
-
-  /* save visibility of scrolled sing title */
-  xfce_rc_write_bool_entry (rc, "title_visible", pd->show_scrolledtitle);
-
-  /* save quit xmms option */
-  xfce_rc_write_bool_entry (rc, "quit_xmms", pd->quit_xmms);
-
-  /* save simple title option */
-  xfce_rc_write_bool_entry (rc, "simple_title", pd->simple_title);
-  
-  /* save progressbar visibility option */
-  xfce_rc_write_bool_entry (rc, "pbar_visible", pd->pbar_visible);  
-  
-  /* save volume progressbar visibility option */
-  xfce_rc_write_bool_entry (rc, "vol_pbar_visible", pd->vol_pbar_visible);  
-
-  /* save use bmp option */
-  xfce_rc_write_bool_entry (rc, "use_bmp", pd->use_bmp);   
-  
-  /* save horizontal volume bar if vertical panel option */
-  xfce_rc_write_bool_entry (rc, "hor_vol_if_vertical", pd->hor_vol_if_vertical);
-  
-  xfce_rc_close(rc);   
-}
-
-
-/************************************/
-/* callback to change the font size */
-/************************************/
-static void set_font_size(GtkSpinButton *spin, gpointer data) {
-  plugin_data *pd     = (plugin_data*) data;
-  PangoAttrSize *attr = (PangoAttrSize*) pd->labelattr;
-  pd->titletextsize   = gtk_spin_button_get_value_as_int(spin);
-
-  if (pd->titletextsize < MIN_TITLE_SIZE) pd->titletextsize = 1;
-  if (pd->titletextsize > MAX_TITLE_SIZE) pd->titletextsize = MAX_TITLE_SIZE;
-  attr->size = pd->titletextsize * PANGO_SCALE;
-  gtk_label_set_attributes(GTK_LABEL(pd->label), pd->labelattrlist);
-  gtk_widget_set_size_request(GTK_WIDGET(pd->viewport),0,pd->titletextsize);
-
-}
-
-
-/***************************************/
-/* callback to change the scroll speed */
-/***************************************/
-static void set_scroll_speed(GtkSpinButton *spin, gpointer data) {
-  plugin_data *pd  = (plugin_data*) data;
-  pd->scroll_speed = gtk_spin_button_get_value_as_int(spin);
-
-  if (pd->scroll_speed < MIN_SCROLL_SPEED) pd->scroll_speed = MIN_SCROLL_SPEED;
-  if (pd->scroll_speed > MAX_SCROLL_SPEED) pd->scroll_speed = MAX_SCROLL_SPEED;
-  pd->timer_reset = TRUE;
-}
-
-
-/********************************************/
-/* callback to change the scroll step width */
-/********************************************/
-static void set_scroll_step(GtkSpinButton *spin, gpointer data) {
-  plugin_data *pd             = (plugin_data*) data;
-  gint s                      = gtk_spin_button_get_value_as_int(spin);
-
-  if (s < MIN_SCROLL_STEP) s  = MIN_SCROLL_STEP;
-  if (s > MAX_SCROLL_STEP) s  = MAX_SCROLL_STEP;
-  pd->scroll_step = s;
-  if (s == 0) pd->title_scroll_position = 0;
-}
-
-
-/***************************************/
-/* callback to change the scroll delay */
-/***************************************/
-static void set_scroll_delay(GtkSpinButton *spin, gpointer data) {
-  plugin_data *pd             = (plugin_data*) data;
-  gint d                      = gtk_spin_button_get_value_as_int(spin);
-  
-  if (d < MIN_SCROLL_DELAY) d = MIN_SCROLL_DELAY;
-  if (d > MAX_SCROLL_DELAY) d = MAX_SCROLL_DELAY;
-  pd->scroll_delay            = d;
-  pd->step_delay              = d * pd->scroll_speed * pd->scroll_step;
-  pd->title_scroll_position   = 0;
-}
-
-
 /***************************************************************/
-/* callback to toggle the visibility of the scrolled songtitle */
+/* adds a new button with image and callback to the parent box */
 /***************************************************************/
-static void show_title(GtkToggleButton *check, gpointer data) {
-  plugin_data *pd             = (plugin_data*) data;
-  pd->show_scrolledtitle      = gtk_toggle_button_get_active(check);
+static void new_button_with_img(GtkWidget *box, gchar *filename, gpointer cb, gpointer data) {
+	GtkWidget *image, *eventbox;
 
-  /* show/hide the event box parent of the scrolled title */
-  if (pd->show_scrolledtitle)   gtk_widget_show_all(pd->viewport);
-  else                          gtk_widget_hide_all(pd->viewport);
+	eventbox            = gtk_event_box_new();
+	image               = gtk_image_new_from_file(filename);
+	gtk_widget_show       (image);
+	gtk_container_add     (GTK_CONTAINER(eventbox), image);
+	gtk_widget_set_events (eventbox, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect      (G_OBJECT(eventbox), "button_press_event", G_CALLBACK(cb), data);
+	gtk_box_pack_start    (GTK_BOX(box), eventbox, DOEXPAND, DOFILL, PADDING);
 }
 
+/******************************/
+/* creates the plugin widgets */
+/******************************/
+gboolean xmms_plugin_control_new(XfcePanelPlugin *plugin) {
+	GtkWidget *button, *box, *boxV, *boxMain, *pbar, *vol_pbar, *viewport, *eventbox, *label, *menu_btn,*image;
+	plugin_data *pd;
+	gchar *title = TITLE_STRING" +++ "TITLE_STRING" +++ ";
+	gint vl, vr;
+	GtkRcStyle *rc;
+	GdkColor color;
 
-/***************************************/
-/* callback to change quit xmms option */
-/***************************************/
-static void quit_xmms_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd = (plugin_data*) data;
-  pd->quit_xmms   = gtk_toggle_button_get_active(button);
-}
+	xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+	
+	pd = g_new(plugin_data, 1);
 
+	/* These defaults will be overwritten by read config */
+	pd->titletextsize          = TITLE_SIZE;
+	pd->title_scroll_position  = 0;
+	pd->scroll_speed           = SCROLL_SPEED;
+	pd->scroll_step            = SCROLL_STEP;
+	pd->step_delay             = STEP_DELAY;
+	pd->scroll_delay           = SCROLL_DELAY;
+	pd->playlist_position      = -1;
+	pd->xmmsvisible            = TRUE;
+	pd->xmms_session           = 0;
+	pd->timeout                = 0;
+	pd->timer_reset            = FALSE;
+	pd->show_scrolledtitle     = TRUE;
+	pd->tooltip                = gtk_tooltips_new();
+	pd->labelattrlist          = pango_attr_list_new();
+	pd->labelattr              = pango_attr_size_new(pd->titletextsize * PANGO_SCALE);
+	pd->labelattr->start_index = 0;
+	pd->labelattr->end_index   = strlen(title);
+	pd->quit_xmms              = FALSE;
+	pd->simple_title           = FALSE;
+	pd->pbar_visible           = TRUE;
+	pd->vol_pbar_visible       = TRUE;
+	pd->hor_vol_if_vertical    = TRUE;
+	pd->menu_btn_visible       = TRUE;
+	pango_attr_list_insert       (pd->labelattrlist, pd->labelattr);
 
-/******************************************/
-/* callback to change simple title option */
-/******************************************/
-static void simple_title_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd    = (plugin_data*) data;
-  pd->simple_title   = gtk_toggle_button_get_active(button);
-  set_song_title(pd);
-}
+	// check media player and set default one
+	if (player_control_has_library(LIB_XMMS)) {
+		pd->player = PLAYER_XMMS;
+	} else if (player_control_has_library(LIB_BEEP)) {
+		pd->player = PLAYER_BEEP;
+	} else if (player_control_has_library(LIB_AUDACIOUS)) {
+		pd->player = PLAYER_AUDACIOUS;
+	} else {
+		// TODO any other idea
+		xfce_err(_("Cannot find any supported media player. You have to install at least one player first."));
+		pango_attribute_destroy(pd->labelattr);
+		g_free(pd);
+		gtk_widget_destroy(GTK_WIDGET(plugin));
+		return FALSE;
+	}
 
+	xfce_panel_plugin_set_expand(plugin,FALSE);
 
 
-/*********************************************************/
-/* callback for show track postion (pbar_visible) option */
-/*********************************************************/
-static void pbar_visible_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd   = (plugin_data*) data;
-  pd->pbar_visible  = gtk_toggle_button_get_active(button);
-  
-  if(pd->pbar_visible)
-     gtk_widget_show_all (pd->pbar);
-  else
-     gtk_widget_hide_all (pd->pbar);
-}
+	g_signal_connect (plugin, "free-data", 
+			G_CALLBACK (xmms_plugin_free), pd);
 
-/******************************************************/
-/* callback for show volume (vol_pbar_visible) option */
-/******************************************************/
-static void vol_pbar_visible_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd        = (plugin_data*) data;
-  pd->vol_pbar_visible   = gtk_toggle_button_get_active(button);
-  
-  if(pd->vol_pbar_visible)
-     gtk_widget_show_all (pd->vol_pbar);
-  else
-     gtk_widget_hide_all (pd->vol_pbar);
-}
+	g_signal_connect (plugin, "save", 
+			G_CALLBACK (xmms_plugin_write_config), pd);
 
-/*********************************/
-/* callback for "use bmp" option */
-/*********************************/
-static void use_bmp_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd  = (plugin_data*) data;
-  pd->use_bmp      = gtk_toggle_button_get_active(button);
+	xfce_panel_plugin_menu_show_configure (plugin);
+	g_signal_connect (plugin, "configure-plugin", 
+			G_CALLBACK (xmms_plugin_create_options), pd);
 
-}
+	g_signal_connect (plugin, "orientation-changed", 
+			G_CALLBACK (orient_change), pd);
 
-/*********************************************/
-/* callback for "hor_vol_if_vertical" option */
-/*********************************************/
-static void hor_vol_toggled(GtkToggleButton *button, gpointer data) {
-  plugin_data *pd  = (plugin_data*) data;
-  pd->hor_vol_if_vertical   = gtk_toggle_button_get_active(button);
-  adjust_vol_pbar(pd);
-}
+	g_signal_connect(plugin, "size-changed",
+			G_CALLBACK(xmms_plugin_set_size), pd);
 
-/*****************************************************/
-/* add label to the left column of the options table */
-/*****************************************************/
-static void add_label(GtkWidget *table, gchar *text, gint pos) {
-  gint att_opts               = GTK_SHRINK | GTK_EXPAND | GTK_FILL;
-  GtkWidget *label            = gtk_label_new(text);
+	/* add scrolling callback for the plugin base widget */
+	pd->base                     = plugin;
+	gtk_widget_add_events(GTK_WIDGET(plugin), GDK_SCROLL_MASK);
+	g_signal_connect(G_OBJECT(plugin),"scroll_event",G_CALLBACK(box_scroll), pd);
+	gtk_tooltips_set_tip           (pd->tooltip, GTK_WIDGET(plugin), TITLE_STRING, NULL);
 
-  gtk_misc_set_alignment        (GTK_MISC(label), 0.0, 0.5);
-  gtk_table_attach              (GTK_TABLE(table), label, 0, 1, pos, pos+1, att_opts, att_opts, 0, 0);
-}
+	/* main container for the plugin widgets */
+	boxMain                      = gtk_hbox_new(FALSE, 0);
+	boxV                         = gtk_vbox_new(FALSE, 0);
 
+	/* label for the song title */
+	eventbox                     = gtk_event_box_new();
+	label                        = gtk_label_new(title);
+	gtk_label_set_line_wrap        (GTK_LABEL(label), FALSE);
+	gtk_container_add              (GTK_CONTAINER(eventbox), label);
+	gtk_widget_set_events          (eventbox, GDK_BUTTON_PRESS_MASK);
+	gtk_label_set_attributes       (GTK_LABEL(label), pd->labelattrlist);
 
-/*************************************************************/
-/* add spin button to the right columns of the options table */
-/*************************************************************/
-static void add_spin(GtkWidget *table, gint min, gint max, gint value, GCallback cb, gpointer data, gint pos) {
-  gint att_opts               = GTK_SHRINK/* | GTK_EXPAND | GTK_FILL*/;
-  GtkWidget *spin             = gtk_spin_button_new_with_range(min, max, 1.0);
+	/* viewport widget that manages the scrolling */
+	viewport                     = gtk_viewport_new(NULL, NULL);
+	gtk_viewport_set_shadow_type   (GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
+	gtk_container_add              (GTK_CONTAINER(viewport), eventbox);
+	gtk_widget_set_size_request    (viewport, 0, -1);
+	gtk_box_pack_start             (GTK_BOX(boxV), viewport, DOEXPAND, DOFILL, PADDING);
 
-  gtk_spin_button_set_value     (GTK_SPIN_BUTTON(spin), value);
-  gtk_table_attach              (GTK_TABLE(table), spin, 1, 2, pos, pos+1, att_opts, att_opts, 0, 0);
-  g_signal_connect              (G_OBJECT(spin), "value-changed", cb, data);
-}
+	/* the progress bar */
+	pbar                         = gtk_progress_bar_new();
+	gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(pbar), GTK_PROGRESS_CONTINUOUS);
+	gtk_widget_set_size_request    (pbar, 0, 4);
+	gtk_widget_set_events          (pbar, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect               (G_OBJECT(pbar), "button_press_event",
+			G_CALLBACK(pbar_click), pd);
+	gtk_box_pack_start             (GTK_BOX(boxV), pbar, DOEXPAND, DOFILL, PADDING);
 
-/********************/
-/* add check button */
-/********************/
-static void add_check(GtkWidget *parent, gchar *title, gboolean active, GCallback cb, gpointer data, const char* tip_title) {
-  GtkWidget *check            = gtk_check_button_new_with_label(title);
+	pd->boxMain  = boxMain;
+	pd->boxV     = boxV;
+	pd->viewport = viewport;
+	pd->label    = label;
+	pd->pbar     = pbar;
 
-  gtk_toggle_button_set_active  (GTK_TOGGLE_BUTTON(check), active);
-  gtk_box_pack_start            (GTK_BOX(parent), check, DOEXPAND, DOFILL, PADDING);
-  if(tip_title)
-  	gtk_tooltips_set_tip    (((plugin_data *) data)->tooltip, check, tip_title, NULL);
-  g_signal_connect              (G_OBJECT(check), "toggled", cb, data);
-}
+	/* box that contains the xmms control buttons */
+	box                          = gtk_hbox_new(FALSE, 2);
+	gtk_container_set_border_width(GTK_CONTAINER(box), 1);
+	new_button_with_img(box, PREV, G_CALLBACK(prev), pd);
+	new_button_with_img(box, PLAY, G_CALLBACK(play), pd);
+	new_button_with_img(box, PAUS, G_CALLBACK(paus), pd);
+	new_button_with_img(box, STOP, G_CALLBACK(stop), pd);
+	new_button_with_img(box, NEXT, G_CALLBACK(next), pd);
+	// create menu button
+	menu_btn = gtk_event_box_new();
+	image = gtk_image_new_from_file(MENU);
+	gtk_widget_show(image);
+	gtk_container_add(GTK_CONTAINER(menu_btn), image);
+	gtk_widget_set_events(menu_btn, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect(G_OBJECT(menu_btn), "button_press_event",
+			G_CALLBACK(menu_btn_pressed), pd);
+	gtk_box_pack_start(GTK_BOX(box), menu_btn, DOEXPAND, DOFILL, PADDING);
 
-/***************************/
-/* options dialog response */
-/***************************/
-static void
-options_dialog_response (GtkWidget *dlg, int reponse, plugin_data *pd)
-{
-    gtk_widget_destroy (dlg);
-    xfce_panel_plugin_unblock_menu (pd->base);
-    xmms_plugin_write_config(pd->base,pd);
-}
+	pd->menu_btn = menu_btn;
 
-/*************************************/
-/* Panel orientation change callback */
-/*************************************/
-static void orient_change(XfcePanelPlugin *plugin, GtkOrientation orient, plugin_data *pd){
+	gtk_box_pack_start(GTK_BOX(boxV), box, DOEXPAND, DOFILL, PADDING);    
+	gtk_container_set_border_width(GTK_CONTAINER(boxMain), 2);
 
+	/* the volume progress bar */
+	vol_pbar                          = gtk_progress_bar_new();
+	gtk_progress_bar_set_orientation  (GTK_PROGRESS_BAR(vol_pbar)
+			,GTK_PROGRESS_BOTTOM_TO_TOP);
+	gtk_progress_bar_set_bar_style    (GTK_PROGRESS_BAR(vol_pbar), 
+			GTK_PROGRESS_CONTINUOUS);
+	gtk_widget_set_size_request       (vol_pbar, 6, 0);
+	gtk_widget_set_events(vol_pbar, GDK_BUTTON_PRESS_MASK);
+	g_signal_connect(G_OBJECT(vol_pbar), "button_press_event",
+			G_CALLBACK(vol_pbar_pressed), pd);
 
-  adjust_vol_pbar(pd);
-}
+	rc =                              gtk_widget_get_modifier_style 
+		(GTK_WIDGET (vol_pbar));
 
-/**
- * panel resize callback
- */
-static gboolean xmms_plugin_set_size(XfcePanelPlugin *plugin, int size, plugin_data *pd) {
-       adjust_vol_pbar(pd); // ad-hoc
-       return TRUE;
-}  
+	if (!rc)
+		rc = gtk_rc_style_new ();
 
+	gdk_color_parse ("#00c000", &color);
 
+	if (rc) {
+		rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG;
+		rc->bg[GTK_STATE_PRELIGHT] = color;
+	}
 
-/**********************/
-/* preferences dialog */
-/**********************/
-static void xmms_plugin_create_options (XfcePanelPlugin *plugin, plugin_data *pd) {
+	gtk_widget_modify_style (GTK_WIDGET (vol_pbar), rc);
+	pd->vol_pbar                      = vol_pbar;
 
-  GtkWidget *vbox, *table, *label, *size, *speed, *step, *delay;
-  gint att_opts = GTK_SHRINK | GTK_EXPAND | GTK_FILL;
+	gtk_box_pack_start             (GTK_BOX(boxMain), boxV, TRUE, TRUE, 1);
+	gtk_box_pack_start             (GTK_BOX(boxMain), vol_pbar, FALSE, FALSE, 1);
 
-  GtkWidget *dlg, *header;
 
+	gtk_container_add              (GTK_CONTAINER(plugin), boxMain);
 
-  gtk_tooltips_disable(pd->tooltip);
-  gtk_tooltips_enable(pd->tooltip);
+	xmms_plugin_read_config(pd);
+	adjust_vol_pbar(pd);
+	pd->pctrl = player_control_get_instance(pd->player);
+	gtk_widget_show_all(boxMain);
+	apply_visibility_settings(pd);
 
-  xfce_panel_plugin_block_menu (plugin);
-    
-  dlg = gtk_dialog_new_with_buttons (_("Properties"), 
-              GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
-              GTK_DIALOG_DESTROY_WITH_PARENT |
-              GTK_DIALOG_NO_SEPARATOR,
-              GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-              NULL);
-    
-  g_signal_connect (dlg, "response", G_CALLBACK (options_dialog_response),
-                    pd);
+	pd->timeout                  = g_timeout_add(1000 / pd->scroll_speed, 						pbar_label_update, pd);
 
-  gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
-    
-  header = xfce_create_header (NULL, _("Xfce4 XMMS Plugin Options"));
-  gtk_widget_set_size_request (GTK_BIN (header)->child, 200, 32);
-  gtk_container_set_border_width (GTK_CONTAINER (header), 6);
-  gtk_widget_show (header);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header,
-                      FALSE, TRUE, 0);
-
-  vbox  = gtk_vbox_new      (FALSE, 4);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox,
-                      FALSE, TRUE, 0);
-  
-  
-  table = gtk_table_new     (4, 2, FALSE);
-  gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), DOEXPAND, DOFILL, PADDING);
-
-  /* add table */
-  gtk_box_pack_start        (GTK_BOX(vbox), table, DOEXPAND, DOFILL, PADDING);
-
-  /* put labels into the left column of our table */
-  add_label(table, _("Font Size"),        0);
-  add_label(table, _("Scroll Speed"),     1);
-  add_label(table, _("Scroll Stepwidth"), 2);
-  add_label(table, _("Scroll Delay"),     3);
-
-  /* put spin buttons into the right column */
-  add_spin(table, MIN_TITLE_SIZE,   MAX_TITLE_SIZE,   pd->titletextsize, G_CALLBACK(set_font_size),    pd, 0);
-  add_spin(table, MIN_SCROLL_SPEED, MAX_SCROLL_SPEED, pd->scroll_speed,  G_CALLBACK(set_scroll_speed), pd, 1);
-  add_spin(table, MIN_SCROLL_STEP,  MAX_SCROLL_STEP,  pd->scroll_step,   G_CALLBACK(set_scroll_step),  pd, 2);
-  add_spin(table, MIN_SCROLL_DELAY, MAX_SCROLL_DELAY, pd->scroll_delay,  G_CALLBACK(set_scroll_delay), pd, 3);
-
-  /*new separator*/
-  gtk_box_pack_start (GTK_BOX(vbox), gtk_hseparator_new(), DOEXPAND, DOFILL, PADDING);
-
-  /* add check buttons for the scrolled title, progressbar and volume bar */
-  add_check(vbox, _("Show scrolled song title"), pd->show_scrolledtitle, G_CALLBACK(show_title), pd, NULL);
-  add_check(vbox, _("Show track position"), pd->pbar_visible, G_CALLBACK(pbar_visible_toggled), pd, NULL);
-  add_check(vbox, _("Show volume level"), pd->vol_pbar_visible, G_CALLBACK(vol_pbar_visible_toggled), pd, NULL);
-  /* add check button for simple title option */
-  add_check(vbox, _("Simple song title format"), pd->simple_title, G_CALLBACK(simple_title_toggled), pd, NULL);
-  /* add check button for hor_vol_if_vertical option */
-  add_check(vbox, _("Horizontal volume bar on vertical panels"), 
-  pd->hor_vol_if_vertical, G_CALLBACK(hor_vol_toggled), pd, NULL);  
-  /* add check button for "Use BMP" option */
-  add_check(vbox, _("Use BMP (Beep Media Player)"), pd->use_bmp, G_CALLBACK(use_bmp_toggled), pd, NULL);  
-  /* add check button for quit xmms option */
-  add_check(vbox, _("Quit XMMS/BMP when plugin terminates"), pd->quit_xmms, G_CALLBACK(quit_xmms_toggled), pd, NULL);
-  
-  gtk_widget_show_all(GTK_WIDGET(dlg));
-  
+	return(TRUE);
 }
-
-
-/******************************/
-/* creates the plugin widgets */
-/******************************/
-gboolean xmms_plugin_control_new(XfcePanelPlugin *plugin) {
-  GtkWidget *button, *box, *boxV, *boxMain, *pbar, *vol_pbar, *viewport, *eventbox, *label;
-  plugin_data *pd;
-  gchar *title = TITLE_STRING" +++ "TITLE_STRING" +++ ";
-  gint vl, vr;
-  GtkRcStyle *rc;
-  GdkColor color;
-
-  xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
-  
-  pd = g_new(plugin_data, 1);
-  
-  /* These defaults will be overwritten by read config */
-  pd->titletextsize          = TITLE_SIZE;
-  pd->title_scroll_position  = 0;
-  pd->scroll_speed           = SCROLL_SPEED;
-  pd->scroll_step            = SCROLL_STEP;
-  pd->step_delay             = STEP_DELAY;
-  pd->scroll_delay           = SCROLL_DELAY;
-  pd->playlist_position      = -1;
-  pd->xmmsvisible            = TRUE;
-  pd->xmms_session           = 0;
-  pd->timeout                = 0;
-  pd->timer_reset            = FALSE;
-  pd->show_scrolledtitle     = TRUE;
-  pd->tooltip                = gtk_tooltips_new();
-  pd->labelattrlist          = pango_attr_list_new();
-  pd->labelattr              = pango_attr_size_new(pd->titletextsize * PANGO_SCALE);
-  pd->labelattr->start_index = 0;
-  pd->labelattr->end_index   = strlen(title);
-  pd->quit_xmms              = FALSE;
-  pd->simple_title           = FALSE;
-  pd->pbar_visible           = TRUE;
-  pd->vol_pbar_visible       = TRUE;
-  pd->use_bmp                = FALSE;
-  pd->hor_vol_if_vertical    = TRUE;
-  pango_attr_list_insert       (pd->labelattrlist, pd->labelattr);
-
-  
-  xfce_panel_plugin_set_expand(plugin,FALSE);
-  
-  
-  g_signal_connect (plugin, "free-data", 
-                      G_CALLBACK (xmms_plugin_free), pd);
-
-  g_signal_connect (plugin, "save", 
-                      G_CALLBACK (xmms_plugin_write_config), pd);
-
-  xfce_panel_plugin_menu_show_configure (plugin);
-  g_signal_connect (plugin, "configure-plugin", 
-                      G_CALLBACK (xmms_plugin_create_options), pd);
-  
-  g_signal_connect (plugin, "orientation-changed", 
-                      G_CALLBACK (orient_change), pd);
-
-  // resize plugin to correct size
-  g_signal_connect(plugin, "size-changed",
-                 G_CALLBACK(xmms_plugin_set_size), pd);
-
-                        
-  /* add scrolling callback for the plugin base widget */
-  pd->base                     = plugin;
-  gtk_widget_add_events(GTK_WIDGET(plugin), GDK_SCROLL_MASK);
-  g_signal_connect(G_OBJECT(plugin),"scroll_event",G_CALLBACK(box_scroll), pd);
-  gtk_tooltips_set_tip           (pd->tooltip, GTK_WIDGET(plugin), TITLE_STRING, NULL);
-
-  /* main container for the plugin widgets */
-  boxMain                      = gtk_hbox_new(FALSE, 0);
-  boxV                         = gtk_vbox_new(FALSE, 0);
-
-  /* label for the song title */
-  eventbox                     = gtk_event_box_new();
-  label                        = gtk_label_new(title);
-  gtk_label_set_line_wrap        (GTK_LABEL(label), FALSE);
-  gtk_container_add              (GTK_CONTAINER(eventbox), label);
-  gtk_widget_set_events          (eventbox, GDK_BUTTON_PRESS_MASK);
-  gtk_label_set_attributes       (GTK_LABEL(label), pd->labelattrlist);
-
-  /* viewport widget that manages the scrolling */
-  viewport                     = gtk_viewport_new(NULL, NULL);
-  gtk_viewport_set_shadow_type   (GTK_VIEWPORT(viewport), GTK_SHADOW_NONE);
-  gtk_container_add              (GTK_CONTAINER(viewport), eventbox);
-  gtk_widget_set_size_request    (viewport, 0, pd->titletextsize+2);
-  gtk_box_pack_start             (GTK_BOX(boxV), viewport, DOEXPAND, DOFILL, PADDING);
-
-  /* the progress bar */
-  pbar                         = gtk_progress_bar_new();
-  gtk_progress_bar_set_bar_style (GTK_PROGRESS_BAR(pbar), GTK_PROGRESS_CONTINUOUS);
-  gtk_widget_set_size_request    (pbar, 0, 6);
-  gtk_widget_set_events          (pbar, GDK_BUTTON_PRESS_MASK);
-  g_signal_connect               (G_OBJECT(pbar), "button_press_event",
-                                  G_CALLBACK(pbar_click), pd);
-  gtk_box_pack_start             (GTK_BOX(boxV), pbar, TRUE, FALSE, PADDING);
-       
-  pd->boxMain  = boxMain;
-  pd->boxV     = boxV;
-  pd->viewport = viewport;
-  pd->label    = label;
-  pd->pbar     = pbar;
-
-  /* box that contains the xmms control buttons */
-  box                          = gtk_hbox_new(FALSE, 0);
-  new_button_with_img(box, PREV, G_CALLBACK(prev), pd);
-  new_button_with_img(box, PLAY, G_CALLBACK(play), pd);
-  new_button_with_img(box, PAUS, G_CALLBACK(paus), pd);
-  new_button_with_img(box, STOP, G_CALLBACK(stop), pd);
-  new_button_with_img(box, NEXT, G_CALLBACK(next), pd);
-
-  gtk_box_pack_start             (GTK_BOX(boxV), box, DOEXPAND, DOFILL, PADDING);    
-  gtk_container_set_border_width (GTK_CONTAINER(boxMain), 2);  
-  
-  /* the volume progress bar */
-  vol_pbar                          = gtk_progress_bar_new();
-  gtk_progress_bar_set_orientation  (GTK_PROGRESS_BAR(vol_pbar)
-  					,GTK_PROGRESS_BOTTOM_TO_TOP);
-  gtk_progress_bar_set_bar_style    (GTK_PROGRESS_BAR(vol_pbar), 
-  					GTK_PROGRESS_CONTINUOUS);
-  gtk_widget_set_size_request       (vol_pbar, 6, 0);
-  xmms_remote_get_volume            (pd->xmms_session, &vl, &vr);
-
-  if(vl==-1)
-  	gtk_progress_bar_set_fraction     (GTK_PROGRESS_BAR(vol_pbar), 
-  					((double)(MAX(vl, vr)))/100);
-  else
-  	gtk_progress_bar_set_fraction     (GTK_PROGRESS_BAR(vol_pbar), 0);
-
-  rc =  gtk_widget_get_modifier_style (GTK_WIDGET (vol_pbar));
-
-  if (!rc)
-	rc = gtk_rc_style_new ();
-
-  gdk_color_parse ("#00c000", &color);
-
-  if (rc) {
-	rc->color_flags[GTK_STATE_PRELIGHT] |= GTK_RC_BG;
-	rc->bg[GTK_STATE_PRELIGHT] = color;
-  }
-
-  gtk_widget_modify_style (GTK_WIDGET (vol_pbar), rc);
-  pd->vol_pbar                      = vol_pbar;
-  
-  gtk_box_pack_start             (GTK_BOX(boxMain), boxV, TRUE, TRUE, 1);
-  gtk_box_pack_start             (GTK_BOX(boxMain), vol_pbar, FALSE, FALSE, 1);
-  
-  
-  gtk_container_add              (GTK_CONTAINER(plugin), boxMain);
-
-  xmms_plugin_read_config(pd);
-  adjust_vol_pbar(pd);
-  gtk_widget_show_all(boxMain);
-  apply_visibility_settings(pd);
-  
-  pd->timeout                  = g_timeout_add(1000 / pd->scroll_speed, 						pbar_label_update, pd);
-
-  return(TRUE);
-}

Modified: xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.h
===================================================================
--- xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.h	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/panel-plugin/xmms_plugin.h	2006-09-23 14:08:40 UTC (rev 2067)
@@ -28,6 +28,12 @@
 #ifndef XMMS_PLUGIN_H
 #define XMMS_PLUGIN_H
 
+#include <gtk/gtk.h>
+
+#include <libxfce4panel/xfce-panel-plugin.h>
+
+#include "playerctrl.h"
+
 #define DOEXPAND TRUE
 #define DOFILL   TRUE
 #define PADDING  0
@@ -37,10 +43,11 @@
 #define PAUS (DATA_DIR "/xmms-plugin-pause.png")
 #define STOP (DATA_DIR "/xmms-plugin-stop.png")
 #define NEXT (DATA_DIR "/xmms-plugin-next.png")
+#define MENU (DATA_DIR "/xmms-plugin-menu.png")
 
 #define MAX_SCROLL_SPEED 20             /* limits and default for scroll steps per second */
 #define MIN_SCROLL_SPEED 1
-#define SCROLL_SPEED     5
+#define SCROLL_SPEED     10
 
 #define MAX_SCROLL_DELAY 10             /* limits and default for delay in seconds before */
 #define MIN_SCROLL_DELAY 0              /* scrolling starts                               */
@@ -60,7 +67,7 @@
 
 /* data structure to hold all required data for the plugin */
 typedef struct {
-  GtkWidget      	*boxMain, *boxV, *pbar, *vol_pbar, *viewport, *label;
+  GtkWidget      	*boxMain, *boxV, *pbar, *vol_pbar, *viewport, *label, *menu_btn;
   XfcePanelPlugin 	*base;
   GtkTooltips    *tooltip;
   PangoAttribute *labelattr;
@@ -70,7 +77,19 @@
   gint           xmms_session;
   guint          timeout;
   gboolean       xmmsvisible, show_mw, show_pl, show_eq, timer_reset,
-                 show_scrolledtitle, quit_xmms, simple_title, pbar_visible, vol_pbar_visible, use_bmp, hor_vol_if_vertical;
+                 show_scrolledtitle, quit_xmms, simple_title, pbar_visible, vol_pbar_visible, hor_vol_if_vertical, menu_btn_visible;
+  Players        player;	/// @see playerctrl.h
+  PlayerCtrl     *pctrl;
 } plugin_data;
 
+/**
+ * Set song title in tooltip and scrolled label
+ */
+void set_song_title(plugin_data *pd);
+
+/**
+ * Adjust the position of volume bar
+ */
+void adjust_vol_pbar(plugin_data *pd);
+
 #endif

Modified: xfce4-xmms-plugin/trunk/pixmaps/Makefile.am
===================================================================
--- xfce4-xmms-plugin/trunk/pixmaps/Makefile.am	2006-09-23 11:30:43 UTC (rev 2066)
+++ xfce4-xmms-plugin/trunk/pixmaps/Makefile.am	2006-09-23 14:08:40 UTC (rev 2067)
@@ -6,7 +6,8 @@
         xmms-plugin-play.png                                            \
         xmms-plugin-pause.png                                           \
         xmms-plugin-stop.png                                            \
-        xmms-plugin-next.png
+        xmms-plugin-next.png \
+		xmms-plugin-menu.png
 
 EXTRA_DIST = $(xmmsicon_DATA)
 

Added: xfce4-xmms-plugin/trunk/pixmaps/xmms-plugin-menu.png
===================================================================
(Binary files differ)


Property changes on: xfce4-xmms-plugin/trunk/pixmaps/xmms-plugin-menu.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream




More information about the Goodies-commits mailing list