1 /* This file is part of Cinaest.
3 * Copyright (C) 2009 Philipp Zabel
5 * Cinaest is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * Cinaest is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Cinaest. If not, see <http://www.gnu.org/licenses/>.
21 public class CinaestProgram : Hildon.Program {
22 SourceListWindow window;
23 public static List<Plugin> plugins;
26 Environment.set_application_name ("Cinæst");
28 window = new SourceListWindow ();
29 window.destroy.connect (Gtk.main_quit);
34 public void register_plugins (Osso.Context context) {
35 string plugin_path = Config.PKGLIBDIR;
37 var directory = File.new_for_path (plugin_path);
38 var enumerator = directory.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
41 while ((file_info = enumerator.next_file (null)) != null) {
42 string name = file_info.get_name ();
44 if (name.has_suffix (".so")) {
46 string path = Path.build_filename (plugin_path, name, null);
48 var registrar = new PluginRegistrar<Plugin> (path);
51 plugin = registrar.new_object ();
52 plugins.append (plugin);
53 plugin.hello (window, context);
58 stderr.printf ("Error: %s\n", e.message);
63 foreach (Plugin plugin in plugins) {
64 window.add_sources (plugin.get_sources ());
69 static int main (string[] args) {
72 Intl.setlocale (LocaleCategory.ALL, "");
73 Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
74 Intl.textdomain (Config.GETTEXT_PACKAGE);
76 var osso_context = new Osso.Context ("org.maemo.cinaest", Config.VERSION, true, null);
77 if (osso_context == null) {
78 return Osso.Status.ERROR;
81 CinaestProgram app = new CinaestProgram ();
82 app.register_plugins (osso_context);