GTK: wrap gtk_list_store_append
authorTimePath <andrew.hardaker1995@gmail.com>
Fri, 29 Dec 2017 08:48:00 +0000 (19:48 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Fri, 29 Dec 2017 08:48:00 +0000 (19:48 +1100)
libs/uilib/uilib.cpp
libs/uilib/uilib.h
radiant/build.cpp

index b53137a..4832d92 100644 (file)
@@ -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())
index 482d720..b4d315c 100644 (file)
@@ -528,6 +528,8 @@ namespace ui {
 
          template<class... T>
          void append(T... args);
+
+         void append();
     );
 
     WRAP(TreeSelection, Object, _GtkTreeSelection, (),
index 8c733dd..13938ce 100644 (file)
@@ -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 );