using Hildon;
public class CinaestProgram : Hildon.Program {
- Window window;
+ MovieListWindow window;
+ List<Plugin> plugins;
construct {
- window = new Window ();
+ Environment.set_application_name ("Cinæst");
+
+ window = new MovieListWindow ();
window.destroy.connect (Gtk.main_quit);
add_window (window);
+ }
- Environment.set_application_name ("Cinæst");
+ public void register_plugins () {
+ string plugin_path = Environment.get_variable ("PWD");
+ try {
+ var directory = File.new_for_path (plugin_path);
+ var enumerator = directory.enumerate_children (FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
+
+ FileInfo file_info;
+ while ((file_info = enumerator.next_file (null)) != null) {
+ string name = file_info.get_name ();
+
+ if (name.has_suffix (".so")) {
+ Plugin plugin;
+ string path = Path.build_filename (plugin_path, name, null);
+
+ var registrar = new PluginRegistrar<Plugin> (path);
+ registrar.load ();
+
+ plugin = registrar.new_object ();
+ plugins.append (plugin);
+ plugin.hello (window);
+ }
+ }
+
+ } catch (Error e) {
+ stderr.printf ("Error: %s\n", e.message);
+ }
}
public void run () {
- window.show_all ();
+ register_plugins ();
+ // FIXME - always start with the first plugin's first source for now
+ if (plugins != null) {
+ var plugin = plugins.first ().data;
+ if (plugin != null)
+ window.store.source = plugin.get_sources ().first ().data;
+ }
Gtk.main ();
}
static int main (string[] args) {
Gtk.init (ref args);
+ Gdk.threads_init ();
+
+ Intl.setlocale (LocaleCategory.ALL, "");
+ Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
+ Intl.textdomain (Config.GETTEXT_PACKAGE);
+
+ var osso_context = new Osso.Context ("org.maemo.garage.cinaest", Config.VERSION, true, null);
+ if (osso_context == null) {
+ return Osso.Status.ERROR;
+ }
CinaestProgram app = new CinaestProgram ();
app.run ();