From f91cb13cce28334cf0262870a60ce1e712eebe2a Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 4 Feb 2021 19:12:22 +0100 Subject: [PATCH] Facilitate callbacks when Tab is detached/attached --- libs/widgets/tabbable.cc | 8 +++++++- libs/widgets/widgets/tabbable.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/widgets/tabbable.cc b/libs/widgets/tabbable.cc index fee22bd435..170ef8e6d1 100644 --- a/libs/widgets/tabbable.cc +++ b/libs/widgets/tabbable.cc @@ -151,7 +151,7 @@ Gtk::Notebook* Tabbable::tab_root_drop () { /* This is called after a drop of a tab onto the root window. Its - * responsibility xois to return the notebook that this Tabbable's + * responsibility is to return the notebook that this Tabbable's * contents should be packed into before the drop handling is * completed. It is not responsible for actually taking care of this * packing. @@ -226,6 +226,7 @@ void Tabbable::detach () { show_own_window (true); + signal_tabbed_changed (false); } void @@ -260,6 +261,9 @@ Tabbable::attach () _parent_notebook->set_tab_detachable (_contents); _parent_notebook->set_tab_reorderable (_contents); _parent_notebook->set_current_page (_parent_notebook->page_num (_contents)); + + signal_tabbed_changed (true); + _contents.show (); /* have to force this on, which is semantically correct, since @@ -355,6 +359,7 @@ Tabbable::set_state (const XMLNode& node, int version) if (_visible) { show_own_window (true); + signal_tabbed_changed (false); } XMLNodeList children = node.children (); @@ -370,6 +375,7 @@ Tabbable::set_state (const XMLNode& node, int version) } else { /* this does nothing if not tabbed */ hide_tab (); + signal_tabbed_changed (false); } } diff --git a/libs/widgets/widgets/tabbable.h b/libs/widgets/widgets/tabbable.h index af2ced6e27..dde8da227b 100644 --- a/libs/widgets/widgets/tabbable.h +++ b/libs/widgets/widgets/tabbable.h @@ -68,6 +68,7 @@ public: bool tabbed() const; bool tabbed_by_default () const; + Gtk::Window* current_toplevel () const; Gtk::Notebook* tab_root_drop (); @@ -82,6 +83,8 @@ public: protected: bool delete_event_handler (GdkEventAny *ev); + sigc::signal1 signal_tabbed_changed; + private: Gtk::Widget& _contents; Gtk::Notebook _own_notebook;