diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-07-09 12:40:51 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2016-02-22 15:31:21 -0500 |
commit | 552e995297d7706790ed2dfaab75749e914ad317 (patch) | |
tree | 3c797c1b3c2eccb82f3fbc56442acbdde6ce6473 /libs/gtkmm2ext/tabbable.cc | |
parent | 26a9471b6143b97b75ff9d65611365ba2c1029b4 (diff) |
save/restore tabbable state
Diffstat (limited to 'libs/gtkmm2ext/tabbable.cc')
-rw-r--r-- | libs/gtkmm2ext/tabbable.cc | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/libs/gtkmm2ext/tabbable.cc b/libs/gtkmm2ext/tabbable.cc index 45e21a6b7b..245be5542f 100644 --- a/libs/gtkmm2ext/tabbable.cc +++ b/libs/gtkmm2ext/tabbable.cc @@ -24,6 +24,8 @@ #include "gtkmm2ext/tabbable.h" #include "gtkmm2ext/visibility_tracker.h" +#include "i18n.h" + using namespace Gtkmm2ext; using namespace Gtk; using std::string; @@ -55,9 +57,20 @@ Tabbable::add_to_notebook (Notebook& notebook, const string& tab_title, int posi } Window* -Tabbable::use_own_window () +Tabbable::use_own_window (bool and_pack_it) { - return get (true); + Gtk::Window* win = get (true); + + if (and_pack_it) { + Gtk::Container* parent = _contents.get_parent(); + if (parent) { + parent->remove (_contents); + } + _own_notebook.append_page (_contents, _tab_title); + } + + return win; + } bool @@ -108,7 +121,7 @@ Tabbable::tab_root_drop () alloc = _contents.get_parent()->get_allocation(); - (void) use_own_window (); + (void) use_own_window (false); /* This is called after a drop of a tab onto the root window. Its * responsibility is to return the notebook that this Tabbable's @@ -212,3 +225,33 @@ Tabbable::current_toplevel () const { return dynamic_cast<Gtk::Window*> (contents().get_toplevel()); } + +string +Tabbable::xml_node_name() +{ + return WindowProxy::xml_node_name(); +} + +XMLNode& +Tabbable::get_state() +{ + XMLNode& node (WindowProxy::get_state()); + + return node; +} + +int +Tabbable::set_state (const XMLNode& node, int version) +{ + int ret; + + if ((ret = WindowProxy::set_state (node, version)) == 0) { + if (_visible) { + if (use_own_window (true) == 0) { + ret = -1; + } + } + } + + return ret; +} |