[rygel] core: Commandline option to set plugin title



commit 6b511c287a5aa669e6de8170a76aca9c93dd092f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Jun 11 18:48:49 2009 +0300

    core: Commandline option to set plugin title

 src/rygel/rygel-cmdline-config.vala |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)
---
diff --git a/src/rygel/rygel-cmdline-config.vala b/src/rygel/rygel-cmdline-config.vala
index 9084a0a..ff4f3ed 100644
--- a/src/rygel/rygel-cmdline-config.vala
+++ b/src/rygel/rygel-cmdline-config.vala
@@ -45,6 +45,9 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
     [CCode (array_length = false, array_null_terminated = true)]
     [NoArrayLength]
     private static string[] disabled_plugins;
+    [CCode (array_length = false, array_null_terminated = true)]
+    [NoArrayLength]
+    private static string[] plugin_titles;
 
     // Our singleton
     private static CmdlineConfig config;
@@ -69,6 +72,8 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
         { "disable-plugin", 'd', 0, OptionArg.STRING_ARRAY,
           ref disabled_plugins,
           "Disable plugin", "PluginName" },
+        { "title", 'i', 0, OptionArg.STRING_ARRAY, ref plugin_titles,
+          "Set plugin titles", "PluginName,TITLE" },
         { null }
 	};
 
@@ -142,7 +147,22 @@ public class Rygel.CmdlineConfig : GLib.Object, Configuration {
     }
 
     public string get_title (string section) throws GLib.Error {
-        throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        string title = null;
+        foreach (var plugin_title in plugin_titles) {
+            var tokens = plugin_title.split (",", 2);
+            if (tokens[0] != null &&
+                tokens[1] != null &&
+                tokens[0] == section) {
+                title = tokens[1];
+                break;
+            }
+        }
+
+        if (title != null) {
+            return title;
+        } else {
+            throw new ConfigurationError.NO_VALUE_SET ("No value available");
+        }
     }
 
     // Dynamic options



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