add Application class

This commit is contained in:
Nikolay Brovko 2020-01-26 01:31:37 +03:00
parent a682844ba1
commit 78a8be9299
No known key found for this signature in database
GPG Key ID: 32258A3DEC9B6F07
2 changed files with 22 additions and 9 deletions

View File

@ -1,8 +1,8 @@
/*
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@ -15,15 +15,28 @@
using Gtk;
int main (string[] args) {
namespace Yggtk {
Gtk.init (ref args);
public class Application : Gtk.Application {
Yggtk.AppWindow window = new Yggtk.AppWindow ();
window.show_all ();
public Application () {
Object (
application_id: "org.yggtk.yggtk",
flags: ApplicationFlags.FLAGS_NONE
);
}
Gtk.main ();
protected override void activate () {
AppWindow window = new AppWindow ();
add_window (window);
window.show ();
}
return 0;
public static int main (string[] args) {
Application app = new Application ();
return app.run (args);
}
}
}

View File

@ -1,5 +1,5 @@
yggtk_sources = [
'main.vala',
'application.vala',
'app-window.vala',
'utils.vala',
]