/* application.vala * * Copyright 2023 Mubashshir * * 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. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ namespace JadupcSupport { public class Application : Gtk.Application { public Application () { Object (application_id: "com.jadupc.support", flags: ApplicationFlags.FLAGS_NONE); } construct { {var _ = Vte.get_major_version();} // This is useless, but removing this breaks linking with vte ActionEntry[] action_entries = { { "about", this.on_about_action }, { "preferences", this.on_preferences_action }, { "quit", this.quit } }; this.add_action_entries (action_entries, this); } public override void activate () { base.activate (); var win = this.active_window; if (win == null) { // Fix vte issues win = new JadupcSupport.Window (this); this.set_accels_for_action ("app.quit", {"q"}); this.set_accels_for_action ("app.about", {"question"}); this.set_accels_for_action ("app.preferences", {"p"}); var settings = Gtk.Settings.get_default(); if (settings != null) settings.gtk_dialogs_use_header = true; } win.present (); } private void on_about_action () { var info = new Config.Info(); Gtk.show_about_dialog (this.active_window, program_name: _("JaduPc Remote Support Console"), copyright: info.copyright, license_type: Gtk.License.GPL_3_0, logo_icon_name: "com.jadupc.support", authors: info.authors, artists: info.artists, website: "https://jadupc.com", website_label: _("JaduPc Ltd."), version: Config.VERSION); } private void on_preferences_action () { message ("app.preferences action activated"); } } }