Commit 06778b07 authored by Murray Cumming's avatar Murray Cumming
Browse files

Window_PrintLayout_Edit: Use std::unique_ptr<> for the menu, instead of new and delete.

I am not very happy with passing the raw pointer to gtkmm's
attach_to_widget(), but that seems to be the normal use of
unique_ptr<>::operator*() and unique_ptr<>::get(),
as long as we don't expect the receiving API to take any
ownership.
parent 0b78d533
......@@ -279,9 +279,10 @@ void Window_PrintLayout_Edit::init_menu()
g_warning("GMenu not found");
//Menubar:
auto pMenuBar = new Gtk::MenuBar(gmenu);
m_box_menu->pack_start(*pMenuBar, Gtk::PACK_SHRINK);
pMenuBar->show();
auto menubar = std::make_unique<Gtk::MenuBar>(gmenu);
menubar->show();
m_box_menu->pack_start(*(Gtk::manage(menubar.release())), Gtk::PACK_SHRINK);
//TODO: Create a generic checking method to test that
// all actions from the action group are in the GMenu?
......@@ -706,7 +707,7 @@ void Window_PrintLayout_Edit::setup_context_menu()
if(!gmenu)
g_warning("GMenu not found");
m_context_menu = new Gtk::Menu(gmenu);
m_context_menu = std::make_unique<Gtk::Menu>(gmenu);
m_context_menu->attach_to_widget(*this);
}
......
......@@ -205,7 +205,7 @@ private:
PrintLayoutToolbar m_toolbar;
//Context menu for clicking on empty space on the canvas:
Gtk::Menu* m_context_menu;
std::unique_ptr<Gtk::Menu> m_context_menu;
};
} //namespace Glom
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment