docs: Improve GtkTreeModel iteration pattern
Iterating over the model in this way means that use of continue is less error-prone, as the increment is part of the loop construct. https://bugzilla.gnome.org/show_bug.cgi?id=548793
This commit is contained in:
parent
e677cee28f
commit
c627b22126
@ -168,12 +168,12 @@
|
|||||||
* /* Fill the list store with data */
|
* /* Fill the list store with data */
|
||||||
* populate_model (list_store);
|
* populate_model (list_store);
|
||||||
*
|
*
|
||||||
* /* Get the first iter in the list */
|
* /* Get the first iter in the list, check it is valid and walk
|
||||||
* valid = gtk_tree_model_get_iter_first (list_store, &iter);
|
* * through the list, reading each row. */
|
||||||
*
|
* for (valid = gtk_tree_model_get_iter_first (list_store, &iter);
|
||||||
* while (valid)
|
* valid;
|
||||||
|
* valid = gtk_tree_model_iter_next (list_store, &iter))
|
||||||
* {
|
* {
|
||||||
* /* Walk through the list, reading each row */
|
|
||||||
* gchar *str_data;
|
* gchar *str_data;
|
||||||
* gint int_data;
|
* gint int_data;
|
||||||
*
|
*
|
||||||
@ -190,7 +190,6 @@
|
|||||||
* g_free (str_data);
|
* g_free (str_data);
|
||||||
*
|
*
|
||||||
* row_count++;
|
* row_count++;
|
||||||
* valid = gtk_tree_model_iter_next (list_store, &iter);
|
|
||||||
* }
|
* }
|
||||||
* </programlisting>
|
* </programlisting>
|
||||||
* </example>
|
* </example>
|
||||||
|
Loading…
Reference in New Issue
Block a user