mpris: Allow to disable the whole module
authorJens Georg <mail@jensge.org>
Thu, 9 Feb 2012 14:15:47 +0000 (16:15 +0200)
committerJens Georg <mail@jensge.org>
Thu, 9 Feb 2012 14:15:47 +0000 (16:15 +0200)
doc/man/rygel.conf.xml
src/plugins/mpris/rygel-mpris-plugin-factory.vala
src/plugins/mpris/rygel-mpris-plugin.vala

index 5235dd0..bc862ae 100644 (file)
@@ -494,6 +494,7 @@ enabled=false</programlisting>
     <para><application>&dhpackage;</application> exposes media players that implement the provider side of this DBus specification as DLNA Digital Media Renderers (DMR) similar to the Playbin plugin. This means that you can easily turn your media player into a DMR by implementing this DBus specification.</para>
     <para>Players that implement this spec and are known to work with <application>&dhpackage;</application> are  <ulink url="http://banshee.fm">Banshee</ulink>, <ulink url="http://www.rhythmbox.org">Rhythmbox</ulink> and <ulink url="http://live.gnome.org/Totem">Totem</ulink>
       </para>
+    <para>You can disable the whole functionality by setting <userinput>enabled=false</userinput> in the <userinput>[MRPIS]</userinput> section of the configuration file.</para>
     <para>The configuration of this plugin is special. Plugin configuration is not done on the plugin but rather per peer that is found providing the MPRIS2 interface. See the following example to set the title for Banshee on MPRIS:</para>
     <para><programlisting>[org.mpris.MediaPlayer2.banshee]
 title=@REALNAME@&apos;s Banshee on @HOSTNAME@</programlisting></para>
index 3c0a5a3..4e3c695 100644 (file)
@@ -29,6 +29,13 @@ using FreeDesktop;
 private MPRIS.PluginFactory plugin_factory;
 
 public void module_init (PluginLoader loader) {
+    if (loader.plugin_disabled (MPRIS.Plugin.MODULE_NAME)) {
+        message ("Module '%s' disabled by user, igoring…",
+                 MPRIS.Plugin.MODULE_NAME);
+
+        return;
+    }
+
     try {
         plugin_factory = new MPRIS.PluginFactory (loader);
     } catch (IOError error) {
index 03c425c..587e037 100644 (file)
@@ -27,6 +27,7 @@ using Rygel.MPRIS.MediaPlayer;
 using FreeDesktop;
 
 public class Rygel.MPRIS.Plugin : Rygel.MediaRendererPlugin {
+    public const string MODULE_NAME = "MPRIS";
     private const string MEDIA_PLAYER_PATH = "/org/mpris/MediaPlayer2";
 
     public PlayerProxy actual_player;