rhythmbox r5860 - in trunk: . lib plugins/lirc



Author: hadess
Date: Thu Aug 14 15:27:36 2008
New Revision: 5860
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=5860&view=rev

Log:
2008-08-14  Bastien Nocera  <hadess hadess net>

	* lib/rb-util.h:
	* plugins/lirc/Makefile.am:
	* plugins/lirc/rb-lirc-plugin.c (rb_lirc_plugin_read_code),
	(impl_activate):
	* plugins/lirc/rhythmbox_lirc_default: Add a default configuration
	for lirc, so that it works out-of-the-box (Closes: #545555)



Added:
   trunk/plugins/lirc/rhythmbox_lirc_default
Modified:
   trunk/ChangeLog
   trunk/lib/rb-util.h
   trunk/plugins/lirc/Makefile.am
   trunk/plugins/lirc/rb-lirc-plugin.c

Modified: trunk/lib/rb-util.h
==============================================================================
--- trunk/lib/rb-util.h	(original)
+++ trunk/lib/rb-util.h	Thu Aug 14 15:27:36 2008
@@ -38,6 +38,10 @@
 
 G_BEGIN_DECLS
 
+/* Offsets for seeking forward, and rewinding in seconds */
+#define FFWD_OFFSET 20
+#define RWD_OFFSET 10
+
 gboolean rb_true_function (gpointer dummy);
 gboolean rb_false_function (gpointer dummy);
 gpointer rb_null_function (gpointer dummy);

Modified: trunk/plugins/lirc/Makefile.am
==============================================================================
--- trunk/plugins/lirc/Makefile.am	(original)
+++ trunk/plugins/lirc/Makefile.am	Thu Aug 14 15:27:36 2008
@@ -6,6 +6,9 @@
 
 librblirc_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) -llirc_client
 
+configdir = $(PLUGINDIR)/lirc
+config_DATA = rhythmbox_lirc_default
+
 INCLUDES = 						\
         -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
 	-DG_LOG_DOMAIN=\"Rhythmbox\"		 	\
@@ -32,7 +35,7 @@
 
 plugin_DATA = $(plugin_in_files:.rb-plugin.in=.rb-plugin)
 
-EXTRA_DIST = $(plugin_in_files)
+EXTRA_DIST = $(plugin_in_files) $(config_DATA)
 
 CLEANFILES = $(plugin_DATA)
 DISTCLEANFILES = $(plugin_DATA)

Modified: trunk/plugins/lirc/rb-lirc-plugin.c
==============================================================================
--- trunk/plugins/lirc/rb-lirc-plugin.c	(original)
+++ trunk/plugins/lirc/rb-lirc-plugin.c	Thu Aug 14 15:27:36 2008
@@ -42,6 +42,7 @@
 #include "rb-plugin.h"
 #include "rb-shell.h"
 #include "rb-debug.h"
+#include "rb-util.h"
 #include "rb-shell-player.h"
 
 #define RB_TYPE_LIRC_PLUGIN		(rb_lirc_plugin_get_type ())
@@ -162,9 +163,9 @@
 		} else if (strcmp (str, RB_IR_COMMAND_PREVIOUS) == 0) {
 			rb_shell_player_do_previous (plugin->shell_player, NULL);
 		} else if (strcmp (str, RB_IR_COMMAND_SEEK_FORWARD) == 0) {
-			rb_shell_player_seek (plugin->shell_player, 10);
+			rb_shell_player_seek (plugin->shell_player, FFWD_OFFSET);
 		} else if (strcmp (str, RB_IR_COMMAND_SEEK_BACKWARD) == 0) {
-			rb_shell_player_seek (plugin->shell_player, -10);
+			rb_shell_player_seek (plugin->shell_player, -RWD_OFFSET);
 		} else if (strcmp (str, RB_IR_COMMAND_VOLUME_UP) == 0) {
 			rb_shell_player_set_volume_relative (plugin->shell_player, 0.1, NULL);
 		} else if (strcmp (str, RB_IR_COMMAND_VOLUME_DOWN) == 0) {
@@ -191,6 +192,7 @@
 	       RBShell *shell)
 {
 	int fd;
+	char *path;
 	RBLircPlugin *plugin = RB_LIRC_PLUGIN (rbplugin);
 
 	plugin->shell = g_object_ref (shell);
@@ -205,11 +207,17 @@
 		return;
 	}
 
-	if (lirc_readconfig (NULL, &plugin->lirc_config, NULL) == -1) {
+	/* Load the default Rhythmbox setup */
+	path = rb_plugin_find_file (rbplugin, "rhythmbox_lirc_default");
+	if (path == NULL || lirc_readconfig (path, &plugin->lirc_config, NULL) == -1) {
+		g_free (path);
 		close (fd);
 		rb_debug ("Couldn't read lirc configuration");
 		return;
 	}
+	g_free (path);
+
+	lirc_readconfig (NULL, &plugin->lirc_config, NULL);
 
 	plugin->lirc_channel = g_io_channel_unix_new (fd);
 	g_io_channel_set_encoding (plugin->lirc_channel, NULL, NULL);

Added: trunk/plugins/lirc/rhythmbox_lirc_default
==============================================================================
--- (empty file)
+++ trunk/plugins/lirc/rhythmbox_lirc_default	Thu Aug 14 15:27:36 2008
@@ -0,0 +1,116 @@
+# edit the "button =" part for each entry according to your remote, and stick
+# this stuff in ~/.lircrc
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_PLAY
+	repeat = 1
+	config = play
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_PAUSE
+	repeat = 0
+	config = pause
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_PLAYPAUSE
+	repeat = 1
+	config = playpause
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_STOP
+	repeat = 1
+	config = stop
+end
+
+#FIXME
+#begin
+#	prog = Rhythmbox
+#	remote = *
+#	button = 
+#	repeat = 1
+#	config = shuffle
+#end
+
+#FIXME
+#begin
+#	prog = Rhythmbox
+#	remote = *
+#	button = 
+#	repeat = 1
+#	config = repeat
+#end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_NEXT
+	repeat = 1
+	config = next
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = previous
+	repeat = 1
+	config = KEY_PREVIOUS
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_FASTFORWARD
+	repeat = 1
+	config = seek_forward
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_REWIND
+	repeat = 1
+	config = seek_backward
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_VOLUMEUP
+	repeat = 1
+	config = volume_up
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_VOLUMEDOWN
+	repeat = 1
+	config = volume_down
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_MUTE
+	repeat = 1
+	config = mute
+end
+
+begin
+	prog = Rhythmbox
+	remote = *
+	button = KEY_EXIT
+	repeat = 1
+	config = quit
+end



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]