larra/src/application.cpp

48 lines
1.4 KiB
C++
Raw Normal View History

2024-08-26 11:22:03 +00:00
module;
#include <gtkmm.h>
#include <print>
export module larra.application;
namespace larra {
export struct Application : Gtk::Application {
Application() : Gtk::Application("org.larra.larra") {
Glib::set_application_name("Larra");
}
2024-08-26 11:22:03 +00:00
static auto create() -> Glib::RefPtr<Application> {
return Glib::make_refptr_for_instance<Application>(new Application{}); // NOLINT
}
2024-08-26 11:22:03 +00:00
auto on_startup() -> void final {
this->Gtk::Application::on_startup();
this->add_action("preferences", sigc::mem_fun(*this, &Application::OnClickPreferences));
this->add_action("accounts", sigc::mem_fun(*this, &Application::OnClickManageAccounts));
this->add_action("about", sigc::mem_fun(*this, &Application::OnClickAbout));
auto gmenu = Gio::Menu::create();
auto larraMenu = Gio::Menu::create();
larraMenu->append("Preferences", "app.preferences");
auto accountsMenu = Gio::Menu::create();
accountsMenu->append("Manage accounts", "app.accounts");
auto helpMenu = Gio::Menu::create();
helpMenu->append("About", "app.about");
gmenu->append_submenu("Larra", larraMenu);
gmenu->append_submenu("Accounts", accountsMenu);
gmenu->append_submenu("Help", helpMenu);
this->set_menubar(gmenu);
}
2024-08-26 11:22:03 +00:00
auto on_activate() -> void final;
2024-08-26 11:22:03 +00:00
auto OnClickPreferences() -> void {
}
2024-08-26 11:22:03 +00:00
auto OnClickManageAccounts() -> void {
}
2024-08-26 11:22:03 +00:00
auto OnClickAbout() -> void {};
};
} // namespace larra