roundabout,
created on Monday, 24 March 2025, 10:13:37 (1742811217),
received on Monday, 24 March 2025, 10:13:39 (1742811219)
Author identity: vlad <vlad.muntoiu@gmail.com>
5fc73a4308fc032d4f04ea234c1cc36540f6ce88
gpanthera.cc
@@ -477,6 +477,7 @@ namespace gPanthera {
const auto &widget = static_cast<const Glib::Value<ContentPage*>&>(value).get(); if(auto page = dynamic_cast<ContentPage*>(widget)) { page->lose_visibility();if(page->get_stack() == this && !this->get_first_child()->get_next_sibling()) { // Don't allow splitting if there are no more pages return false;
@@ -498,9 +499,6 @@ namespace gPanthera {
auto new_notebook = Gtk::make_managed<ContentNotebook>(new_stack, new_switcher, this_notebook ? this_notebook->get_tab_position() : Gtk::PositionType::TOP); new_stack->add_page(*page); new_stack->set_visible_child(*page); if(this->get_first_child()) {this->set_visible_child(*this->get_first_child());}if(x < width / 4) { this->make_paned(Gtk::Orientation::HORIZONTAL, Gtk::PackType::START); if(auto paned = dynamic_cast<Gtk::Paned*>(this->get_parent()->get_parent())) {
@@ -666,7 +664,6 @@ namespace gPanthera {
parent_paned->set_end_child(*child); } } else if(auto box = dynamic_cast<Gtk::Box*>(paned->get_parent())) { std::cout << child->get_name() << std::endl;child->insert_after(*box, *paned); paned->unparent(); g_object_unref(child->gobj());
@@ -774,6 +771,7 @@ namespace gPanthera {
context_menu = Gio::Menu::create(); auto action_group = Gio::SimpleActionGroup::create(); this->insert_action_group("win", action_group); auto close_action = Gio::SimpleAction::create("close"); close_action->signal_activate().connect([this](const Glib::VariantBase&) { if(!this->page->signal_close.emit()) {
@@ -787,6 +785,7 @@ namespace gPanthera {
}); action_group->add_action(close_action); context_menu->append(_("Close"), "win.close"); auto close_all_action = Gio::SimpleAction::create("close-all"); close_all_action->signal_activate().connect([this](const Glib::VariantBase&) { for(auto page : collect_children(*this->page->get_stack())) {
@@ -799,6 +798,7 @@ namespace gPanthera {
}); action_group->add_action(close_all_action); context_menu->append(_("Close all"), "win.close-all"); auto close_others_action = Gio::SimpleAction::create("close-others"); close_others_action->signal_activate().connect([this](const Glib::VariantBase&) { for(auto page : collect_children(*this->page->get_stack())) {
@@ -811,6 +811,7 @@ namespace gPanthera {
}); action_group->add_action(close_others_action); context_menu->append(_("Close others"), "win.close-others"); auto detach_action = Gio::SimpleAction::create("detach"); detach_action->signal_activate().connect([this](const Glib::VariantBase&) { auto stack = dynamic_cast<ContentStack*>(this->page->get_stack());
@@ -818,6 +819,7 @@ namespace gPanthera {
}); action_group->add_action(detach_action); context_menu->append(_("New window"), "win.detach"); // TODO: Add more actions: "New window", "Split left", "Split right", "Split top", "Split bottom", "Close all", "Close others", "Close to the right", "Close to the left" this->insert_action_group("win", action_group); // Attach the context menu to the button
@@ -859,6 +861,14 @@ namespace gPanthera {
return this->stack; } void ContentPage::lose_visibility() { if(this->get_next_sibling()) { this->get_stack()->set_visible_child(*this->get_next_sibling()); } else if(this->get_prev_sibling()) { this->get_stack()->set_visible_child(*this->get_prev_sibling()); } } void ContentPage::redock(ContentStack *stack) { if(stack == nullptr) { if(this->stack) {
gpanthera.hh
@@ -135,6 +135,7 @@ namespace gPanthera {
void set_tab_widget(Gtk::Widget *tab_widget); void set_child(Gtk::Widget *child); ContentStack *get_stack() const; void lose_visibility();}; class ContentTab : public Gtk::ToggleButton {