Browse Source

Merge branch 'juci_menu_inconsistent' of https://gitlab.com/shivangsgangadia/jucipp-clangd-support

pipelines/1486128344
eidheim 1 year ago
parent
commit
c7dbbcd962
  1. 9
      src/juci.cpp
  2. 65
      src/menu.cpp
  3. 1
      src/menu.hpp

9
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) {

65
src/menu.cpp

@ -87,38 +87,39 @@ const Glib::ustring menu_xml = R"RAW(<interface>
</item>
</section>
</menu>
<menu id='juci-menu'>
<section>
<item>
<attribute name='label' translatable='yes'>_About</attribute>
<attribute name='action'>app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Preferences</attribute>
<attribute name='action'>app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Snippets</attribute>
<attribute name='action'>app.snippets</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Commands</attribute>
<attribute name='action'>app.commands</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Quit</attribute>
<attribute name='action'>app.quit</attribute>
</item>
</section>
</menu>
<menu id='window-menu'>
<submenu id='juci-menu'>
<attribute name='label' translatable='yes'>_juci++</attribute>
<section>
<item>
<attribute name='label' translatable='yes'>_About</attribute>
<attribute name='action'>app.about</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Preferences</attribute>
<attribute name='action'>app.preferences</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Snippets</attribute>
<attribute name='action'>app.snippets</attribute>
</item>
<item>
<attribute name='label' translatable='yes'>_Commands</attribute>
<attribute name='action'>app.commands</attribute>
</item>
</section>
<section>
<item>
<attribute name='label' translatable='yes'>_Quit</attribute>
<attribute name='action'>app.quit</attribute>
</item>
</section>
</submenu>
<submenu>
<attribute name='label' translatable='yes'>_File</attribute>
<section>
@ -611,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<Gio::Menu>::cast_dynamic(object);
object = builder->get_object("window-menu");
auto object = builder->get_object("window-menu");
window_menu = Glib::RefPtr<Gio::Menu>::cast_dynamic(object);
object = builder->get_object("right-click-line-menu");
auto ptr = Glib::RefPtr<Gio::Menu>::cast_dynamic(object);

1
src/menu.hpp

@ -20,7 +20,6 @@ public:
void build();
Glib::RefPtr<Gio::Menu> juci_menu;
Glib::RefPtr<Gio::Menu> window_menu;
std::unique_ptr<Gtk::Menu> right_click_line_menu;
std::unique_ptr<Gtk::Menu> right_click_selected_menu;

Loading…
Cancel
Save