Commit 6b237f11 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

plugins: Remove LIRC plugin

parent 71a69a33
......@@ -397,21 +397,6 @@ AM_GNU_GETTEXT([external])
AC_SUBST([GETTEXT_PACKAGE], [rhythmbox])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], "$GETTEXT_PACKAGE", [Define to the gettext package name.])
dnl LIRC
AC_ARG_ENABLE(lirc,
AC_HELP_STRING([--enable-lirc],[enable lirc support]))
with_lirc=no
if test x"$enable_lirc" != xno; then
AC_CHECK_HEADER(lirc/lirc_client.h,[with_lirc=yes],[with_lirc=no])
if test x"$with_lirc" = xyes; then
AC_CHECK_LIB(lirc_client,lirc_init,[with_lirc=yes],[with_lirc=no])
fi
if test x"$with_lirc" = xno -a x"$enable_lirc" = xyes; then
AC_MSG_ERROR([lirc explicitly requested but no support found])
fi
fi
AM_CONDITIONAL(WITH_LIRC, test x"$with_lirc" = xyes)
AC_ARG_ENABLE(uninstalled-build,
AC_HELP_STRING([--enable-uninstalled-build],
[Search for files in build directory as well]),
......@@ -691,7 +676,6 @@ plugins/im-status/Makefile
plugins/ipod/Makefile
plugins/mtpdevice/Makefile
plugins/iradio/Makefile
plugins/lirc/Makefile
plugins/lyrics/Makefile
plugins/pythonconsole/Makefile
plugins/artsearch/Makefile
......
......@@ -1624,74 +1624,5 @@
</tgroup>
</table>
</sect2>
<sect2 id="lirc">
<title>Linux Infrared Remote Control</title>
<para>The <application>&app;</application> includes a plugin for Linux
Infrared Remote Control (LIRC) support. The following command strings are
supported, using the program name 'rhythmbox': </para>
<table frame="none">
<title>Window Shortcuts</title>
<tgroup cols="2" colsep="0" rowsep="0">
<colspec colname="COLSPEC0"/>
<colspec colname="COLSPEC1"/>
<thead>
<row>
<entry>Command string</entry>
<entry>Action</entry>
</row>
</thead>
<tbody>
<row>
<entry> <keycap>play</keycap> </entry>
<entry> <para>Start playback</para> </entry>
</row>
<row>
<entry> <keycap>pause</keycap> </entry>
<entry> <para>Pause playback</para> </entry>
</row>
<row>
<entry> <keycap>playpause</keycap> </entry>
<entry> <para>Toggle between playing and paused</para> </entry>
</row>
<row>
<entry> <keycap>shuffle</keycap> </entry>
<entry> <para>Toggle the shuffle play order</para> </entry>
</row>
<row>
<entry> <keycap>repeat</keycap> </entry>
<entry> <para>Toggle the repeat play order</para> </entry>
</row>
<row>
<entry> <keycap>next</keycap> </entry>
<entry> <para>Skip to the next track</para> </entry>
</row>
<row>
<entry> <keycap>previous</keycap> </entry>
<entry> <para>Skip to the previous track</para> </entry>
</row>
<row>
<entry> <keycap>seek_forward</keycap> </entry>
<entry> <para>Skip 10 seconds forward in the playing track</para> </entry>
</row>
<row>
<entry> <keycap>seek_backward</keycap> </entry>
<entry> <para>Skip 10 seconds backward in the playing track</para> </entry>
</row>
<row>
<entry> <keycap>volume_up</keycap> </entry>
<entry> <para>Increase the playback volume by 10%</para> </entry>
</row>
<row>
<entry> <keycap>volume_down</keycap> </entry>
<entry> <para>Decrease the playback volume by 10%</para> </entry>
</row>
<row>
<entry> <keycap>mute</keycap> </entry>
<entry> <para>Mute the playback</para> </entry>
</row>
</tbody>
</tgroup>
</table>
</sect2>
</sect1>
</article>
......@@ -29,10 +29,6 @@ SUBDIRS += context
endif # ENABLE_PYTHON
if WITH_LIRC
SUBDIRS += lirc
endif
if USE_IPOD
SUBDIRS += ipod
endif
......
plugindir = $(PLUGINDIR)/rblirc
plugindatadir = $(PLUGINDATADIR)/rblirc
plugin_LTLIBRARIES = librblirc.la
librblirc_la_SOURCES = \
rb-lirc-plugin.c
librblirc_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS) -llirc_client
librblirc_la_LIBTOOLFLAGS = --tag=disable-static
librblirc_la_LIBADD = $(top_builddir)/shell/librhythmbox-core.la
configdir = $(plugindatadir)
config_DATA = rhythmbox_lirc_default
AM_CPPFLAGS = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DG_LOG_DOMAIN=\"Rhythmbox\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/metadata \
-I$(top_srcdir)/rhythmdb \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/iradio \
-I$(top_srcdir)/plugins \
-I$(top_srcdir)/shell \
-DPIXMAP_DIR=\""$(datadir)/pixmaps"\" \
-DSHARE_DIR=\"$(pkgdatadir)\" \
-DDATADIR=\""$(datadir)"\" \
$(RHYTHMBOX_CFLAGS)
plugin_in_files = rblirc.plugin.in
%.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)
EXTRA_DIST = $(plugin_in_files) $(config_DATA)
CLEANFILES = $(plugin_DATA)
DISTCLEANFILES = $(plugin_DATA)
/*
* rb-lirc-plugin.c
*
* Copyright (C) 2006 Jonathan Matthew
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* The Rhythmbox authors hereby grant permission for non-GPL compatible
* GStreamer plugins to be used and distributed together with GStreamer
* and Rhythmbox. This permission is above and beyond the permissions granted
* by the GPL license by which Rhythmbox is covered. If you modify this code
* you may extend this exception to your version of the code, but you are not
* obligated to do so. If you do not wish to do so, delete this exception
* statement from your version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <string.h>
#include <unistd.h>
#include <glib.h>
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gmodule.h>
#include <lirc/lirc_client.h>
#include "rb-plugin-macros.h"
#include "rb-shell.h"
#include "rb-debug.h"
#include "rb-util.h"
#include "rb-shell-player.h"
#include "rb-file-helpers.h"
#define RB_TYPE_LIRC_PLUGIN (rb_lirc_plugin_get_type ())
#define RB_LIRC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_LIRC_PLUGIN, RBLircPlugin))
#define RB_LIRC_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_LIRC_PLUGIN, RBLircPluginClass))
#define RB_IS_LIRC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_LIRC_PLUGIN))
#define RB_IS_LIRC_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_LIRC_PLUGIN))
#define RB_LIRC_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_LIRC_PLUGIN, RBLircPluginClass))
#define RB_IR_COMMAND_PLAY "play"
#define RB_IR_COMMAND_PAUSE "pause"
#define RB_IR_COMMAND_PLAYPAUSE "playpause"
#define RB_IR_COMMAND_STOP "stop"
#define RB_IR_COMMAND_SHUFFLE "shuffle"
#define RB_IR_COMMAND_REPEAT "repeat"
#define RB_IR_COMMAND_NEXT "next"
#define RB_IR_COMMAND_PREVIOUS "previous"
#define RB_IR_COMMAND_SEEK_FORWARD "seek_forward"
#define RB_IR_COMMAND_SEEK_BACKWARD "seek_backward"
#define RB_IR_COMMAND_VOLUME_UP "volume_up"
#define RB_IR_COMMAND_VOLUME_DOWN "volume_down"
#define RB_IR_COMMAND_MUTE "mute"
#define RB_IR_COMMAND_QUIT "quit"
typedef struct
{
PeasExtensionBase parent;
RBShellPlayer *shell_player;
struct lirc_config *lirc_config;
GIOChannel *lirc_channel;
} RBLircPlugin;
typedef struct
{
PeasExtensionBaseClass parent_class;
} RBLircPluginClass;
G_MODULE_EXPORT void peas_register_types (PeasObjectModule *module);
static void rb_lirc_plugin_init (RBLircPlugin *plugin);
RB_DEFINE_PLUGIN (RB_TYPE_LIRC_PLUGIN, RBLircPlugin, rb_lirc_plugin,)
static void
rb_lirc_plugin_init (RBLircPlugin *plugin)
{
rb_debug ("RBLircPlugin initialising");
}
static gboolean
rb_lirc_plugin_read_code (GIOChannel *source,
GIOCondition condition,
RBLircPlugin *plugin)
{
char *code;
char *str = NULL; /* owned by lirc config, must not be freed */
int ok;
gboolean processed = FALSE;
if (condition & (G_IO_ERR | G_IO_HUP)) {
/* TODO: retry after a minute? */
rb_debug ("LIRC connection broken. sorry.");
return FALSE;
}
lirc_nextcode (&code);
if (code == NULL) {
rb_debug ("Got incomplete lirc code");
return TRUE;
}
do {
ok = lirc_code2char (plugin->lirc_config, code, &str);
if (ok != 0) {
rb_debug ("couldn't convert lirc code \"%s\" to string", code);
} else if (str == NULL) {
if (processed == FALSE)
rb_debug ("unknown LIRC code \"%s\"", code);
break;
} else if (strcmp (str, RB_IR_COMMAND_PLAY) == 0) {
gboolean playing;
rb_shell_player_get_playing (plugin->shell_player, &playing, NULL);
if (playing == FALSE)
rb_shell_player_playpause (plugin->shell_player, NULL);
} else if (strcmp (str, RB_IR_COMMAND_PAUSE) == 0) {
rb_shell_player_pause (plugin->shell_player, NULL);
} else if (strcmp (str, RB_IR_COMMAND_PLAYPAUSE) == 0) {
rb_shell_player_playpause (plugin->shell_player, NULL);
} else if (strcmp (str, RB_IR_COMMAND_STOP) == 0) {
rb_shell_player_stop (plugin->shell_player);
} else if (strcmp (str, RB_IR_COMMAND_SHUFFLE) == 0) {
gboolean shuffle;
gboolean repeat;
if (rb_shell_player_get_playback_state (plugin->shell_player, &shuffle, &repeat)) {
rb_shell_player_set_playback_state (plugin->shell_player, !shuffle, repeat);
}
} else if (strcmp (str, RB_IR_COMMAND_REPEAT) == 0) {
gboolean shuffle;
gboolean repeat;
if (rb_shell_player_get_playback_state (plugin->shell_player, &shuffle, &repeat)) {
rb_shell_player_set_playback_state (plugin->shell_player, shuffle, !repeat);
}
} else if (strcmp (str, RB_IR_COMMAND_NEXT) == 0) {
rb_shell_player_do_next (plugin->shell_player, NULL);
} 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, FFWD_OFFSET, NULL);
} else if (strcmp (str, RB_IR_COMMAND_SEEK_BACKWARD) == 0) {
rb_shell_player_seek (plugin->shell_player, -RWD_OFFSET, NULL);
} 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) {
rb_shell_player_set_volume_relative (plugin->shell_player, -0.1, NULL);
} else if (strcmp (str, RB_IR_COMMAND_MUTE) == 0) {
gboolean mute;
if (rb_shell_player_get_mute (plugin->shell_player, &mute, NULL)) {
rb_shell_player_set_mute (plugin->shell_player, !mute, NULL);
}
} else if (strcmp (str,RB_IR_COMMAND_QUIT) == 0) {
RBShell *shell;
g_object_get (plugin, "object", &shell, NULL);
rb_shell_quit (shell, NULL);
g_object_unref (shell);
/* the plugin will have been deactivated, so we can't continue the loop */
break;
}
processed = TRUE;
} while (ok == 0);
g_free (code);
return TRUE;
}
static void
impl_activate (PeasActivatable *bplugin)
{
int fd;
char *path;
RBLircPlugin *plugin = RB_LIRC_PLUGIN (bplugin);
RBShell *shell;
g_object_get (plugin, "object", &shell, NULL);
g_object_get (shell, "shell-player", &plugin->shell_player, NULL);
rb_debug ("Activating lirc plugin");
fd = lirc_init ("Rhythmbox", 1);
if (fd < 0) {
rb_debug ("Couldn't initialize lirc");
g_object_unref (shell);
return;
}
/* Load the default Rhythmbox setup */
path = rb_find_plugin_data_file (G_OBJECT (plugin), "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");
g_object_unref (shell);
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);
g_io_add_watch (plugin->lirc_channel, G_IO_IN | G_IO_ERR | G_IO_HUP,
(GIOFunc) rb_lirc_plugin_read_code, plugin);
g_object_unref (shell);
}
static void
impl_deactivate (PeasActivatable *bplugin)
{
RBLircPlugin *plugin = RB_LIRC_PLUGIN (bplugin);
GError *error = NULL;
rb_debug ("Deactivating lirc plugin");
if (plugin->lirc_channel) {
g_io_channel_shutdown (plugin->lirc_channel, FALSE, &error);
if (error != NULL) {
g_warning ("Couldn't destroy lirc connection: %s",
error->message);
g_error_free (error);
}
plugin->lirc_channel = NULL;
}
if (plugin->lirc_config) {
lirc_freeconfig (plugin->lirc_config);
plugin->lirc_config = NULL;
lirc_deinit ();
}
if (plugin->shell_player) {
g_object_unref (G_OBJECT (plugin->shell_player));
plugin->shell_player = NULL;
}
}
G_MODULE_EXPORT void
peas_register_types (PeasObjectModule *module)
{
rb_lirc_plugin_register_type (G_TYPE_MODULE (module));
peas_object_module_register_extension_type (module,
PEAS_TYPE_ACTIVATABLE,
RB_TYPE_LIRC_PLUGIN);
}
[Plugin]
Module=rblirc
IAge=2
_Name=LIRC
_Description=Control Rhythmbox using an infrared remote control
Authors=Jonathan Matthew <jonathan@d14n.org>
Copyright=Copyright © 2006 Jonathan Matthew
Website=https://wiki.gnome.org/Apps/Rhythmbox
# 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 = KEY_PREVIOUS
repeat = 1
config = 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
......@@ -121,8 +121,6 @@ plugins/ipod/rb-ipod-source.c
plugins/iradio/rb-iradio-source.c
plugins/iradio/rb-station-properties-dialog.c
[type: gettext/glade]plugins/iradio/station-properties.ui
plugins/lirc/rb-lirc-plugin.c
[type: gettext/ini]plugins/lirc/rblirc.plugin.in
[type: gettext/ini]plugins/listenbrainz/listenbrainz.plugin.in
[type: gettext/glade]plugins/listenbrainz/settings.ui
plugins/lyrics/LyricsConfigureDialog.py
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment