[PATCH] Add commandline switch for reloading the current skin (CVS-2005-11-03) {-k, --reload-skin}

Peter Ganzhorn <[email protected]> Fri, 04 Nov 2005 15:00:23 +0100
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------010802020606050100040402
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

I tried to submit this patch a few weeks ago, but sadly no one responded 
to my mail.
This patch adds a commandline switch to XMMS which allows one to reload 
the current skin of XMMS without user action. (Usefull for anyone using 
scripts for automatic theme-changing of the complete desktop)

I made the patch more CVS-version compatible, so instead of '-q' (which 
is used in CVS now) I decided to use '-k' for my switch, the long option 
is '--reload-skin'. ('k' because of it's the second letter of 'skin', 
the first is already in use)
So I hope you will put my patch in the CVS version, it works perfectly 
with the CVS version from 2005-11-03. (No failed/fuzz/offset errors)

Peter

--------------010802020606050100040402
Content-Type: text/x-patch;
 name="cmdline-reload-skin_CVS20051103.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="cmdline-reload-skin_CVS20051103.diff"

--- xmms-2005-11-03_bak/xmms/main.c	2005-05-15 01:33:40.000000000 +0200
+++ xmms-2005-11-03/xmms/main.c	2005-11-04 14:28:10.000000000 +0100
@@ -3300,8 +3300,9 @@
 	{"show-main-window", 0, NULL, 'm'},
 	{"version", 0, NULL, 'v'},
 	{"quit", 0, NULL, 'q'},
 	{"sm-client-id", 1, NULL, 'i'},
+        {"reload-skin", 0, NULL, 'k'},
 	{0, 0, 0, 0}
 };
 
 void display_usage(void)
@@ -3361,8 +3362,11 @@
 	fprintf(stderr, _("Previous session ID"));
 	fprintf(stderr, "\n  -v, --version			");
 	/* I18N: -v, --version switch */
 	fprintf(stderr, _("Print version number and exit."));
+	fprintf(stderr, "\n  -k, --reload-skin		");
+	/* I18N: -k, --reload-skin switch */
+	fprintf(stderr, _("Reload current skin."));
 	fprintf(stderr, "\n  -q, --quit			");
 	/* I18N: -q, --quit switch */
 	fprintf(stderr, _("Close remote session."));
 	fprintf(stderr, "\n\n");
@@ -3373,9 +3377,9 @@
 
 struct cmdlineopt {
 	GList *filenames;
 	int session;
-	gboolean play, stop, pause, fwd, rew, play_pause;
+	gboolean play, stop, pause, fwd, rew, play_pause, reload_skin;
 	gboolean toggle_shuffle, toggle_repeat, toggle_advance;
 	gboolean enqueue, queue, mainwin, remote, quit;
 	char *shuffle, *repeat, *advance;
 	char *previous_session_id;
@@ -3387,9 +3391,9 @@
 	char *filename;
 
 	memset(opt, 0, sizeof(struct cmdlineopt));
 	opt->session = -1;
-	while ((c = getopt_long(argc, argv, "hn:rpusfeQS::R::A::mi:vtq", long_options, NULL)) != -1)
+	while ((c = getopt_long(argc, argv, "hn:rpusfeQS::R::A::mi:vtkq", long_options, NULL)) != -1)
 	{
 		switch (c)
 		{
 			case 'h':
@@ -3448,8 +3452,11 @@
 				break;
 			case 'i':
 				opt->previous_session_id = g_strdup(optarg);
 				break;
+			case 'k':
+				opt->reload_skin = TRUE;
+				break;
 			case 'q':
 				opt->quit = TRUE;
 				break;
 		}
@@ -3596,8 +3603,10 @@
 		}
 	}
 	if (opt->mainwin)
 		xmms_remote_main_win_toggle(opt->session, TRUE);
+	if (opt->reload_skin)
+		xmms_remote_reload_skin(opt->session);
 	if (opt->quit)
 		xmms_remote_quit(opt->session);
 }
 
 
