roundabout,
created on Monday, 23 June 2025, 11:05:00 (1750676700),
received on Monday, 23 June 2025, 11:05:03 (1750676703)
Author identity: vlad <vlad.muntoiu@gmail.com>
ae63ffc8dc9058aacc690969852eedddd4c81c61
panthera-www.cc
@@ -271,7 +271,7 @@ public:
};
class PantheraWww : public Gtk::Application {
Gtk::Window *window = Gtk::make_managed<Gtk::Window>();
Gtk::ApplicationWindow *window = Gtk::make_managed<Gtk::ApplicationWindow>();
protected:
std::shared_ptr<gPanthera::LayoutManager> layout_manager;
std::shared_ptr<gPanthera::ContentManager> content_manager;
@@ -281,6 +281,7 @@ protected:
SearchEngine *default_search_engine = nullptr;
std::shared_ptr<HistoryManager> history_manager;
HistoryViewer *history_viewer = nullptr;
Glib::RefPtr<Gio::Menu> main_menu;
static void load_change_callback(WebKitWebView *object, WebKitLoadEvent load_event, gpointer data) {
if(auto self = static_cast<PantheraWww*>(data)) {
@@ -674,25 +675,6 @@ protected:
std::cout << "Layout changed: " << layout_manager->get_layout_as_json() << std::endl;
});
auto new_tab_action = Gio::SimpleAction::create("new_tab");
new_tab_action->signal_activate().connect([this](const Glib::VariantBase&) {
on_new_tab(nullptr);
});
// Known bug <https://gitlab.gnome.org/GNOME/epiphany/-/issues/2714>:
// JS can't veto the application's accelerators using `preventDefault()`. This is
// not possible in WebKitGTK, or at least I can't find a way to do it.
add_action(new_tab_action);
set_accels_for_action("app.new_tab", {"<Primary>T"});
auto close_tab_action = Gio::SimpleAction::create("close_tab");
close_tab_action->signal_activate().connect([this](const Glib::VariantBase&) {
auto page = content_manager->get_last_operated_page();
if(page) {
page->close();
}
});
add_action(close_tab_action);
set_accels_for_action("app.close_tab", {"<Primary>W"});
// Load settings
new_tab_page = "about:blank";
std::ifstream settings_file_in("settings.json");
@@ -730,8 +712,36 @@ protected:
plugin_file_out.close();
}
auto menu_bar = Gtk::make_managed<Gtk::PopoverMenuBar>();
outer_grid->attach(*menu_bar, 0, 0, 2, 1);
window->set_show_menubar(true);
// Known bug <https://gitlab.gnome.org/GNOME/epiphany/-/issues/2714>:
// JS can't veto the application's accelerators using `preventDefault()`. This is
// not possible in WebKitGTK, or at least I can't find a way to do it.
main_menu = Gio::Menu::create();
// File
auto file_menu = Gio::Menu::create();
// New tab
auto new_tab_action = Gio::SimpleAction::create("new_tab");
new_tab_action->signal_activate().connect([this](const Glib::VariantBase&) {
on_new_tab(nullptr);
});
add_action(new_tab_action);
set_accels_for_action("app.new_tab", {"<Primary>T"});
file_menu->append("New tab", "app.new_tab");
// Close tab
auto close_tab_action = Gio::SimpleAction::create("close_tab");
close_tab_action->signal_activate().connect([this](const Glib::VariantBase&) {
auto page = content_manager->get_last_operated_page();
if(page) {
page->close();
}
});
add_action(close_tab_action);
set_accels_for_action("app.close_tab", {"<Primary>W"});
file_menu->append("Close tab", "app.close_tab");
main_menu->append_submenu("File", file_menu);
set_menubar(main_menu);
}
void on_activate() override {