new FAQ.
Tue Mar 12 00:29:31 2002 Jonathan Blandford <jrb@redhat.com> * gtk/question_index.sgml: new FAQ. * gtk/tmpl/gtktreemodel.sgml: clean up example
This commit is contained in:
parent
5c02002e2c
commit
938cc404c1
@ -1,3 +1,9 @@
|
|||||||
|
Tue Mar 12 00:29:31 2002 Jonathan Blandford <jrb@redhat.com>
|
||||||
|
|
||||||
|
* gtk/question_index.sgml: new FAQ.
|
||||||
|
|
||||||
|
* gtk/tmpl/gtktreemodel.sgml: clean up example
|
||||||
|
|
||||||
2002-03-12 Matthias Clasen <maclas@gmx.de>
|
2002-03-12 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gdk/tmpl/windows.sgml: Document GdkScreen.
|
* gdk/tmpl/windows.sgml: Document GdkScreen.
|
||||||
|
@ -483,6 +483,21 @@ See the <link linkend="TreeWidget">tree widget overview</link>.
|
|||||||
</answer>
|
</answer>
|
||||||
</qandaentry>
|
</qandaentry>
|
||||||
|
|
||||||
|
<qandaentry>
|
||||||
|
<question><para>
|
||||||
|
What's the #GtkTreeView equivalent of gtk_clist_find_row_from_data()?
|
||||||
|
</para></question>
|
||||||
|
|
||||||
|
<answer>
|
||||||
|
<para>
|
||||||
|
As there is no separate data column in the #GtkTreeModel, there's no
|
||||||
|
built in function to find the iter from data. You can write a custom
|
||||||
|
searching function to walk the tree and find the data, or use
|
||||||
|
gtk_tree_model_foreach().
|
||||||
|
</para>
|
||||||
|
</answer>
|
||||||
|
</qandaentry>
|
||||||
|
|
||||||
<qandaentry>
|
<qandaentry>
|
||||||
<question><para>
|
<question><para>
|
||||||
How do I put an image and some text in the same column?
|
How do I put an image and some text in the same column?
|
||||||
|
@ -150,6 +150,8 @@ enum
|
|||||||
{
|
{
|
||||||
GtkTreeModel *list_store;
|
GtkTreeModel *list_store;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
|
gboolean valid;
|
||||||
|
gint row_count = 0;
|
||||||
|
|
||||||
/* make a new list_store */
|
/* make a new list_store */
|
||||||
list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
list_store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_INT);
|
||||||
@ -158,13 +160,11 @@ enum
|
|||||||
populate_model (list_store);
|
populate_model (list_store);
|
||||||
|
|
||||||
/* Get the first iter in the list */
|
/* Get the first iter in the list */
|
||||||
if (gtk_tree_model_get_iter_first (model, &iter))
|
valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||||
{
|
|
||||||
gint row_count = 0;
|
|
||||||
|
|
||||||
/* Walk through the list, reading each row */
|
while (valid)
|
||||||
do
|
|
||||||
{
|
{
|
||||||
|
/* Walk through the list, reading each row */
|
||||||
gchar *str_data;
|
gchar *str_data;
|
||||||
gint int_data;
|
gint int_data;
|
||||||
|
|
||||||
@ -181,13 +181,7 @@ enum
|
|||||||
g_free (str_data);
|
g_free (str_data);
|
||||||
|
|
||||||
row_count ++;
|
row_count ++;
|
||||||
}
|
valid = gtk_tree_model_iter_next (model, &iter))
|
||||||
while (gtk_tree_model_iter_next (model, &iter));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* As gtk_tree_model_get_iter_first(<!>) returned FALSE, the list is empty */
|
|
||||||
g_print ("Model is empty.\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
Loading…
Reference in New Issue
Block a user