[rygel] tracker: Act on new config options



commit 669851fdf481d06f006e28ef6ed71ae270cc25cf
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 23 17:13:17 2009 +0200

    tracker: Act on new config options
    
    Now user can actually choose which kind of media she wants to share.

 .../tracker/rygel-tracker-root-container.vala      |   25 +++++++++++++++++--
 1 files changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-root-container.vala b/src/plugins/tracker/rygel-tracker-root-container.vala
index 6b2c919..5ab962f 100644
--- a/src/plugins/tracker/rygel-tracker-root-container.vala
+++ b/src/plugins/tracker/rygel-tracker-root-container.vala
@@ -33,9 +33,28 @@ public class Rygel.TrackerRootContainer : Rygel.SimpleContainer {
     public TrackerRootContainer (string title) {
         base.root (title);
 
-        this.add_child (new TrackerMusic ("14", this, "Music"));
-        this.add_child (new TrackerVideos ("15", this, "Videos"));
-        this.add_child (new TrackerPictures ("16", this, "Pictures"));
+        if (this.get_bool_config_without_error ("share-music")) {
+            this.add_child (new TrackerMusic ("14", this, "Music"));
+        }
+
+        if (this.get_bool_config_without_error ("share-videos")) {
+            this.add_child (new TrackerVideos ("15", this, "Videos"));
+        }
+
+        if (this.get_bool_config_without_error ("share-pictures")) {
+            this.add_child (new TrackerPictures ("16", this, "Pictures"));
+        }
+    }
+
+    private bool get_bool_config_without_error (string key) {
+        var value = true;
+        var config = MetaConfig.get_default ();
+
+        try {
+            value = config.get_bool ("Tracker", key);
+        } catch (GLib.Error error) {}
+
+        return value;
     }
 }
 



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