build,core,plugins: Port to GDBus and GVariant
[profile/ivi/rygel.git] / src / plugins / tracker / rygel-tracker-plugin-factory.vala
1 /*
2  * Copyright (C) 2009 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
3  * Copyright (C) 2009 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 Rygel;
26 using Gee;
27
28 private Tracker.PluginFactory plugin_factory;
29
30 public void module_init (PluginLoader loader) {
31     try {
32         plugin_factory = new Tracker.PluginFactory (loader);
33     } catch (IOError err) {
34         warning (_("Failed to start Tracker service: %s. Plugin disabled.") +
35                  err.message);
36     }
37 }
38
39 public class Rygel.Tracker.PluginFactory {
40     private const string TRACKER_SERVICE = "org.freedesktop.Tracker1";
41     private const string STATISTICS_OBJECT =
42                                         "/org/freedesktop/Tracker1/Statistics";
43
44     StatsIface stats;
45     PluginLoader loader;
46
47     public PluginFactory (PluginLoader loader) throws IOError {
48         this.stats = Bus.get_proxy_sync (BusType.SESSION,
49                                           TRACKER_SERVICE,
50                                           STATISTICS_OBJECT);
51         this.loader = loader;
52
53         this.stats.get_statistics ();
54
55         this.loader.add_plugin (new Tracker.Plugin ());
56     }
57 }
58