File xmms2-0.7-silent-launcher.patch of Package xmms2

Description: This patch makes xmms2-launcher more smart and silent.
 All non error output is now turned off unless you run xmms2-launcher with
 the --verbose switch.
Bug-Debian: http://bugs.debian.org/510375
Author: Adam Flott <adam@npjh.com>
Forwarded: No

Index: debian.git/src/clients/launcher/xmms2-launcher.1
===================================================================
--- debian.git.orig/src/clients/launcher/xmms2-launcher.1	2010-02-20 12:50:04.522899969 +0100
+++ debian.git/src/clients/launcher/xmms2-launcher.1	2010-02-20 12:50:11.362899847 +0100
@@ -51,6 +51,9 @@
 pidfile / 
 .B --pidfile=
 pidfile]
+[
+.B --verbose
+]
 .SH DESCRIPTION
 
 .B XMMS2
@@ -88,6 +91,11 @@
 .I pidfile
 .TP
 .I
+\-\-verbose
+Increases the vebosity of
+.I xmms2-launcher
+.TP
+.I
 \-? / \-\-help
 Show help options
 .SH FILES
Index: debian.git/src/clients/launcher/xmms2-launcher.c
===================================================================
--- debian.git.orig/src/clients/launcher/xmms2-launcher.c	2010-02-19 18:43:54.000000000 +0100
+++ debian.git/src/clients/launcher/xmms2-launcher.c	2010-02-20 12:50:11.362899847 +0100
@@ -46,11 +46,13 @@
 	int pipefd[2];
 	const gchar *logfile = NULL;
 	const gchar *pidfile = NULL;
+	static gboolean verbose = FALSE;
 	GError *error = NULL;
 	GOptionContext* context = NULL;
 	GOptionEntry opts[] = {
 		{"logfile", 'l', 0, G_OPTION_ARG_FILENAME, &logfile, "Redirect logs to <file>", "<file>"},
 		{"pidfile", 'P', 0, G_OPTION_ARG_FILENAME, &pidfile, "Save xmms2d pid in <file>", "<file>"},
+		{"verbose", 0, 0, G_OPTION_ARG_NONE, &verbose, "Verbose", NULL},
 		{NULL}
 	};
 
@@ -76,7 +78,9 @@
 			g_mkdir_with_parents (cache, 0755);
 		}
 	}
-	g_print ("Log output will be stored in %s\n", logfile);
+	if (verbose) {
+		g_print ("Log output will be stored in %s\n", logfile);
+	}
 
 	pid = fork ();
 	if (pid) {
@@ -92,10 +96,14 @@
 		if (res == -1)
 			perror ("read");
 		if (res == 0) {
-			printf ("startup failed!\n");
+			if (verbose) {
+				printf ("startup failed!\n");
+			}
 			exit (1);
 		}
-		printf("xmms2 started\n");
+		if (verbose) {
+			printf("xmms2 started\n");
+		}
 		exit(0);
 	}