2017-03-10 18:34:56 +00:00
|
|
|
using Dino.Entities;
|
|
|
|
using Dino.Ui;
|
|
|
|
|
2017-04-07 09:09:47 +00:00
|
|
|
extern const string GETTEXT_PACKAGE;
|
|
|
|
extern const string LOCALE_INSTALL_DIR;
|
|
|
|
|
2017-03-10 18:34:56 +00:00
|
|
|
namespace Dino {
|
|
|
|
|
|
|
|
void main(string[] args) {
|
2017-04-07 09:09:47 +00:00
|
|
|
|
2017-03-12 12:19:04 +00:00
|
|
|
try{
|
2017-03-12 13:42:04 +00:00
|
|
|
string? exec_path = args.length > 0 ? args[0] : null;
|
2017-04-07 09:09:47 +00:00
|
|
|
SearchPathGenerator search_path_generator = new SearchPathGenerator(exec_path);
|
2017-03-12 13:42:04 +00:00
|
|
|
if (exec_path != null && exec_path.contains(Path.DIR_SEPARATOR_S)) {
|
|
|
|
string bindir = Path.get_dirname(exec_path);
|
|
|
|
if (FileUtils.test(Path.build_filename(bindir, "gschemas.compiled"), FileTest.IS_REGULAR)) {
|
|
|
|
Environment.set_variable("GSETTINGS_SCHEMA_DIR", Path.get_dirname(exec_path), false);
|
|
|
|
}
|
|
|
|
}
|
2017-04-07 09:09:47 +00:00
|
|
|
Intl.textdomain(GETTEXT_PACKAGE);
|
|
|
|
internationalize(GETTEXT_PACKAGE, search_path_generator.get_locale_path(GETTEXT_PACKAGE, LOCALE_INSTALL_DIR));
|
|
|
|
|
2017-03-12 13:42:04 +00:00
|
|
|
Plugins.Loader loader = new Plugins.Loader(exec_path);
|
2017-03-12 12:19:04 +00:00
|
|
|
Gtk.init(ref args);
|
2017-04-07 09:09:47 +00:00
|
|
|
Dino.Ui.Application app = new Dino.Ui.Application() { search_path_generator=search_path_generator };
|
2017-03-23 16:10:45 +00:00
|
|
|
|
2017-04-03 12:10:17 +00:00
|
|
|
app.add_main_option("plugin-paths", 0, 0, OptionArg.NONE, "Display plugin search paths and exit", null);
|
2017-03-23 16:10:45 +00:00
|
|
|
app.handle_local_options.connect((options) => {
|
2017-04-03 12:10:17 +00:00
|
|
|
Variant v = options.lookup_value("plugin-paths", VariantType.BOOLEAN);
|
|
|
|
if (v != null && v.get_boolean()) {
|
2017-03-23 16:10:45 +00:00
|
|
|
loader.print_search_paths();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
});
|
|
|
|
|
2017-03-12 12:19:04 +00:00
|
|
|
foreach (string plugin in new string[]{"omemo", "openpgp"}) {
|
|
|
|
try {
|
|
|
|
loader.load(plugin, app);
|
|
|
|
} catch (Error e) {
|
|
|
|
print(@"Error loading plugin $plugin: $(e.message)\n");
|
|
|
|
}
|
2017-03-10 18:34:56 +00:00
|
|
|
}
|
2017-03-12 12:19:04 +00:00
|
|
|
app.run(args);
|
|
|
|
loader.shutdown();
|
|
|
|
} catch (Error e) {
|
|
|
|
print(@"Fatal error: $(e.message)\n");
|
2017-03-10 18:34:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|