build,core,plugins: Port to GDBus and GVariant
[profile/ivi/rygel.git] / src / plugins / tracker / rygel-tracker-root-container.vala
1 /*
2  * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
3  * Copyright (C) 2008 Nokia Corporation.
4  *
5  * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
6  *                               <zeeshan.ali@nokia.com>
7  *
8  * This file is part of Rygel.
9  *
10  * Rygel is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * Rygel is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program; if not, write to the Free Software Foundation,
22  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23  */
24
25 using GUPnP;
26 using Gee;
27
28 /**
29  * Represents the root container for Tracker media content hierarchy.
30  */
31 public class Rygel.Tracker.RootContainer : Rygel.SimpleContainer {
32     public RootContainer (string title) {
33         base.root (title);
34
35         if (this.get_bool_config_without_error ("share-music")) {
36             this.add_child (new Music ("Music", this, "Music"));
37         }
38
39         if (this.get_bool_config_without_error ("share-videos")) {
40             this.add_child (new Videos ("Videos", this, "Videos"));
41         }
42
43         if (this.get_bool_config_without_error ("share-pictures")) {
44             this.add_child (new Pictures ("Pictures", this, "Pictures"));
45         }
46     }
47
48     private bool get_bool_config_without_error (string key) {
49         var value = true;
50         var config = MetaConfig.get_default ();
51
52         try {
53             value = config.get_bool ("Tracker", key);
54         } catch (GLib.Error error) {}
55
56         return value;
57     }
58 }
59