Commit 1adf8945 authored by Murray Cumming's avatar Murray Cumming
Browse files

Box_Data_Calendar_Related: 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 b32655d1
......@@ -33,8 +33,7 @@ namespace Glom
{
Box_Data_Calendar_Related::Box_Data_Calendar_Related()
: m_pMenuPopup(nullptr),
m_query_column_date_field(-1)
: m_query_column_date_field(-1)
{
set_size_request(400, -1); //An arbitrary default.
......@@ -528,7 +527,7 @@ void Box_Data_Calendar_Related::setup_menu(Gtk::Widget* /* this */)
menu->append(_("_Edit"), "context.edit");
menu->append(_("_Layout"), "context.layout");
m_pMenuPopup = new Gtk::Menu(menu);
m_pMenuPopup = std::make_unique<Gtk::Menu>(menu);
m_pMenuPopup->attach_to_widget(*this);
#ifndef GLOM_ENABLE_CLIENT_ONLY
......
......@@ -96,7 +96,7 @@ private:
Gtk::Calendar m_calendar;
//TODO: Avoid repeating these in so many widgets:
Gtk::Menu* m_pMenuPopup;
std::unique_ptr<Gtk::Menu> m_pMenuPopup;
Glib::RefPtr<Gio::SimpleActionGroup> m_refActionGroup;
Glib::RefPtr<Gio::SimpleAction> m_refContextEdit, m_refContextAdd, m_refContextDelete;
......
Markdown is supported
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