From a5cf0529d5702c5dcfae46836366b5adc0ed8cc5 Mon Sep 17 00:00:00 2001 From: Shivang Gangadia Date: Thu, 26 Sep 2024 20:00:15 +0100 Subject: [PATCH 1/2] Moved app menu to the menu bar to ensure consistent appearance across desktops. --- src/juci.cpp | 9 +------- src/menu.cpp | 61 ++++++++++++++++++++++++++-------------------------- 2 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/juci.cpp b/src/juci.cpp index b50656b..b7e1487 100644 --- a/src/juci.cpp +++ b/src/juci.cpp @@ -121,14 +121,7 @@ void Application::on_startup() { Gtk::Application::on_startup(); Menu::get().build(); - - if(!Menu::get().juci_menu || !Menu::get().window_menu) { - std::cerr << "Menu not found." << std::endl; - } - else { - set_app_menu(Menu::get().juci_menu); - set_menubar(Menu::get().window_menu); - } + set_menubar(Menu::get().window_menu); } Application::Application() : Gtk::Application("no.sout.juci", Gio::APPLICATION_NON_UNIQUE | Gio::APPLICATION_HANDLES_COMMAND_LINE) { diff --git a/src/menu.cpp b/src/menu.cpp index 2f819a7..11846ba 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -87,38 +87,39 @@ const Glib::ustring menu_xml = R"RAW( - -
- - _About - app.about - -
-
- - _Preferences - app.preferences - -
-
- - _Snippets - app.snippets - - - _Commands - app.commands - -
-
- - _Quit - app.quit - -
-
+ + _juci++ +
+ + _About + app.about + +
+
+ + _Preferences + app.preferences + +
+
+ + _Snippets + app.snippets + + + _Commands + app.commands + +
+
+ + _Quit + app.quit + +
+
_File
From b4d62864609b2263d8b32a0dced16cca992a2313 Mon Sep 17 00:00:00 2001 From: Shivang Gangadia Date: Thu, 26 Sep 2024 20:02:24 +0100 Subject: [PATCH 2/2] Removed trailing app menu variable --- src/menu.cpp | 4 +--- src/menu.hpp | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/menu.cpp b/src/menu.cpp index 11846ba..f224373 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -612,9 +612,7 @@ void Menu::set_keys() { void Menu::build() { try { builder = Gtk::Builder::create_from_string(menu_xml); - auto object = builder->get_object("juci-menu"); - juci_menu = Glib::RefPtr::cast_dynamic(object); - object = builder->get_object("window-menu"); + auto object = builder->get_object("window-menu"); window_menu = Glib::RefPtr::cast_dynamic(object); object = builder->get_object("right-click-line-menu"); auto ptr = Glib::RefPtr::cast_dynamic(object); diff --git a/src/menu.hpp b/src/menu.hpp index 224ea73..b2e81a1 100644 --- a/src/menu.hpp +++ b/src/menu.hpp @@ -20,7 +20,6 @@ public: void build(); - Glib::RefPtr juci_menu; Glib::RefPtr window_menu; std::unique_ptr right_click_line_menu; std::unique_ptr right_click_selected_menu;