[rygel] core: Early ignorance of disabled plugins
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Early ignorance of disabled plugins
- Date: Mon, 26 Oct 2009 17:39:56 +0000 (UTC)
commit 68ef3136d01e937c984737dabf1075e99ed18dd5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Oct 26 19:11:22 2009 +0200
core: Early ignorance of disabled plugins
If a plugin is disabled in the config, the PluginLoader simply
ignores it's request to attach itself to Rygel.
src/rygel/rygel-plugin-loader.vala | 16 +++++++++++++---
src/rygel/rygel-root-device-factory.vala | 11 -----------
2 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/src/rygel/rygel-plugin-loader.vala b/src/rygel/rygel-plugin-loader.vala
index 3460c1f..00fead3 100644
--- a/src/rygel/rygel-plugin-loader.vala
+++ b/src/rygel/rygel-plugin-loader.vala
@@ -54,10 +54,20 @@ public class Rygel.PluginLoader : Object {
}
public void add_plugin (Plugin plugin) {
- this.plugin_hash.set (plugin.name, plugin);
-
- debug ("New plugin '%s' available", plugin.name);
- this.plugin_available (plugin);
+ bool enabled = true;
+ try {
+ var config = MetaConfig.get_default ();
+ enabled = config.get_enabled (plugin.name);
+ } catch (GLib.Error err) {}
+
+ if (enabled) {
+ debug ("New plugin '%s' available", plugin.name);
+ this.plugin_hash.set (plugin.name, plugin);
+ this.plugin_available (plugin);
+ } else {
+ debug ("Plugin '%s' disabled in user configuration, ignoring..",
+ plugin.name);
+ }
}
public Plugin? get_plugin_by_name (string name) {
diff --git a/src/rygel/rygel-root-device-factory.vala b/src/rygel/rygel-root-device-factory.vala
index ffb6d29..4fe3eeb 100644
--- a/src/rygel/rygel-root-device-factory.vala
+++ b/src/rygel/rygel-root-device-factory.vala
@@ -27,7 +27,6 @@ using CStuff;
public errordomain RootDeviceFactoryError {
XML_PARSE,
- PLUGIN_DISABLED
}
/**
@@ -52,16 +51,6 @@ public class Rygel.RootDeviceFactory {
}
public RootDevice create (Plugin plugin) throws GLib.Error {
- bool enabled = true;
- try {
- enabled = this.config.get_enabled (plugin.name);
- } catch (GLib.Error err) {}
-
- if (!enabled) {
- throw new RootDeviceFactoryError.PLUGIN_DISABLED (
- "Plugin disabled in user configuration.");
- }
-
string modified_desc = plugin.name + ".xml";
string desc_path = Path.build_filename (this.desc_dir,
modified_desc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]