[gtkmm] C++11: More use of auto.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] C++11: More use of auto.
- Date: Fri, 17 Mar 2017 15:32:19 +0000 (UTC)
commit 1ea1e0f2d56dbbd0222a60248f1ec0515f959526
Author: Murray Cumming <murrayc murrayc com>
Date: Fri Mar 17 16:31:55 2017 +0100
C++11: More use of auto.
demos/gtk-demo/demowindow.cc | 24 ++++++++++----------
demos/gtk-demo/example_appwindow.cc | 2 +-
demos/gtk-demo/example_change_display.cc | 8 +++---
demos/gtk-demo/example_drawingarea.cc | 4 +-
demos/gtk-demo/example_gestures.cc | 2 +-
demos/gtk-demo/example_iconbrowser.cc | 20 ++++++++--------
demos/gtk-demo/example_iconview.cc | 14 ++++++------
demos/gtk-demo/example_pixbufs.cc | 4 +-
demos/gtk-demo/example_sizegroup.cc | 2 +-
demos/gtk-demo/example_textview.cc | 10 ++++----
demos/gtk-demo/example_treeview_editable_cells.cc | 14 ++++++------
demos/gtk-demo/example_treeview_liststore.cc | 2 +-
demos/gtk-demo/example_treeview_treestore.cc | 6 ++--
demos/gtk-demo/textwidget.cc | 2 +-
gtk/gtkmm/listviewtext.cc | 14 ++++++------
gtk/gtkmm/treeview_private.cc | 2 +-
gtk/src/treeview.hg | 2 +-
tests/tree_model_iterator/main.cc | 4 +-
18 files changed, 68 insertions(+), 68 deletions(-)
---
diff --git a/demos/gtk-demo/demowindow.cc b/demos/gtk-demo/demowindow.cc
index b94900f..73dff25 100644
--- a/demos/gtk-demo/demowindow.cc
+++ b/demos/gtk-demo/demowindow.cc
@@ -120,7 +120,7 @@ void DemoWindow::fill_tree()
*/
for(Demo* d = testgtk_demos; d && d->title; ++d)
{
- Gtk::TreeRow row = *(m_refTreeStore->append());
+ auto row = *(m_refTreeStore->append());
row[columns.title] = d->title;
row[columns.filename] = d->filename;
@@ -129,7 +129,7 @@ void DemoWindow::fill_tree()
for(Demo* child = d->children; child && child->title; ++child)
{
- Gtk::TreeRow child_row = *(m_refTreeStore->append(row.children()));
+ auto child_row = *(m_refTreeStore->append(row.children()));
child_row[columns.title] = child->title;
child_row[columns.filename] = child->filename;
@@ -162,7 +162,7 @@ void DemoWindow::on_run_button_clicked()
{
if(m_pWindow_Example == nullptr) //Don't open a second window.
{
- if(const Gtk::TreeModel::iterator iter = m_refTreeSelection->get_selected())
+ if(const auto iter = m_refTreeSelection->get_selected())
{
m_TreePath = m_refTreeStore->get_path(iter);
@@ -177,7 +177,7 @@ void DemoWindow::on_treeview_row_activated(const Gtk::TreeModel::Path& path, Gtk
if(m_pWindow_Example == nullptr) //Don't open a second window.
{
- if(const Gtk::TreeModel::iterator iter = m_TreeView.get_model()->get_iter(m_TreePath))
+ if(const auto iter = m_TreeView.get_model()->get_iter(m_TreePath))
{
run_example(*iter);
}
@@ -202,16 +202,16 @@ void DemoWindow::run_example(Gtk::TreeModel::Row& row)
bool DemoWindow::select_function(const Glib::RefPtr<Gtk::TreeModel>& model,
const Gtk::TreeModel::Path& path, bool)
{
- const Gtk::TreeModel::iterator iter = model->get_iter(path);
+ const auto iter = model->get_iter(path);
return iter->children().empty(); // only allow leaf nodes to be selected
}
void DemoWindow::on_treeselection_changed()
{
- if(const Gtk::TreeModel::iterator iter = m_refTreeSelection->get_selected())
+ if(const auto iter = m_refTreeSelection->get_selected())
{
- const Glib::ustring filename = (*iter)[demo_columns().filename];
- const Glib::ustring title = (*iter)[demo_columns().title];
+ const auto filename = (*iter)[demo_columns().filename];
+ const auto title = (*iter)[demo_columns().title];
load_file(Glib::filename_from_utf8(filename));
m_HeaderBar.set_title(title);
@@ -255,7 +255,7 @@ void DemoWindow::load_file(const std::string& filename)
int state = 0;
bool in_para = false;
- Gtk::TextBuffer::iterator start = refBufferInfo->get_iter_at_offset(0);
+ auto start = refBufferInfo->get_iter_at_offset(0);
for (int i = 0; lines[i] != NULL; i++)
{
/* Make sure \r is stripped at the end for the poor windows people */
@@ -286,7 +286,7 @@ void DemoWindow::load_file(const std::string& filename)
if (q > p)
{
- Gtk::TextBuffer::iterator end = start;
+ auto end = start;
const Glib::ustring strTemp (p, q);
end = refBufferInfo->insert(end, strTemp);
@@ -383,7 +383,7 @@ void DemoWindow::add_data_tabs(const std::string& filename)
}
for (unsigned int i = 0; i < resources.size(); ++i)
{
- const std::string resource_name = resource_dir + "/" + resources[i];
+ const auto resource_name = resource_dir + "/" + resources[i];
Gtk::Widget* widget = nullptr;
Gtk::Image* image = new Gtk::Image();
image->set_from_resource(resource_name);
@@ -442,7 +442,7 @@ void DemoWindow::on_example_window_hide()
{
if(m_pWindow_Example)
{
- if(const Gtk::TreeModel::iterator iter = m_refTreeStore->get_iter(m_TreePath))
+ if(const auto iter = m_refTreeStore->get_iter(m_TreePath))
{
(*iter)[demo_columns().italic] = false;
diff --git a/demos/gtk-demo/example_appwindow.cc b/demos/gtk-demo/example_appwindow.cc
index 21c0290..fb0366f 100644
--- a/demos/gtk-demo/example_appwindow.cc
+++ b/demos/gtk-demo/example_appwindow.cc
@@ -144,7 +144,7 @@ void Example_AppWindow::on_text_changed()
Glib::RefPtr<Gtk::TextBuffer> refBuffer = m_TextView.get_buffer();
gint count = refBuffer->get_char_count();
- Gtk::TextBuffer::iterator iter = refBuffer->get_iter_at_mark(refBuffer->get_insert());
+ auto iter = refBuffer->get_iter_at_mark(refBuffer->get_insert());
gint row = iter.get_line();
gint col = iter.get_line_offset();
diff --git a/demos/gtk-demo/example_change_display.cc b/demos/gtk-demo/example_change_display.cc
index 1f3e44c..77299bd 100644
--- a/demos/gtk-demo/example_change_display.cc
+++ b/demos/gtk-demo/example_change_display.cc
@@ -179,7 +179,7 @@ void Example_ChangeDisplay::initialize_displays()
for(auto refDisplay : refDisplayManager->list_displays())
{
- Gtk::TreeRow row = *(m_refListStore_Display->append());
+ auto row = *(m_refListStore_Display->append());
row[m_columns_display.m_name] = refDisplay->get_name();;
row[m_columns_display.m_display] = refDisplay;
@@ -228,7 +228,7 @@ void Example_ChangeDisplay::on_button_display_open()
if (response_id != Gtk::RESPONSE_OK)
break;
- Glib::ustring new_screen_name = entry.get_text();
+ auto new_screen_name = entry.get_text();
if( !new_screen_name.empty() )
{
@@ -250,7 +250,7 @@ void Example_ChangeDisplay::on_button_display_close()
void Example_ChangeDisplay::on_treeview_display_selection_changed()
{
Glib::RefPtr<Gtk::TreeSelection> refSelection = m_TreeView_Display.get_selection();
- Gtk::TreeModel::iterator iter = refSelection->get_selected();
+ auto iter = refSelection->get_selected();
if(iter)
m_refCurrentDisplay = (*iter)[m_columns_display.m_display];
else
@@ -310,7 +310,7 @@ Gtk::Window* Example_ChangeDisplay::query_for_toplevel(const Glib::RefPtr<Gdk::S
//TODO: Find a suitable replacement for this:
//const GdkGrabStatus grabbed = m_pPopup->get_window()->grab(false, Gdk::BUTTON_RELEASE_MASK, cursor,
GDK_CURRENT_TIME);
//Check it when the GTK+ example has been updated and file a bug about the unhelpful deprecation comment.
- const Gdk::GrabStatus grabbed = Gdk::GRAB_SUCCESS;
+ const auto grabbed = Gdk::GRAB_SUCCESS;
if(grabbed == Gdk::GRAB_SUCCESS )
{
m_popup_clicked = false;
diff --git a/demos/gtk-demo/example_drawingarea.cc b/demos/gtk-demo/example_drawingarea.cc
index 1045337..95f0543 100644
--- a/demos/gtk-demo/example_drawingarea.cc
+++ b/demos/gtk-demo/example_drawingarea.cc
@@ -168,7 +168,7 @@ void Example_DrawingArea::on_drawingarea_scribble_draw(const Cairo::RefPtr<Cairo
bool Example_DrawingArea::on_drawingarea_scribble_configure_event(GdkEventConfigure*)
{
- const Gtk::Allocation allocation = m_DrawingArea_Scribble.get_allocation();
+ const auto allocation = m_DrawingArea_Scribble.get_allocation();
m_surface =
m_DrawingArea_Scribble.get_window()->create_similar_surface(
Cairo::CONTENT_COLOR, allocation.get_width(), allocation.get_height());
@@ -201,7 +201,7 @@ bool Example_DrawingArea::on_drawingarea_scribble_motion_notify_event(GdkEventMo
if(refWindow)
{
int x = 0, y = 0;
- Gdk::ModifierType state = Gdk::ModifierType(0);
+ auto state = Gdk::ModifierType(0);
const Glib::RefPtr<const Gdk::Device> device =
Glib::wrap(motion_event->device, true); // true == take_copy
refWindow->get_device_position(device, x, y, state);
diff --git a/demos/gtk-demo/example_gestures.cc b/demos/gtk-demo/example_gestures.cc
index effd923..5bb4e78 100644
--- a/demos/gtk-demo/example_gestures.cc
+++ b/demos/gtk-demo/example_gestures.cc
@@ -90,7 +90,7 @@ void Example_Gestures::on_drawing_area_draw(const ::Cairo::RefPtr< ::Cairo::Cont
if (m_GestureRotate->is_recognized() || m_GestureZoom->is_recognized())
{
- Cairo::Matrix matrix = Cairo::translation_matrix(xc, yc);
+ auto matrix = Cairo::translation_matrix(xc, yc);
cr->save();
const double angle = m_GestureRotate->get_angle_delta();
diff --git a/demos/gtk-demo/example_iconbrowser.cc b/demos/gtk-demo/example_iconbrowser.cc
index 975fd6b..964d53e 100644
--- a/demos/gtk-demo/example_iconbrowser.cc
+++ b/demos/gtk-demo/example_iconbrowser.cc
@@ -305,8 +305,8 @@ void Example_IconBrowser::on_context_list_selected_rows_changed()
void Example_IconBrowser::on_icon_view_item_activated(const Gtk::TreeModel::Path& path)
{
- Gtk::TreeModel::iterator iter = m_filter_model->get_iter(path);
- Gtk::TreeModel::Row row = *iter;
+ auto iter = m_filter_model->get_iter(path);
+ const auto row = *iter;
const Glib::ustring name = row[m_store->get_text_column()];
const Glib::ustring description = row[m_store->m_columns.description];
if (name.empty() || !Gtk::IconTheme::get_default()->has_icon(name))
@@ -327,7 +327,7 @@ bool Example_IconBrowser::on_icon_view_query_tooltip(int x, int y,
if (!m_icon_view.get_tooltip_context_iter(x, y, keyboard_tooltip, iter))
return false;
- Gtk::TreeModel::Row row = *iter;
+ const auto row = *iter;
const Glib::ustring description = row[m_store->m_columns.description];
if (description.empty())
return false;
@@ -845,16 +845,16 @@ void Example_IconBrowser::add_context(const Glib::ustring& id,
void Example_IconBrowser::add_icon(const Glib::ustring& name,
const Glib::ustring& description, const Glib::ustring& context_id)
{
- Glib::ustring regular_name = name;
+ auto regular_name = name;
if (!Gtk::IconTheme::get_default()->has_icon(regular_name))
regular_name.clear();
- Glib::ustring symbolic_name = name + "-symbolic";
+ auto symbolic_name = name + "-symbolic";
if (!Gtk::IconTheme::get_default()->has_icon(symbolic_name))
symbolic_name.clear();
// Add a new row to the IconInfoStore (which is a ListStore).
- Gtk::TreeModel::Row row = *(m_store->append());
+ auto row = *(m_store->append());
row[m_store->m_columns.name] = regular_name;
row[m_store->m_columns.symbolic_name] = symbolic_name;
row[m_store->m_columns.description] = description;
@@ -872,12 +872,12 @@ bool Example_IconBrowser::is_icon_visible(const Gtk::TreeModel::const_iterator&
bool visible = false;
if (search)
{
- const Glib::ustring search_text = m_search_entry.get_text();
+ const auto search_text = m_search_entry.get_text();
visible = name.find(search_text) != std::string::npos;
}
else
{
- const Glib::ustring context_id = row[m_store->m_columns.context_id];
+ const auto context_id = row[m_store->m_columns.context_id];
visible = context_id == m_current_context_id;
}
return visible;
@@ -962,7 +962,7 @@ void DetailDialog::on_image_drag_data_get(const Glib::RefPtr<Gdk::DragContext>&
Glib::RefPtr<Gdk::Pixbuf> DetailDialog::get_icon(int size_index)
{
Glib::RefPtr<Gtk::StyleContext> context = m_image[size_index].get_style_context();
- Gtk::IconInfo info = Gtk::IconTheme::get_default()->lookup_icon(
+ auto info = Gtk::IconTheme::get_default()->lookup_icon(
m_icon_name, m_icon_size[size_index]);
Glib::RefPtr<Gdk::Pixbuf> pixbuf;
try
@@ -1006,7 +1006,7 @@ bool IconInfoStore::drag_data_get_vfunc(const Gtk::TreeModel::Path& path,
return false;
const auto row = *iter;
- const Glib::ustring name = row[m_text_column];
+ const auto name = row[m_text_column];
selection_data.set_text(name);
return true;
}
diff --git a/demos/gtk-demo/example_iconview.cc b/demos/gtk-demo/example_iconview.cc
index b089801..ef0083e 100644
--- a/demos/gtk-demo/example_iconview.cc
+++ b/demos/gtk-demo/example_iconview.cc
@@ -184,19 +184,19 @@ void Example_IconView::fill_store()
{
Glib::Dir dir(m_parent); //throws an exception if it fails.
- std::string name = dir.read_name();
+ auto name = dir.read_name();
while(!name.empty())
{
/* We ignore hidden files that start with a '.' */
if (name[0] != '.')
{
- std::string path = Glib::build_filename(m_parent, name);
+ auto path = Glib::build_filename(m_parent, name);
bool is_dir = Glib::file_test(path, Glib::FILE_TEST_IS_DIR);
- Glib::ustring display_name = Glib::filename_to_utf8(name);
+ auto display_name = Glib::filename_to_utf8(name);
- Gtk::TreeModel::iterator iter = m_model->append();
- Gtk::TreeModel::Row row = *iter;
+ auto iter = m_model->append();
+ auto row = *iter;
row[m_columns.path] = path;
row[m_columns.display_name] = display_name;
row[m_columns.is_directory] = is_dir;
@@ -215,10 +215,10 @@ void Example_IconView::fill_store()
void Example_IconView::on_iconview_item_activated(const Gtk::TreeModel::Path& path)
{
- Gtk::TreeModel::iterator iter = m_model->get_iter(path);
+ auto iter = m_model->get_iter(path);
if(iter)
{
- Gtk::TreeModel::Row row = *iter;
+ auto row = *iter;
const bool is_dir = row[m_columns.is_directory];
const std::string filepath = row[m_columns.path];
if(is_dir)
diff --git a/demos/gtk-demo/example_pixbufs.cc b/demos/gtk-demo/example_pixbufs.cc
index dfd7822..d2c3fef 100644
--- a/demos/gtk-demo/example_pixbufs.cc
+++ b/demos/gtk-demo/example_pixbufs.cc
@@ -111,7 +111,7 @@ void Example_Pixbufs::load_pixbufs()
if(m_refPixbuf_Background)
return; /* already loaded earlier */
- std::string resource_name_background = std::string("/pixbufs/") + BACKGROUND_NAME;
+ auto resource_name_background = std::string("/pixbufs/") + BACKGROUND_NAME;
m_refPixbuf_Background = Gdk::Pixbuf::create_from_resource(resource_name_background);
@@ -120,7 +120,7 @@ void Example_Pixbufs::load_pixbufs()
for(unsigned i = 0; i < N_IMAGES; ++i)
{
- std::string resource_name = std::string("/pixbufs/") + image_names[i];
+ auto resource_name = std::string("/pixbufs/") + image_names[i];
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create_from_resource(resource_name);
diff --git a/demos/gtk-demo/example_sizegroup.cc b/demos/gtk-demo/example_sizegroup.cc
index ca993c3..c4515f6 100644
--- a/demos/gtk-demo/example_sizegroup.cc
+++ b/demos/gtk-demo/example_sizegroup.cc
@@ -116,7 +116,7 @@ Example_SizeGroup::~Example_SizeGroup()
void Example_SizeGroup::on_checkbutton_toggled()
{
- Gtk::SizeGroupMode new_mode = Gtk::SIZE_GROUP_HORIZONTAL;
+ auto new_mode = Gtk::SIZE_GROUP_HORIZONTAL;
if(m_CheckButton.get_active())
new_mode = Gtk::SIZE_GROUP_HORIZONTAL;
diff --git a/demos/gtk-demo/example_textview.cc b/demos/gtk-demo/example_textview.cc
index 55c7adf..8652446 100644
--- a/demos/gtk-demo/example_textview.cc
+++ b/demos/gtk-demo/example_textview.cc
@@ -184,7 +184,7 @@ void Example_TextView::insert_text(Glib::RefPtr<Gtk::TextBuffer>& refBuffer)
* iterator to point to just after the inserted text.
*/
- Gtk::TextBuffer::iterator iter = refBuffer->get_iter_at_offset(0);
+ auto iter = refBuffer->get_iter_at_offset(0);
iter = refBuffer->insert(iter, "The text widget can display text with all kinds of nifty attributes. It
also supports multiple views of the same buffer; this demo is showing the same buffer in two places.\n\n");
iter = refBuffer->insert_with_tag(iter, "Font styles. ", "heading");
@@ -375,8 +375,8 @@ bool Example_TextView::find_anchor(Gtk::TextBuffer::iterator& iter)
void Example_TextView::attach_widgets(Gtk::TextView& text_view)
{
- Glib::RefPtr<Gtk::TextBuffer> refBuffer = text_view.get_buffer();
- Gtk::TextBuffer::iterator iter = refBuffer->begin();
+ auto refBuffer = text_view.get_buffer();
+ auto iter = refBuffer->begin();
int i = 0;
while(find_anchor(iter)) //previously created with create_child_anchor().
@@ -440,8 +440,8 @@ Window_EasterEgg::Window_EasterEgg()
{
set_default_size(300, 400);
- Glib::RefPtr<Gtk::TextBuffer> refBuffer = Gtk::TextBuffer::create();
- Gtk::TextBuffer::iterator iter = refBuffer->end();
+ auto refBuffer = Gtk::TextBuffer::create();
+ auto iter = refBuffer->end();
iter = refBuffer->insert(iter, "This buffer is shared by a set of nested text views.\n Nested view:\n");
Glib::RefPtr<Gtk::TextChildAnchor> refAnchor = refBuffer->create_child_anchor(iter);
diff --git a/demos/gtk-demo/example_treeview_editable_cells.cc
b/demos/gtk-demo/example_treeview_editable_cells.cc
index 8fda091..285363e 100644
--- a/demos/gtk-demo/example_treeview_editable_cells.cc
+++ b/demos/gtk-demo/example_treeview_editable_cells.cc
@@ -180,7 +180,7 @@ void Example_TreeView_EditableCells::create_model()
void Example_TreeView_EditableCells::liststore_add_item(const CellItem_Product& foo)
{
- Gtk::TreeRow row = *(m_refListStore->append());
+ auto row = *(m_refListStore->append());
row[m_columns.number] = foo.m_number;
row[m_columns.product] = foo.m_product;
@@ -193,10 +193,10 @@ void Example_TreeView_EditableCells::on_column_number_edited(const Glib::ustring
Gtk::TreePath path(path_string);
//Get the row from the path:
- Glib::RefPtr<Gtk::TreeModel> refModel = m_TreeView.get_model();
+ auto refModel = m_TreeView.get_model();
if(refModel)
{
- Gtk::TreeModel::iterator iter = refModel->get_iter(path);
+ auto iter = refModel->get_iter(path);
if(iter)
{
//Convert the text to a number, using the same logic used by GtkCellRendererText when it stores
numbers.
@@ -212,7 +212,7 @@ void Example_TreeView_EditableCells::on_column_number_edited(const Glib::ustring
}
//Store the user's new text in the model:
- Gtk::TreeRow row = *iter;
+ auto row = *iter;
row[m_columns.number] = new_value;
}
}
@@ -226,11 +226,11 @@ void Example_TreeView_EditableCells::on_column_product_edited(const Glib::ustrin
Glib::RefPtr<Gtk::TreeModel> refModel = m_TreeView.get_model();
if(refModel)
{
- Gtk::TreeModel::iterator iter = refModel->get_iter(path);
+ auto iter = refModel->get_iter(path);
if(iter)
{
//Store the user's new text in the model:
- Gtk::TreeRow row = *iter;
+ auto row = *iter;
row[m_columns.product] = new_text;
}
}
@@ -300,7 +300,7 @@ void Example_TreeView_EditableCells::on_button_remove_clicked()
{
Glib::RefPtr<Gtk::TreeSelection> refSelection = m_TreeView.get_selection();
- if(const Gtk::TreeModel::iterator iter = refSelection->get_selected())
+ if(const auto iter = refSelection->get_selected())
{
const Gtk::TreeModel::Path path(iter);
const unsigned int index = path.front();
diff --git a/demos/gtk-demo/example_treeview_liststore.cc b/demos/gtk-demo/example_treeview_liststore.cc
index 615b588..a9f1c38 100644
--- a/demos/gtk-demo/example_treeview_liststore.cc
+++ b/demos/gtk-demo/example_treeview_liststore.cc
@@ -159,7 +159,7 @@ void Example_TreeView_ListStore::create_model()
void Example_TreeView_ListStore::liststore_add_item(const CellItem_Bug& foo)
{
- Gtk::TreeRow row = *(m_refListStore->append());
+ auto row = *(m_refListStore->append());
row[m_columns.fixed] = foo.m_fixed;
row[m_columns.number] = foo.m_number;
diff --git a/demos/gtk-demo/example_treeview_treestore.cc b/demos/gtk-demo/example_treeview_treestore.cc
index de50dd0..29b0ebf 100644
--- a/demos/gtk-demo/example_treeview_treestore.cc
+++ b/demos/gtk-demo/example_treeview_treestore.cc
@@ -269,7 +269,7 @@ void Example_TreeView_TreeStore::create_model()
#if 0 /* testing code: should work, try it out if you like */
- Gtk::TreeIterChildren children = m_refTreeStore->children();
+ auto children = m_refTreeStore->children();
for(auto node : children)
{
@@ -287,7 +287,7 @@ void Example_TreeView_TreeStore::create_model()
void Example_TreeView_TreeStore::treestore_add_item(const CellItem_Holiday& foo)
{
- Gtk::TreeRow row = *(m_refTreeStore->append());
+ auto row = *(m_refTreeStore->append());
row[m_columns.holiday_name] = foo.m_label;
row[m_columns.alex] = foo.m_alex;
@@ -301,7 +301,7 @@ void Example_TreeView_TreeStore::treestore_add_item(const CellItem_Holiday& foo)
//Add Children:
for(const auto& child : foo.m_children)
{
- Gtk::TreeRow child_row = *(m_refTreeStore->append(row.children()));
+ auto child_row = *(m_refTreeStore->append(row.children()));
child_row[m_columns.holiday_name] = child.m_label;
child_row[m_columns.alex] = child.m_alex;
diff --git a/demos/gtk-demo/textwidget.cc b/demos/gtk-demo/textwidget.cc
index 68a207a..c1ab9e5 100644
--- a/demos/gtk-demo/textwidget.cc
+++ b/demos/gtk-demo/textwidget.cc
@@ -338,7 +338,7 @@ void TextWidget::fontify()
iterStart = m_refTextBuffer->get_iter_at_offset(0);
- Gtk::TextBuffer::iterator iterNext = iterStart;
+ auto iterNext = iterStart;
while(iterNext.forward_line())
{
bool start = true;
diff --git a/gtk/gtkmm/listviewtext.cc b/gtk/gtkmm/listviewtext.cc
index d8d2844..fb60c76 100644
--- a/gtk/gtkmm/listviewtext.cc
+++ b/gtk/gtkmm/listviewtext.cc
@@ -90,7 +90,7 @@ Glib::ustring ListViewText::get_column_title(guint column) const
guint ListViewText::append(const Glib::ustring& column_one_value)
{
- Gtk::TreeModel::Row newRow = *(m_model->append());
+ auto newRow = *(m_model->append());
newRow[m_model_columns.m_columns[0]] = column_one_value;
@@ -99,7 +99,7 @@ guint ListViewText::append(const Glib::ustring& column_one_value)
void ListViewText::prepend(const Glib::ustring& column_one_value)
{
- Gtk::TreeModel::Row newRow = *(m_model->prepend());
+ auto newRow = *(m_model->prepend());
newRow[m_model_columns.m_columns[0]] = column_one_value;
}
@@ -108,8 +108,8 @@ void ListViewText::insert(guint row, const Glib::ustring& column_one_value)
{
g_return_if_fail( row < size() );
- Gtk::ListStore::iterator iter = m_model->children()[row].get_iter();
- Gtk::TreeModel::Row newRow = *(m_model->insert(iter));
+ auto iter = m_model->children()[row].get_iter();
+ auto newRow = *(m_model->insert(iter));
if(!column_one_value.empty())
{
@@ -128,7 +128,7 @@ Glib::ustring ListViewText::get_text(guint row, guint column) const
g_return_val_if_fail( row < size(), result );
- const Gtk::TreeModel::Row childrow = m_model->children()[row];
+ const auto childrow = m_model->children()[row];
childrow.get_value(column, result);
return result;
@@ -138,7 +138,7 @@ void ListViewText::set_text(guint row, guint column, const Glib::ustring& value)
{
g_return_if_fail( row < size() );
- Gtk::TreeModel::Row childrow = m_model->children()[row];
+ auto childrow = m_model->children()[row];
childrow.set_value(column, value);
}
@@ -146,7 +146,7 @@ void ListViewText::set_text(guint row, const Glib::ustring& value)
{
g_return_if_fail( row < size() );
- Gtk::TreeModel::Row childrow = m_model->children()[row];
+ auto childrow = m_model->children()[row];
childrow.set_value(0, value);
}
diff --git a/gtk/gtkmm/treeview_private.cc b/gtk/gtkmm/treeview_private.cc
index 04d73e0..ef7c71f 100644
--- a/gtk/gtkmm/treeview_private.cc
+++ b/gtk/gtkmm/treeview_private.cc
@@ -36,7 +36,7 @@ void SignalProxy_CellData_gtk_callback(GtkTreeViewColumn*, GtkCellRenderer* cell
try
{
// use Slot::operator()
- Gtk::TreeModel::iterator cppiter = Gtk::TreeModel::iterator(model, iter);
+ auto cppiter = Gtk::TreeModel::iterator(model, iter);
if(!cppiter.get_model_gobject())
{
g_warning("SignalProxy_CellData_gtk_callback() The cppiter has no model\n");
diff --git a/gtk/src/treeview.hg b/gtk/src/treeview.hg
index 647127b..65b1a7e 100644
--- a/gtk/src/treeview.hg
+++ b/gtk/src/treeview.hg
@@ -877,7 +877,7 @@ int TreeView::append_column_numeric(const Glib::ustring& title, const TreeModelC
//Connect a cell_data callback, to show the number's text representation in the specified format:
//We use sigc::bind<-1> twice here, instead of sigc::bind() once, because some compilers need the extra
hint.
- Gtk::TreeViewColumn::SlotTreeCellData slot = sigc::bind<-1>(
+ auto slot = sigc::bind<-1>(
sigc::bind<-1>( sigc::ptr_fun(fptr), format),
model_column.index()
);
diff --git a/tests/tree_model_iterator/main.cc b/tests/tree_model_iterator/main.cc
index dd63173..9e5514d 100644
--- a/tests/tree_model_iterator/main.cc
+++ b/tests/tree_model_iterator/main.cc
@@ -14,7 +14,7 @@ test_const_conversion() {
static void
test_assignment_from_const() {
Gtk::TreeModel::iterator non_const_iter;
- Gtk::TreeModel::const_iterator const_iter = non_const_iter;
+ auto const_iter = non_const_iter;
assert(const_iter == non_const_iter);
}
@@ -26,7 +26,7 @@ static void
test_assignment_to_const() {
Gtk::TreeModel::const_iterator const_iter;
// This should not compile:
- Gtk::TreeModel::iterator non_const_iter = const_iter;
+ auto non_const_iter = const_iter;
assert(const_iter == non_const_iter);
}
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]