GTK docking interfaces and more

By using this site, you agree to have cookies stored on your device, strictly for functional purposes, such as storing your session and preferences.

Dismiss

More menu options

roundabout,
created on Friday, 27 June 2025, 10:31:49 (1751020309), received on Friday, 27 June 2025, 10:31:52 (1751020312)
Author identity: vlad <vlad.muntoiu@gmail.com>

0286ad0a89d149cb222e8be1a59c9a75fc7bf25d

panthera-www.cc

@@ -315,11 +315,14 @@ private:

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                gPanthera::ContentPage *controlled_page = nullptr;
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            public:
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                friend class PantheraWww;
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            explicit PantheraWindow(Glib::RefPtr<Gtk::Application> const &application) : Gtk::ApplicationWindow(application) {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                auto panthera = dynamic_cast<PantheraWww*>(application.get());
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            explicit PantheraWindow(Gtk::Application *application) : Gtk::ApplicationWindow() {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                // There is a constructor with Glib::RefPtr<Gtk::Application>, but it is not appropriate
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                // because the window will own the application, creating a cycle
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                auto panthera = dynamic_cast<PantheraWww*>(application);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    if(!panthera) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        throw std::runtime_error("Application is not a PantheraWww instance");
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                panthera->add_window(*this);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    this->set_default_size(800, 600);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    layout_manager = std::make_shared<gPanthera::LayoutManager>();
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -451,27 +454,40 @@ public:

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    auto reload_button = Gtk::make_managed<Gtk::Button>();
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    reload_button->set_child(*Gtk::make_managed<Gtk::Image>(Gio::Icon::create("view-refresh-symbolic")));
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    reload_button->set_tooltip_text("Reload");
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                back_button->signal_clicked().connect([this, panthera]() {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                auto back_action = Gio::SimpleAction::create("go_back");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                add_action(back_action);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                back_action->signal_activate().connect([this, panthera](const Glib::VariantBase&) {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if(controlled_page) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            if(auto webview = WEBKIT_WEB_VIEW(controlled_page->get_child()->get_first_child()->gobj())) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                webkit_web_view_go_back(webview);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                forward_button->signal_clicked().connect([this, panthera]() {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                back_button->set_action_name("win.go_back");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                auto forward_action = Gio::SimpleAction::create("go_forward");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                add_action(forward_action);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                forward_action->signal_activate().connect([this, panthera](const Glib::VariantBase&) {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if(controlled_page) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            if(auto webview = WEBKIT_WEB_VIEW(controlled_page->get_child()->get_first_child()->gobj())) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                webkit_web_view_go_forward(webview);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                reload_button->signal_clicked().connect([this, panthera]() {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                forward_button->set_action_name("win.go_forward");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                auto reload_action = Gio::SimpleAction::create("reload");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                add_action(reload_action);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                reload_action->signal_activate().connect([this, panthera](const Glib::VariantBase&) {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        if(controlled_page) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            if(auto webview = WEBKIT_WEB_VIEW(controlled_page->get_child()->get_first_child()->gobj())) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                                webkit_web_view_reload(webview);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                        }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                reload_button->set_action_name("win.reload");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    // Search bar
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    // TODO: provide history, provide a menu button with the other engines
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                    auto search_bar = Gtk::make_managed<Gtk::Entry>();
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -700,8 +716,7 @@ void PantheraWww::on_new_tab(gPanthera::ContentStack *stack, const Glib::ustring

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            PantheraWindow *PantheraWww::make_window() {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            Glib::RefPtr<Gtk::Application> self_ref = Glib::make_refptr_for_instance<Gtk::Application>(this);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            auto window = Gtk::make_managed<PantheraWindow>(self_ref);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            auto window = Gtk::make_managed<PantheraWindow>(this);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                return window;
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            }
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -774,7 +789,7 @@ void PantheraWww::on_startup() {

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                add_action(new_tab_action);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                set_accels_for_action("app.new_tab", {"<Primary>T"});
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("New tab"), "app.new_tab");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            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&) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -785,7 +800,7 @@ void PantheraWww::on_startup() {

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                add_action(close_tab_action);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                set_accels_for_action("app.close_tab", {"<Primary>W"});
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("Close tab"), "app.close_tab");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("_Close Tab"), "app.close_tab");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                // New window
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                auto new_window_action = Gio::SimpleAction::create("new_window");
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                new_window_action->signal_activate().connect([this](const Glib::VariantBase&) {
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        

@@ -793,9 +808,33 @@ void PantheraWww::on_startup() {

                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                });
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                add_action(new_window_action);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                set_accels_for_action("app.new_window", {"<Primary>N"});
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("New window"), "app.new_window");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("_New Window"), "app.new_window");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // Quit
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            auto quit_action = Gio::SimpleAction::create("quit");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            quit_action->signal_activate().connect([this](const Glib::VariantBase&) {
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                                quit();
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            });
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            add_action(quit_action);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            set_accels_for_action("app.quit", {"<Primary>Q"});
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            file_menu->append(_("_Quit"), "app.quit");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            main_menu->append_submenu(_("_File"), file_menu);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // Go
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            auto go_menu = Gio::Menu::create();
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // Back
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            go_menu->append(_("_Back"), "win.go_back");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // Forward
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            go_menu->append(_("_Forward"), "win.go_forward");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            main_menu->append_submenu(_("_Go"), go_menu);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                        
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // View
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            auto view_menu = Gio::Menu::create();
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            // Reload
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            view_menu->append(_("_Reload"), "win.reload");
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            main_menu->append_submenu(_("File"), file_menu);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            main_menu->append_submenu(_("_View"), view_menu);
                                        
                                        
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                                set_menubar(main_menu);
                                        
                                        
                                            
                                            
                                            
                                            
                                        
                                    
                                
                                
                                
                            
                                
                                    
                                        
                                            
                                            }