audrey/src/application.vala

47 lines
1.4 KiB
Vala
Raw Normal View History

2024-10-12 20:52:29 +00:00
Subsonic public_api;
2024-10-06 11:21:53 +00:00
2024-10-12 20:52:29 +00:00
public class Application : Adw.Application {
2024-10-06 11:21:53 +00:00
public Application () {
Object (
2024-10-12 20:52:29 +00:00
application_id: "eu.callcc.audrey",
2024-10-06 11:21:53 +00:00
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 ();
2024-10-12 12:28:05 +00:00
// if this.active_window not null, this isnt the primary instance
2024-10-13 09:41:01 +00:00
var win = this.active_window ?? new Ui.Window (this);
2024-10-06 11:21:53 +00:00
win.present ();
}
private void on_about_action () {
string[] developers = { "Erica Z" };
var about = new Adw.AboutDialog () {
2024-10-12 20:52:29 +00:00
application_name = "audrey",
application_icon = "eu.callcc.audrey",
2024-10-06 11:21:53 +00:00
developer_name = "Erica Z",
translator_credits = _("translator-credits"),
2024-10-12 20:52:29 +00:00
version = "0.1.0", // AUDREY_VERSION
2024-10-06 11:21:53 +00:00
developers = developers,
copyright = "© 2024 Erica Z",
};
about.present (this.active_window);
}
private void on_preferences_action () {
message ("app.preferences action activated");
}
}