diff options
author | Bastien Nocera <hadess@hadess.net> | 2019-07-12 16:16:43 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2019-07-16 08:55:10 +0000 |
commit | c4b21bb799b74dce04fd7da764407ab614ec3575 (patch) | |
tree | b010b3d8aad9ac7a7957ae593e828a354b34312c /src/plugins | |
parent | cd9e4d29a15ed0bd001ceeb0563ae1fdc048991e (diff) | |
download | totem-c4b21bb799b74dce04fd7da764407ab614ec3575.tar.gz |
lirc: Remove lirc plugin
The lirc plugin does not work in Flatpak, and the benefits that lirc
brought are largely matched by Wayland and the native remote controls
support in the Linux kernel.
Closes: #303
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/lirc/lirc.plugin.desktop.in | 8 | ||||
-rw-r--r-- | src/plugins/lirc/meson.build | 31 | ||||
-rw-r--r-- | src/plugins/lirc/totem-lirc.c | 296 | ||||
-rw-r--r-- | src/plugins/lirc/totem_lirc_default | 228 | ||||
-rw-r--r-- | src/plugins/meson.build | 12 |
5 files changed, 0 insertions, 575 deletions
diff --git a/src/plugins/lirc/lirc.plugin.desktop.in b/src/plugins/lirc/lirc.plugin.desktop.in deleted file mode 100644 index 705c748ff..000000000 --- a/src/plugins/lirc/lirc.plugin.desktop.in +++ /dev/null @@ -1,8 +0,0 @@ -[Plugin] -Module=lirc -IAge=1 -Name=Infrared Remote Control -Description=Support infrared remote control -Authors=Jan Arne Petersen -Copyright=Copyright © 2007 Jan Arne Petersen -Website=http://www.gnome.org/projects/totem/ diff --git a/src/plugins/lirc/meson.build b/src/plugins/lirc/meson.build deleted file mode 100644 index f71b70af3..000000000 --- a/src/plugins/lirc/meson.build +++ /dev/null @@ -1,31 +0,0 @@ -plugin_name = 'lirc' - -plugin_dir = join_paths(totem_pluginsdir, plugin_name) - -shared_module( - plugin_name, - sources: 'totem-' + plugin_name + '.c', - include_directories: plugins_incs, - dependencies: plugins_deps + [ - lirc_dep - ], - c_args: plugins_cflags, - install: true, - install_dir: plugin_dir -) - -plugin_data = plugin_name + '.plugin' - -custom_target( - plugin_data, - input: plugin_data + '.desktop.in', - output: plugin_data, - command: msgfmt_plugin_cmd, - install: true, - install_dir: plugin_dir -) - -install_data( - 'totem_lirc_default', - install_dir: plugin_dir -) diff --git a/src/plugins/lirc/totem-lirc.c b/src/plugins/lirc/totem-lirc.c deleted file mode 100644 index a5479535c..000000000 --- a/src/plugins/lirc/totem-lirc.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (C) 2002 James Willcox <jwillcox@gnome.org> - * (C) 2007 Jan Arne Petersen <jpetersen@jpetersen.org> - * - * 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 of the License, or - * (at your option) any later 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * - * The Totem project hereby grant permission for non-gpl compatible GStreamer - * plugins to be used and distributed together with GStreamer and Totem. This - * permission are above and beyond the permissions granted by the GPL license - * Totem is covered by. - * - * Monday 7th February 2005: Christian Schaller: Add exception clause. - * See license_change file for details. - * - */ - - -#include <config.h> - -#include <glib.h> -#include <glib-object.h> -#include <glib/gi18n-lib.h> -#include <string.h> -#include <libpeas/peas-extension-base.h> -#include <libpeas/peas-object-module.h> -#include <libpeas/peas-activatable.h> -#include <unistd.h> -#include <lirc/lirc_client.h> - -#include "totem-plugin.h" -#include "totem.h" -#include "totem-dirs.h" - -#define TOTEM_TYPE_LIRC_PLUGIN (totem_lirc_plugin_get_type ()) -#define TOTEM_LIRC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), TOTEM_TYPE_LIRC_PLUGIN, TotemLircPlugin)) -#define TOTEM_LIRC_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), TOTEM_TYPE_LIRC_PLUGIN, TotemLircPluginClass)) -#define TOTEM_IS_LIRC_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), TOTEM_TYPE_LIRC_PLUGIN)) -#define TOTEM_IS_LIRC_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), TOTEM_TYPE_LIRC_PLUGIN)) -#define TOTEM_LIRC_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TOTEM_TYPE_LIRC_PLUGIN, TotemLircPluginClass)) - -typedef struct { - GIOChannel *lirc_channel; - struct lirc_config *lirc_config; - - TotemObject *totem; -} TotemLircPluginPrivate; - -/* strings that we recognize as commands from lirc */ -#define TOTEM_IR_COMMAND_PLAY "play" -#define TOTEM_IR_COMMAND_PAUSE "pause" -#define TOTEM_IR_COMMAND_STOP "stop" -#define TOTEM_IR_COMMAND_NEXT "next" -#define TOTEM_IR_COMMAND_PREVIOUS "previous" -#define TOTEM_IR_COMMAND_SEEK_FORWARD "seek_forward" -#define TOTEM_IR_COMMAND_SEEK_BACKWARD "seek_backward" -#define TOTEM_IR_COMMAND_VOLUME_UP "volume_up" -#define TOTEM_IR_COMMAND_VOLUME_DOWN "volume_down" -#define TOTEM_IR_COMMAND_FULLSCREEN "fullscreen" -#define TOTEM_IR_COMMAND_QUIT "quit" -#define TOTEM_IR_COMMAND_UP "up" -#define TOTEM_IR_COMMAND_DOWN "down" -#define TOTEM_IR_COMMAND_LEFT "left" -#define TOTEM_IR_COMMAND_RIGHT "right" -#define TOTEM_IR_COMMAND_SELECT "select" -#define TOTEM_IR_COMMAND_MENU "menu" -#define TOTEM_IR_COMMAND_PLAYPAUSE "play_pause" -#define TOTEM_IR_COMMAND_ZOOM_UP "zoom_up" -#define TOTEM_IR_COMMAND_ZOOM_DOWN "zoom_down" -#define TOTEM_IR_COMMAND_EJECT "eject" -#define TOTEM_IR_COMMAND_PLAY_DVD "play_dvd" -#define TOTEM_IR_COMMAND_MUTE "mute" -#define TOTEM_IR_COMMAND_TOGGLE_ASPECT "toggle_aspect" - -#define TOTEM_IR_SETTING "setting_" -#define TOTEM_IR_SETTING_TOGGLE_REPEAT "setting_repeat" - -TOTEM_PLUGIN_REGISTER(TOTEM_TYPE_LIRC_PLUGIN, TotemLircPlugin, totem_lirc_plugin) - -static char * -totem_lirc_get_url (const char *str) -{ - char *s; - - if (str == NULL) - return NULL; - s = strchr (str, ':'); - if (s == NULL) - return NULL; - return g_strdup (s + 1); -} - -static gint -totem_lirc_to_setting (const gchar *str, char **url) -{ - if (strcmp (str, TOTEM_IR_SETTING_TOGGLE_REPEAT) == 0) - return TOTEM_REMOTE_SETTING_REPEAT; - else - return -1; -} - -static TotemRemoteCommand -totem_lirc_to_command (const gchar *str, char **url) -{ - if (strcmp (str, TOTEM_IR_COMMAND_PLAY) == 0) - return TOTEM_REMOTE_COMMAND_PLAY; - else if (strcmp (str, TOTEM_IR_COMMAND_PAUSE) == 0) - return TOTEM_REMOTE_COMMAND_PAUSE; - else if (strcmp (str, TOTEM_IR_COMMAND_PLAYPAUSE) == 0) - return TOTEM_REMOTE_COMMAND_PLAYPAUSE; - else if (strcmp (str, TOTEM_IR_COMMAND_STOP) == 0) - return TOTEM_REMOTE_COMMAND_STOP; - else if (strcmp (str, TOTEM_IR_COMMAND_NEXT) == 0) - return TOTEM_REMOTE_COMMAND_NEXT; - else if (strcmp (str, TOTEM_IR_COMMAND_PREVIOUS) == 0) - return TOTEM_REMOTE_COMMAND_PREVIOUS; - else if (g_str_has_prefix (str, TOTEM_IR_COMMAND_SEEK_FORWARD) != FALSE) { - *url = totem_lirc_get_url (str); - return TOTEM_REMOTE_COMMAND_SEEK_FORWARD; - } else if (g_str_has_prefix (str, TOTEM_IR_COMMAND_SEEK_BACKWARD) != FALSE) { - *url = totem_lirc_get_url (str); - return TOTEM_REMOTE_COMMAND_SEEK_BACKWARD; - } else if (strcmp (str, TOTEM_IR_COMMAND_VOLUME_UP) == 0) - return TOTEM_REMOTE_COMMAND_VOLUME_UP; - else if (strcmp (str, TOTEM_IR_COMMAND_VOLUME_DOWN) == 0) - return TOTEM_REMOTE_COMMAND_VOLUME_DOWN; - else if (strcmp (str, TOTEM_IR_COMMAND_FULLSCREEN) == 0) - return TOTEM_REMOTE_COMMAND_FULLSCREEN; - else if (strcmp (str, TOTEM_IR_COMMAND_QUIT) == 0) - return TOTEM_REMOTE_COMMAND_QUIT; - else if (strcmp (str, TOTEM_IR_COMMAND_UP) == 0) - return TOTEM_REMOTE_COMMAND_UP; - else if (strcmp (str, TOTEM_IR_COMMAND_DOWN) == 0) - return TOTEM_REMOTE_COMMAND_DOWN; - else if (strcmp (str, TOTEM_IR_COMMAND_LEFT) == 0) - return TOTEM_REMOTE_COMMAND_LEFT; - else if (strcmp (str, TOTEM_IR_COMMAND_RIGHT) == 0) - return TOTEM_REMOTE_COMMAND_RIGHT; - else if (strcmp (str, TOTEM_IR_COMMAND_SELECT) == 0) - return TOTEM_REMOTE_COMMAND_SELECT; - else if (strcmp (str, TOTEM_IR_COMMAND_MENU) == 0) - return TOTEM_REMOTE_COMMAND_DVD_MENU; - else if (strcmp (str, TOTEM_IR_COMMAND_ZOOM_UP) == 0) - return TOTEM_REMOTE_COMMAND_ZOOM_UP; - else if (strcmp (str, TOTEM_IR_COMMAND_ZOOM_DOWN) == 0) - return TOTEM_REMOTE_COMMAND_ZOOM_DOWN; - else if (strcmp (str, TOTEM_IR_COMMAND_EJECT) == 0) - return TOTEM_REMOTE_COMMAND_EJECT; - else if (strcmp (str, TOTEM_IR_COMMAND_PLAY_DVD) == 0) - return TOTEM_REMOTE_COMMAND_PLAY_DVD; - else if (strcmp (str, TOTEM_IR_COMMAND_MUTE) == 0) - return TOTEM_REMOTE_COMMAND_MUTE; - else if (strcmp (str, TOTEM_IR_COMMAND_TOGGLE_ASPECT) == 0) - return TOTEM_REMOTE_COMMAND_TOGGLE_ASPECT; - else - return TOTEM_REMOTE_COMMAND_UNKNOWN; -} - -static gboolean -totem_lirc_read_code (GIOChannel *source, GIOCondition condition, TotemLircPlugin *pi) -{ - char *code; - char *str = NULL, *url = NULL; - int ok; - TotemRemoteCommand cmd; - - if (condition & (G_IO_ERR | G_IO_HUP)) { - /* LIRC connection broken. */ - return FALSE; - } - - /* this _could_ block, but it shouldn't */ - lirc_nextcode (&code); - - if (code == NULL) { - /* the code was incomplete or something */ - return TRUE; - } - - do { - ok = lirc_code2char (pi->priv->lirc_config, code, &str); - - if (ok != 0) { - /* Couldn't convert lirc code to string. */ - break; - } - - if (str == NULL) { - /* there was no command associated with the code */ - break; - } - - if (g_str_has_prefix (str, TOTEM_IR_SETTING) != FALSE) { - gint setting = totem_lirc_to_setting (str, &url); - if (setting >= 0) { - gboolean value; - - value = totem_object_remote_get_setting (pi->priv->totem, setting); - totem_object_remote_set_setting (pi->priv->totem, setting, !value); - } - } else { - cmd = totem_lirc_to_command (str, &url); - totem_object_remote_command (pi->priv->totem, cmd, url); - } - g_free (url); - } while (TRUE); - - g_free (code); - - return TRUE; -} - -static void -impl_activate (PeasActivatable *plugin) -{ - TotemLircPlugin *pi = TOTEM_LIRC_PLUGIN (plugin); - char *path; - int fd; - - pi->priv->totem = g_object_ref (g_object_get_data (G_OBJECT (plugin), "object")); - - fd = lirc_init ((char*) "Totem", 0); - if (fd < 0) { - //FIXME -#if 0 - g_set_error_literal (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION, - _("Couldn’t initialize lirc.")); - return FALSE; -#endif - } - - /* Load the default Totem setup */ - path = totem_plugin_find_file ("lirc", "totem_lirc_default"); - if (path == NULL || lirc_readconfig (path, &pi->priv->lirc_config, NULL) == -1) { - g_free (path); - //FIXME -#if 0 - g_set_error_literal (error, TOTEM_PLUGIN_ERROR, TOTEM_PLUGIN_ERROR_ACTIVATION, - _("Couldn’t read lirc configuration.")); -#endif - close (fd); - return; - } - g_free (path); - - /* Load the user config, doesn't matter if it's not there */ - lirc_readconfig (NULL, &pi->priv->lirc_config, NULL); - - pi->priv->lirc_channel = g_io_channel_unix_new (fd); - g_io_channel_set_encoding (pi->priv->lirc_channel, NULL, NULL); - g_io_channel_set_buffered (pi->priv->lirc_channel, FALSE); - g_io_add_watch (pi->priv->lirc_channel, G_IO_IN | G_IO_ERR | G_IO_HUP, - (GIOFunc) totem_lirc_read_code, pi); -} - -static void -impl_deactivate (PeasActivatable *plugin) -{ - TotemLircPlugin *pi = TOTEM_LIRC_PLUGIN (plugin); - GError *error = NULL; - - if (pi->priv->lirc_channel) { - g_io_channel_shutdown (pi->priv->lirc_channel, FALSE, &error); - if (error != NULL) { - g_warning ("Couldn't destroy lirc connection: %s", - error->message); - g_error_free (error); - } - pi->priv->lirc_channel = NULL; - } - - if (pi->priv->lirc_config) { - lirc_freeconfig (pi->priv->lirc_config); - pi->priv->lirc_config = NULL; - - lirc_deinit (); - } - - if (pi->priv->totem) { - g_object_unref (pi->priv->totem); - pi->priv->totem = NULL; - } -} - diff --git a/src/plugins/lirc/totem_lirc_default b/src/plugins/lirc/totem_lirc_default deleted file mode 100644 index 2eb32cf82..000000000 --- a/src/plugins/lirc/totem_lirc_default +++ /dev/null @@ -1,228 +0,0 @@ -# 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_STOP - repeat = 0 - config = stop -end - -# For seek_forward and seek_backward you can -# append ":20" to seek 20 seconds in the -# aforementioned direction -# -# Eg. seek_forward:60 -> seek forward 60 seconds -# seek_backward:5 -> seek backwards 5 seconds -begin - prog = Totem - remote = * - button = KEY_FASTFORWARD - repeat = 1 - config = seek_forward -end - -begin - prog = Totem - remote = * - button = KEY_FORWARD - 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_OK - 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 - -begin - prog = Totem - remote = * - button = KEY_MEDIA_REPEAT - repeat = 1 - config = setting_repeat -end - -begin - prog = Totem - remote = * - button = KEY_ZOOMIN - repeat = 1 - config = zoom_up -end - -begin - prog = Totem - remote = * - button = KEY_ZOOMOUT - repeat = 1 - config = zoom_down -end - diff --git a/src/plugins/meson.build b/src/plugins/meson.build index be6482d08..13e801974 100644 --- a/src/plugins/meson.build +++ b/src/plugins/meson.build @@ -18,7 +18,6 @@ allowed_plugins = [ 'brasero-disc-recorder', 'dbusservice', 'im-status', - 'lirc', 'media-player-keys', 'open-directory', 'opensubtitles', @@ -58,17 +57,6 @@ if plugins_option != 'none' plugin_error = (plugins_option == 'all') - lirc_dep = dependency('lirc', required: false) - if lirc_dep.found() and cc.has_function('lirc_init', dependencies: lirc_dep) and cc.has_header('lirc/lirc_client.h') - plugins += 'lirc' - else - str = 'you need lirc_client installed for the lirc plugin' - if plugin_error - error(str) - endif - message(str) - endif - libxml_req_version = '>= 2.6.0' libxml_dep = dependency('libxml-2.0', version: libxml_req_version, required: false) gtk_x11_dep = dependency('gtk+-x11-3.0', version: gtk_req_version, required: false) |