40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
#include <larra/application.hpp>
|
|
#include <larra/main_window.hpp>
|
|
|
|
namespace larra {
|
|
|
|
auto Application::on_activate() -> void {
|
|
auto win = new MainWindow{*this}; // NOLINT
|
|
this->add_window(*win);
|
|
win->signal_hide().connect([win] {
|
|
delete win; // NOLINT
|
|
});
|
|
win->set_show_menubar();
|
|
win->set_visible(true);
|
|
}
|
|
|
|
auto Application::on_startup() -> void {
|
|
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);
|
|
};
|
|
|
|
auto Application::create() -> Glib::RefPtr<Application> {
|
|
return Glib::make_refptr_for_instance<Application>(new Application{}); // NOLINT
|
|
};
|
|
|
|
} // namespace larra
|