diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-01-09 14:21:12 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-01-09 14:21:12 +0000 |
commit | 8f1c6a5a4dcb58a2b28bad0a5f08715fc733ccce (patch) | |
tree | 627fbefe5a6977e06b1967d20c7e89e41b87ce32 /libs/gtkmm2ext | |
parent | ca2f505ec16f69ef1b5090e48b93f7ded6ae795a (diff) |
add Gtkmm2ext::detach_menu() that was needed by my previous commit
git-svn-id: svn://localhost/ardour2/branches/3.0@6471 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/utils.h | 2 | ||||
-rw-r--r-- | libs/gtkmm2ext/utils.cc | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index 7f986e738c..d6d5a9498c 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -31,6 +31,7 @@ namespace Gtk { class Widget; class Window; class Paned; + class Menu; } namespace Gtkmm2ext { @@ -69,6 +70,7 @@ namespace Gtkmm2ext { void set_decoration (Gtk::Window* win, Gdk::WMDecoration decor); void set_treeview_header_as_default_label(Gtk::TreeViewColumn *c); Glib::RefPtr<Gdk::Drawable> get_bogus_drawable(); + void detach_menu (Gtk::Menu&); }; #endif /* __gtkmm2ext_utils_h__ */ diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 3a021bbe7b..400899cb67 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -135,3 +135,16 @@ void Gtkmm2ext::set_treeview_header_as_default_label(Gtk::TreeViewColumn* c) gtk_tree_view_column_set_widget( c->gobj(), GTK_WIDGET(0) ); } +void +Gtkmm2ext::detach_menu (Gtk::Menu& menu) +{ + /* its possible for a Gtk::Menu to have no gobj() because it has + not yet been instantiated. Catch this and provide a safe + detach method. + */ + if (menu.gobj()) { + if (menu.get_attach_widget()) { + menu.detach (); + } + } +} |