[rygel] mpris: Allow to disable the whole module



commit 85691224004a2e0f770096dab6b5e8b606875c4b
Author: Jens Georg <mail jensge org>
Date:   Thu Feb 9 16:15:47 2012 +0200

    mpris: Allow to disable the whole module

 doc/man/rygel.conf.xml                            |    1 +
 src/plugins/mpris/rygel-mpris-plugin-factory.vala |    7 +++++++
 src/plugins/mpris/rygel-mpris-plugin.vala         |    1 +
 3 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/doc/man/rygel.conf.xml b/doc/man/rygel.conf.xml
index 5235dd0..bc862ae 100644
--- a/doc/man/rygel.conf.xml
+++ b/doc/man/rygel.conf.xml
@@ -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>
diff --git a/src/plugins/mpris/rygel-mpris-plugin-factory.vala b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
index 3c0a5a3..4e3c695 100644
--- a/src/plugins/mpris/rygel-mpris-plugin-factory.vala
+++ b/src/plugins/mpris/rygel-mpris-plugin-factory.vala
@@ -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) {
diff --git a/src/plugins/mpris/rygel-mpris-plugin.vala b/src/plugins/mpris/rygel-mpris-plugin.vala
index 03c425c..587e037 100644
--- a/src/plugins/mpris/rygel-mpris-plugin.vala
+++ b/src/plugins/mpris/rygel-mpris-plugin.vala
@@ -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;



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