audrey/src/application.vala
2024-10-13 09:41:01 +00:00

46 lines
1.4 KiB
Vala

Subsonic public_api;
public class Application : Adw.Application {
public Application () {
Object (
application_id: "eu.callcc.audrey",
flags: ApplicationFlags.DEFAULT_FLAGS
);
}
construct {
ActionEntry[] action_entries = {
{ "about", this.on_about_action },
{ "preferences", this.on_preferences_action },
{ "quit", this.quit }
};
this.add_action_entries (action_entries, this);
this.set_accels_for_action ("app.quit", {"<primary>q"});
}
public override void activate () {
base.activate ();
// if this.active_window not null, this isnt the primary instance
var win = this.active_window ?? new Ui.Window (this);
win.present ();
}
private void on_about_action () {
string[] developers = { "Erica Z" };
var about = new Adw.AboutDialog () {
application_name = "audrey",
application_icon = "eu.callcc.audrey",
developer_name = "Erica Z",
translator_credits = _("translator-credits"),
version = "0.1.0", // AUDREY_VERSION
developers = developers,
copyright = "© 2024 Erica Z",
};
about.present (this.active_window);
}
private void on_preferences_action () {
message ("app.preferences action activated");
}
}