Commit 912b4eb0 authored by Murray Cumming's avatar Murray Cumming
Browse files

NotebookLabel: 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 06778b07
......@@ -119,7 +119,7 @@ void NotebookLabel::setup_menu(Gtk::Widget* /* widget */)
menu->append(_("New Group"), "context.new-group");
menu->append(_("_Delete"), "context.delete");
m_pPopupMenu = new Gtk::Menu(menu);
m_pPopupMenu = std::make_unique<Gtk::Menu>(menu);
m_pPopupMenu->attach_to_widget(*this);
}
......
......@@ -50,7 +50,7 @@ private:
NotebookGlom* m_notebook;
void setup_menu(Gtk::Widget* widget);
Gtk::Menu* m_pPopupMenu;
std::unique_ptr<Gtk::Menu> m_pPopupMenu;
void on_menu_new_group_activate();
void on_menu_delete_activate();
......
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