totem r5529 - in trunk: . data src/plugins/lirc



Author: hadess
Date: Wed Jul 30 17:10:12 2008
New Revision: 5529
URL: http://svn.gnome.org/viewvc/totem?rev=5529&view=rev

Log:
2008-07-30  Bastien Nocera  <hadess hadess net>

	* data/lirc_example:
	* src/plugins/lirc/Makefile.am:
	* src/plugins/lirc/totem-lirc.c (impl_activate):
	* src/plugins/lirc/totem_lirc_default: Update lirc plugin
	to read from a default configuration file, and not fail when there's
	no user configuration. This allows Totem to work out-of-the-box on the
	majority of remotes as setup by gnome-lirc-properties



Added:
   trunk/src/plugins/lirc/totem_lirc_default
Removed:
   trunk/data/lirc_example
Modified:
   trunk/ChangeLog
   trunk/src/plugins/lirc/Makefile.am
   trunk/src/plugins/lirc/totem-lirc.c

Modified: trunk/src/plugins/lirc/Makefile.am
==============================================================================
--- trunk/src/plugins/lirc/Makefile.am	(original)
+++ trunk/src/plugins/lirc/Makefile.am	Wed Jul 30 17:10:12 2008
@@ -9,6 +9,9 @@
 
 plugin_DATA = $(plugin_in_files:.totem-plugin.in=.totem-plugin)
 
+configdir = $(PLUGINDIR)/lirc
+config_DATA = totem_lirc_default
+
 common_defines = \
 	-D_REENTRANT					\
 	-DDBUS_API_SUBJECT_TO_CHANGE			\
@@ -35,7 +38,7 @@
 	-I$(top_srcdir)/src	\
 	-I$(top_srcdir)/src/plugins
 
-EXTRA_DIST = $(plugin_in_files)
+EXTRA_DIST = $(plugin_in_files) $(config_DATA)
 
 CLEANFILES = $(plugin_DATA) $(BUILT_SOURCES)
 DISTCLEANFILES = $(plugin_DATA)

Modified: trunk/src/plugins/lirc/totem-lirc.c
==============================================================================
--- trunk/src/plugins/lirc/totem-lirc.c	(original)
+++ trunk/src/plugins/lirc/totem-lirc.c	Wed Jul 30 17:10:12 2008
@@ -231,6 +231,7 @@
 	       GError **error)
 {
 	TotemLircPlugin *pi = TOTEM_LIRC_PLUGIN (plugin);
+	char *path;
 	int fd;
 
 	pi->totem = g_object_ref (totem);
@@ -242,13 +243,21 @@
 		return FALSE;
 	}
 
-	if (lirc_readconfig (NULL, &pi->lirc_config, NULL) == -1) {
-		g_set_error (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION,
-				_("Couldn't read lirc configuration."));
-		close (fd);
-		return FALSE;
+	/* Load the default Totem setup */
+	path = totem_plugin_find_file (plugin, "totem_lirc_default");
+	if (path != NULL) {
+		if (lirc_readconfig (path, &pi->lirc_config, NULL) == -1) {
+			g_set_error (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION,
+				     _("Couldn't read lirc configuration."));
+			close (fd);
+			return FALSE;
+		}
+		g_free (path);
 	}
 
+	/* Load the user config, doesn't matter if it's not there */
+	lirc_readconfig (NULL, &pi->lirc_config, NULL);
+
 	pi->lirc_channel = g_io_channel_unix_new (fd);
 	g_io_channel_set_encoding (pi->lirc_channel, NULL, NULL);
 	g_io_channel_set_buffered (pi->lirc_channel, FALSE);

Added: trunk/src/plugins/lirc/totem_lirc_default
==============================================================================
--- (empty file)
+++ trunk/src/plugins/lirc/totem_lirc_default	Wed Jul 30 17:10:12 2008
@@ -0,0 +1,174 @@
+# edit the "button =" part for each entry according to your remote, and stick
+# this stuff in ~/.lircrc
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_PLAY
+	repeat = 1
+	config = play
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_PAUSE
+	repeat = 0
+	config = pause
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_FASTFORWARD
+	repeat = 1
+	config = seek_forward
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_REWIND
+	repeat = 1
+	config = seek_backward
+end
+
+# FIXME
+#begin
+#	prog = Totem
+#	remote = *
+#	button = YOUR_BUTTON
+#	repeat = 1
+#	config = fullscreen
+#end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_VOLUMEUP
+	repeat = 1
+	config = volume_up
+end
+
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_VOLUMEDOWN
+	repeat = 1
+	config = volume_down
+end
+
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_NEXT
+	repeat = 1
+	config = next
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_PREVIOUS
+	repeat = 1
+	config = previous
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_EXIT
+	repeat = 1
+	config = quit
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_UP
+	repeat = 1
+	config = up
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_DOWN
+	repeat = 1
+	config = down
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_LEFT
+	repeat = 1
+	config = left
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_RIGHT
+	repeat = 1
+	config = right
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_SELECT
+	repeat = 1
+	config = select
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_MENU
+	repeat = 1
+	config = menu
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_PLAYPAUSE
+	repeat = 1
+	config = play_pause
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_SELECT
+	repeat = 1
+	config = select
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_EJECTCD
+	repeat = 1
+	config = eject
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_DVD
+	repeat = 1
+	config = play_dvd
+end
+
+begin
+	prog = Totem
+	remote = *
+	button = KEY_MUTE
+	repeat = 1
+	config = mute
+end
+



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