[niepce: 10/22] Move Image menu to the shell menu button. Placeholder for the module menu.
- From: Hubert Figuière <hub src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [niepce: 10/22] Move Image menu to the shell menu button. Placeholder for the module menu.
- Date: Tue, 29 Jul 2014 08:06:20 +0000 (UTC)
commit 7c254b5ba27d9b0d390eb69480bdff2352bde8c2
Author: Hubert Figuière <hub figuiere net>
Date: Fri Jul 18 02:29:03 2014 -0400
Move Image menu to the shell menu button.
Placeholder for the module menu.
src/niepce/ui/moduleshell.cpp | 10 +++++++++-
src/niepce/ui/moduleshell.hpp | 1 +
src/niepce/ui/niepcewindow.cpp | 4 +---
3 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/niepce/ui/moduleshell.cpp b/src/niepce/ui/moduleshell.cpp
index 71efdcd..cfc5c57 100644
--- a/src/niepce/ui/moduleshell.cpp
+++ b/src/niepce/ui/moduleshell.cpp
@@ -205,6 +205,10 @@ Gtk::Widget * ModuleShell::buildWidget()
" </menubar>"
"</ui>";
+ m_module_menu = Gio::Menu::create();
+ m_menu->append_section(m_module_menu);
+
+ m_shell.getMenuButton().set_menu_model(m_menu);
m_gridview = GridViewModule::Ptr(
new GridViewModule(*this, m_selection_controller->get_list_store()));
@@ -278,13 +282,17 @@ void ModuleShell::on_image_activated(eng::library_id_t id)
void ModuleShell::on_module_deactivated(int idx)
{
DBG_ASSERT((idx >= 0) && ((unsigned)idx < m_modules.size()), "wrong module index");
+ m_module_menu->remove_all();
m_modules[idx]->set_active(false);
}
void ModuleShell::on_module_activated(int idx)
{
DBG_ASSERT((idx >= 0) && ((unsigned)idx < m_modules.size()), "wrong module index");
- m_shell.getMenuButton().set_menu_model(m_modules[idx]->getMenu());
+ auto menu = m_modules[idx]->getMenu();
+ if (menu) {
+ m_module_menu->append_section(menu);
+ }
m_modules[idx]->set_active(true);
}
diff --git a/src/niepce/ui/moduleshell.hpp b/src/niepce/ui/moduleshell.hpp
index 468ba44..f59a5c5 100644
--- a/src/niepce/ui/moduleshell.hpp
+++ b/src/niepce/ui/moduleshell.hpp
@@ -100,6 +100,7 @@ private:
// managed widgets...
ModuleShellWidget m_shell;
Glib::RefPtr<Gio::Menu> m_menu;
+ Glib::RefPtr<Gio::Menu> m_module_menu;
ui::SelectionController::Ptr m_selection_controller;
std::vector<ILibraryModule::Ptr> m_modules;
diff --git a/src/niepce/ui/niepcewindow.cpp b/src/niepce/ui/niepcewindow.cpp
index 1fbcb8a..9843075 100644
--- a/src/niepce/ui/niepcewindow.cpp
+++ b/src/niepce/ui/niepcewindow.cpp
@@ -83,8 +83,6 @@ NiepceWindow::_createModuleShell()
m_moduleshell->buildWidget();
add(m_moduleshell);
- auto shell_menu = m_moduleshell->getMenu();
- m_menu->append_submenu(_("Image"), shell_menu);
m_notifcenter->signal_lib_notification
.connect(sigc::mem_fun(
@@ -100,7 +98,7 @@ NiepceWindow::_createModuleShell()
&mapm::MapModule::on_lib_notification));
m_notifcenter->signal_thumbnail_notification
.connect(sigc::mem_fun(
- *get_pointer(m_moduleshell->get_list_store()),
+ *get_pointer(m_moduleshell->get_list_store()),
&ImageListStore::on_tnail_notification));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]