writeas-gtk/src/application.vala

28 lines
775 B
Vala
Raw Normal View History

2018-04-16 22:34:21 +00:00
public class WriteAs.Application : Gtk.Application {
construct {
this.flags |= ApplicationFlags.HANDLES_OPEN;
2018-04-16 22:34:21 +00:00
Intl.setlocale(LocaleCategory.ALL, "");
Intl.textdomain("write.as");
2018-04-19 20:27:05 +00:00
application_id = "writeas-gtk.desktop";
2018-04-16 22:34:21 +00:00
}
public override void activate() {
if (get_windows().length() == 0)
2018-04-16 22:42:30 +00:00
new WriteAs.MainWindow(this).show_all();
2018-04-16 22:34:21 +00:00
}
public override void open(File[] files, string hint) {
activate(); // ensure we have a window open.
try {
(get_windows().data as MainWindow).open_file(files[0]);
} catch (Error e) {
error(e.message);
}
}
2018-04-16 22:34:21 +00:00
public static int main(string[] args) {
return new WriteAs.Application().run(args);
}
}