diff --git a/src/main.vala b/src/application.vala similarity index 51% rename from src/main.vala rename to src/application.vala index 38138e5..46a23b8 100644 --- a/src/main.vala +++ b/src/application.vala @@ -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); + } + + } } \ No newline at end of file diff --git a/src/meson.build b/src/meson.build index b6fd29d..161f7b0 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,5 +1,5 @@ yggtk_sources = [ - 'main.vala', + 'application.vala', 'app-window.vala', 'utils.vala', ]