[glom] Dialog_ImportCSV: Some use of std::unique_ptr<> instead of naked news.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Dialog_ImportCSV: Some use of std::unique_ptr<> instead of naked news.
- Date: Fri, 5 Feb 2016 11:19:48 +0000 (UTC)
commit 70172b4eb11084dc7a4f2220b570dc8d6ca2d01d
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Feb 5 10:20:50 2016 +0100
Dialog_ImportCSV: Some use of std::unique_ptr<> instead of naked news.
glom/import_csv/dialog_import_csv.cc | 12 ++++++------
glom/import_csv/dialog_import_csv.h | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/glom/import_csv/dialog_import_csv.cc b/glom/import_csv/dialog_import_csv.cc
index 8509f8f..78383b4 100644
--- a/glom/import_csv/dialog_import_csv.cc
+++ b/glom/import_csv/dialog_import_csv.cc
@@ -520,23 +520,23 @@ void Dialog_Import_CSV::setup_sample_model(const CsvParser::type_row_strings& ro
for(guint i = 0; i < m_cols_count; ++ i)
{
const Glib::ustring& data = row[i];
- m_sample_view->append_column(*Gtk::manage(create_sample_column(data, i)));
+ m_sample_view->append_column(*Gtk::manage(create_sample_column(data, i).release()));
}
}
-Gtk::TreeViewColumn* Dialog_Import_CSV::create_sample_column(const Glib::ustring& title, guint index)
+std::unique_ptr<Gtk::TreeViewColumn> Dialog_Import_CSV::create_sample_column(const Glib::ustring& title,
guint index)
{
- auto col = new Gtk::TreeViewColumn(title);
+ auto col = std::make_unique<Gtk::TreeViewColumn>(title);
auto cell = create_sample_cell(index);
- col->pack_start(*Gtk::manage(cell), true);
+ col->pack_start(*Gtk::manage(cell.release()), true);
col->set_cell_data_func(*cell, sigc::bind(sigc::mem_fun(*this, &Dialog_Import_CSV::field_data_func),
index));
col->set_sizing(Gtk::TREE_VIEW_COLUMN_AUTOSIZE);
return col;
}
-Gtk::CellRendererCombo* Dialog_Import_CSV::create_sample_cell(guint index)
+std::unique_ptr<Gtk::CellRendererCombo> Dialog_Import_CSV::create_sample_cell(guint index)
{
- auto cell = new Gtk::CellRendererCombo;
+ auto cell = std::make_unique<Gtk::CellRendererCombo>();
cell->property_model() = m_field_model_sorted;
cell->property_text_column() = 0;
cell->property_has_entry() = false;
diff --git a/glom/import_csv/dialog_import_csv.h b/glom/import_csv/dialog_import_csv.h
index 220acb7..e04111c 100644
--- a/glom/import_csv/dialog_import_csv.h
+++ b/glom/import_csv/dialog_import_csv.h
@@ -80,8 +80,8 @@ private:
void begin_parse();
void setup_sample_model(const CsvParser::type_row_strings& row);
- Gtk::TreeViewColumn* create_sample_column(const Glib::ustring& title, guint index);
- Gtk::CellRendererCombo* create_sample_cell(guint index);
+ std::unique_ptr<Gtk::TreeViewColumn> create_sample_column(const Glib::ustring& title, guint index);
+ std::unique_ptr<Gtk::CellRendererCombo> create_sample_cell(guint index);
//CellRenderer cell_data_func callbacks:
void line_data_func(Gtk::CellRenderer* renderer, const Gtk::TreeModel::iterator& iter);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]