MCPcopy Create free account
hub / github.com/Illation/ETEngine / on_startup

Method on_startup

Engine/source/EtEditor/EditorApp.cpp:146–182  ·  view source on GitHub ↗

--------------------------------- EditorApp::on_startup When the Gtk::Application gets activated we create a window and present it

Source from the content-addressed store, hash-verified

144// When the Gtk::Application gets activated we create a window and present it
145//
146void EditorApp::on_startup()
147{
148 // Call the base class's implementation.
149 Gtk::Application::on_startup();
150
151 // Add actions and keyboard accelerators for the application menu.
152 add_action("preferences", sigc::mem_fun(*this, &EditorApp::OnActionPreferences));
153 add_action("save_layout", sigc::mem_fun(*this, &EditorApp::OnSaveEditorLayout));
154 add_action("quit", sigc::mem_fun(*this, &EditorApp::OnActionQuit));
155 set_accel_for_action("app.quit", "<Ctrl>Q");
156
157 Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
158 try
159 {
160 refBuilder->add_from_resource("/com/leah-lindner/editor/ui/app_menu.ui");
161 }
162 catch (const Glib::Error& ex)
163 {
164 LOG("EditorApp::on_startup > " + std::string(ex.what()), core::LogLevel::Error);
165 return;
166 }
167 catch (std::exception const& ex)
168 {
169 LOG("EditorApp::on_startup > " + std::string(ex.what()), core::LogLevel::Error);
170 return;
171 }
172
173 auto appMenu = Glib::RefPtr<Gio::MenuModel>::cast_dynamic(refBuilder->get_object("appmenu"));
174 if (appMenu)
175 {
176 set_app_menu(appMenu);
177 }
178 else
179 {
180 LOG("EditorApp::on_startup > No 'appmenu' object in app_menu.ui", core::LogLevel::Error);
181 }
182}
183
184//---------------------------------
185// EditorApp::on_activate

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected