[rygel] external: Allow to disable the whole module



commit 8001556de3a867b0f83604b1800ee4aa4cf562d7
Author: Jens Georg <mail jensge org>
Date:   Thu Feb 9 16:04:34 2012 +0200

    external: Allow to disable the whole module
    
    It was only possible to disable servers on a per-peer base; now it is
    also possible to disable the whole module.

 doc/man/rygel.conf.xml                             |    4 ++++
 .../external/rygel-external-plugin-factory.vala    |    7 +++++++
 src/plugins/external/rygel-external-plugin.vala    |    2 ++
 3 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/doc/man/rygel.conf.xml b/doc/man/rygel.conf.xml
index ab4b321..5235dd0 100644
--- a/doc/man/rygel.conf.xml
+++ b/doc/man/rygel.conf.xml
@@ -481,6 +481,10 @@ man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
   <refsect1>
     <title>External</title>
     <para>The External plugin is an consumer of the <ulink url="http://live.gnome.org/Rygel/MediaServer2Spec";>MediaServer2 DBus interface specification</ulink>. This allows external programs to share their data via UPnP by implementing this DBus specification. The plugin picks up any implementation of this interface on the session bus and exposes the presented media via UPnP. Known implementors of this spec are  <ulink url="http://live.gnome.org/DVBDaemon";>gnome-dvb-daemon</ulink>, <ulink url="http://www.rhythmbox.org";>Rhythmbox</ulink> and <ulink url="http://live.gnome.org/Grilo";>Grilo </ulink> via the grilo-ms2 project.</para>
+    <para>You can disable the whole functionality by setting <userinput>enabled=false</userinput> in the <userinput>[External]</userinput> section of the configuration file.</para>
+    <para>Individual peers may be enabled or disabled by creating sections corresponding to the D-Bus names of the peer:</para>
+    <programlisting>[org.gnome.UPnP.MediaServer2.Rhythmbox]
+enabled=false</programlisting>
     <para>This plugin has no additional options.</para>
   </refsect1>
   <refsect1>
diff --git a/src/plugins/external/rygel-external-plugin-factory.vala b/src/plugins/external/rygel-external-plugin-factory.vala
index 90962ff..8d4f90f 100644
--- a/src/plugins/external/rygel-external-plugin-factory.vala
+++ b/src/plugins/external/rygel-external-plugin-factory.vala
@@ -29,6 +29,13 @@ using FreeDesktop;
 private External.PluginFactory plugin_factory;
 
 public void module_init (PluginLoader loader) {
+    if (loader.plugin_disabled (External.Plugin.MODULE_NAME)) {
+        message ("Module '%s' disabled by user, igoringâ",
+                 External.Plugin.MODULE_NAME);
+
+        return;
+    }
+
     try {
         plugin_factory = new External.PluginFactory (loader);
     } catch (Error error) {
diff --git a/src/plugins/external/rygel-external-plugin.vala b/src/plugins/external/rygel-external-plugin.vala
index f01224c..89a318c 100644
--- a/src/plugins/external/rygel-external-plugin.vala
+++ b/src/plugins/external/rygel-external-plugin.vala
@@ -25,6 +25,8 @@
 using FreeDesktop;
 
 public class Rygel.External.Plugin : Rygel.MediaServerPlugin {
+    public const string MODULE_NAME = "External";
+
     public Plugin (string    service_name,
                    string    title,
                    uint      child_count,



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