From a86f3bf4975fdf69bbace77c9420b5f7b224d011 Mon Sep 17 00:00:00 2001 From: Michael Fisher Date: Thu, 30 Aug 2012 18:02:44 -0500 Subject: [PATCH] Adding support to append Separator Items for MenuButton Updated PanelBar to use this API --- src/gui/widgets/menu-button.cpp | 10 ++++++++++ src/gui/widgets/menu-button.hpp | 18 ++++++++++++++++++ src/gui/widgets/panel-bar.cpp | 5 +---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/gui/widgets/menu-button.cpp b/src/gui/widgets/menu-button.cpp index 8f7d1f0b2..1ae2c0955 100644 --- a/src/gui/widgets/menu-button.cpp +++ b/src/gui/widgets/menu-button.cpp @@ -101,6 +101,16 @@ MenuButton::append (const char *slug, const char* title, append (uSlug, uTitle, callback); } +void +MenuButton::appendSeparator() +{ + uimanager->add_ui_separator( + uimanager->new_merge_id(), + ustring("ui/").append(POPUP_SLUG), + "Separator", Gtk::UI_MANAGER_SEPARATOR, + false); +} + void MenuButton::popup() { diff --git a/src/gui/widgets/menu-button.hpp b/src/gui/widgets/menu-button.hpp index 728944c67..7de2a9227 100644 --- a/src/gui/widgets/menu-button.hpp +++ b/src/gui/widgets/menu-button.hpp @@ -79,9 +79,27 @@ public: */ Menu& get_menu(); + /** + * Append a Menu Item to the Menu + * @param slug Unique identifier in the UI Manager + * @param title The title of the item + * @param callback The signal handler when clicked + */ void append (uString &slug, uString &title, sigc::slot& callback); + + /** + * Append a Menu Item to the Menu + * @param slug Unique identifier in the UI Manager + * @param title The title of the item + * @param callback The signal handler when clicked + */ void append (const char *slug, const char* title, sigc::slot& callback); + /** + * Append a Gtk::SeparatorMenuItem to the Menu + */ + void appendSeparator(); + /** * Pops up the menu. */ diff --git a/src/gui/widgets/panel-bar.cpp b/src/gui/widgets/panel-bar.cpp index 1c9c91af4..9482e94fa 100644 --- a/src/gui/widgets/panel-bar.cpp +++ b/src/gui/widgets/panel-bar.cpp @@ -83,10 +83,7 @@ PanelBar::setup_panel_button() **/ } - FIXME("Update for gtk3"); -#if 0 - list.push_back( Menu_Helpers::SeparatorElem() ); -#endif + panelButton.appendSeparator(); // Add extra commands slot hide = mem_fun(*this, &PanelBar::on_hide);