Blob Blame History Raw
Index: lib/rb-util.h
===================================================================
--- lib/rb-util.h	(revision 5858)
+++ lib/rb-util.h	(working copy)
@@ -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);
Index: plugins/lirc/rhythmbox_lirc_default
===================================================================
--- plugins/lirc/rhythmbox_lirc_default	(revision 0)
+++ plugins/lirc/rhythmbox_lirc_default	(revision 0)
@@ -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
Index: plugins/lirc/rb-lirc-plugin.c
===================================================================
--- plugins/lirc/rb-lirc-plugin.c	(revision 5858)
+++ plugins/lirc/rb-lirc-plugin.c	(working copy)
@@ -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,12 +207,18 @@
 		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);
 	g_io_channel_set_buffered (plugin->lirc_channel, FALSE);
Index: plugins/lirc/Makefile.am
===================================================================
--- plugins/lirc/Makefile.am	(revision 5858)
+++ plugins/lirc/Makefile.am	(working copy)
@@ -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)