--- xmms-2005-11-03_bak/xmms/controlsocket.c	2005-10-07 07:22:06.000000000 +0200
+++ xmms-2005-11-03/xmms/controlsocket.c	2005-11-04 14:27:22.000000000 +0100
@@ -532,8 +532,11 @@
 				break;
 			case CMD_SET_SKIN:
 				load_skin(data);
 				break;
+			case CMD_RELOAD_SKIN:
+				reload_skin();
+				break;
 			case CMD_PL_WIN_TOGGLE:
 				tbool = *((gboolean *) data);
 				playlistwin_show(!!tbool);
 				break;
--- xmms-2005-11-03_bak/xmms/controlsocket.h	2005-10-07 07:22:06.000000000 +0200
+++ xmms-2005-11-03/xmms/controlsocket.h	2005-11-04 14:26:10.000000000 +0100
@@ -33,9 +33,9 @@
 	CMD_GET_VERSION, CMD_PLAYLIST_ADD, CMD_PLAY, CMD_PAUSE, CMD_STOP,
 	CMD_IS_PLAYING, CMD_IS_PAUSED, CMD_GET_PLAYLIST_POS,
 	CMD_SET_PLAYLIST_POS, CMD_GET_PLAYLIST_LENGTH, CMD_PLAYLIST_CLEAR,
 	CMD_GET_OUTPUT_TIME, CMD_JUMP_TO_TIME, CMD_GET_VOLUME,
-	CMD_SET_VOLUME, CMD_GET_SKIN, CMD_SET_SKIN, CMD_GET_PLAYLIST_FILE,
+	CMD_SET_VOLUME, CMD_GET_SKIN, CMD_SET_SKIN, CMD_RELOAD_SKIN, CMD_GET_PLAYLIST_FILE,
 	CMD_GET_PLAYLIST_TITLE, CMD_GET_PLAYLIST_TIME, CMD_GET_INFO,
 	CMD_GET_EQ_DATA, CMD_SET_EQ_DATA, CMD_PL_WIN_TOGGLE,
 	CMD_EQ_WIN_TOGGLE, CMD_SHOW_PREFS_BOX, CMD_TOGGLE_AOT,
 	CMD_SHOW_ABOUT_BOX, CMD_EJECT, CMD_PLAYLIST_PREV, CMD_PLAYLIST_NEXT,
--- xmms-2005-11-03_bak/libxmms/xmmsctrl.c	2005-10-07 07:22:06.000000000 +0200
+++ xmms-2005-11-03/libxmms/xmmsctrl.c	2005-11-04 14:24:57.000000000 +0100
@@ -580,8 +580,13 @@
 {
 	remote_send_string(session, CMD_SET_SKIN, skinfile);
 }
 
+void xmms_remote_reload_skin(gint session)
+{
+	remote_cmd(session, CMD_RELOAD_SKIN);
+}
+
 char *xmms_remote_get_playlist_file(int session, int pos)
 {
 	return remote_get_string_pos(session, CMD_GET_PLAYLIST_FILE, pos);
 }
--- xmms-2005-11-03_bak/libxmms/xmmsctrl.h	2005-10-07 07:22:06.000000000 +0200
+++ xmms-2005-11-03/libxmms/xmmsctrl.h	2005-11-04 14:24:06.000000000 +0100
@@ -48,8 +48,9 @@
 void xmms_remote_set_volume(gint session, gint vl, gint vr);
 void xmms_remote_set_main_volume(gint session, gint v);
 void xmms_remote_set_balance(gint session, gint b);
 gchar *xmms_remote_get_skin(gint session);
+void xmms_remote_reload_skin(gint session);
 void xmms_remote_set_skin(gint session, gchar * skinfile);
 gchar *xmms_remote_get_playlist_file(gint session, gint pos);
 gchar *xmms_remote_get_playlist_title(gint session, gint pos);
 gint xmms_remote_get_playlist_time(gint session, gint pos);

--------------010802020606050100040402
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
xmms-devel mailing list
[email protected]
http://lists.xmms.org/mailman/listinfo/xmms-devel

--------------010802020606050100040402--