From: TimePath Date: Fri, 29 Dec 2017 08:48:00 +0000 (+1100) Subject: GTK: wrap gtk_list_store_append X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f92114c3f8baaedf9e0a4ff21141e9349d838f5c;p=xonotic%2Fnetradiant.git GTK: wrap gtk_list_store_append --- diff --git a/libs/uilib/uilib.cpp b/libs/uilib/uilib.cpp index b53137a5..4832d92f 100644 --- a/libs/uilib/uilib.cpp +++ b/libs/uilib/uilib.cpp @@ -373,6 +373,11 @@ namespace ui { gtk_list_store_clear(this); } + void IListStore::append() + { + gtk_list_store_append(this, nullptr); + } + // IMPL(TreePath, GTK_TREE_PATH); TreePath::TreePath(ui::New_t) : TreePath(gtk_tree_path_new()) diff --git a/libs/uilib/uilib.h b/libs/uilib/uilib.h index 482d720a..b4d315c9 100644 --- a/libs/uilib/uilib.h +++ b/libs/uilib/uilib.h @@ -528,6 +528,8 @@ namespace ui { template void append(T... args); + + void append(); ); WRAP(TreeSelection, Object, _GtkTreeSelection, (), diff --git a/radiant/build.cpp b/radiant/build.cpp index 8c733dd4..13938ce1 100644 --- a/radiant/build.cpp +++ b/radiant/build.cpp @@ -653,8 +653,7 @@ void BSPCommandList_Construct( ui::ListStore store, Project& project ){ store.append(0, (*i).first.c_str()); } - GtkTreeIter lastIter; - gtk_list_store_append( store, &lastIter ); + store.append(); } class ProjectList @@ -695,8 +694,7 @@ gboolean project_cell_edited( GtkCellRendererText* cell, gchar* path_string, gch project.push_back( Project::value_type( new_text, Build() ) ); gtk_list_store_set( projectList->m_store, &iter, 0, new_text, -1 ); - GtkTreeIter lastIter; - gtk_list_store_append( projectList->m_store, &lastIter ); + projectList->m_store.append(); } gtk_tree_path_free( path ); @@ -753,8 +751,7 @@ gboolean project_selection_changed( GtkTreeSelection* selection, ui::ListStore s { store.append(0, (*i).c_str()); } - GtkTreeIter lastIter; - gtk_list_store_append( store, &lastIter ); + store.append(); } else { @@ -795,8 +792,7 @@ gboolean commands_cell_edited( GtkCellRendererText* cell, gchar* path_string, gc gtk_list_store_set( store, &iter, 0, new_text, -1 ); - GtkTreeIter lastIter; - gtk_list_store_append( store, &lastIter ); + store.append(); } gtk_tree_path_free( path );