Bind GtkTreeView row to some object
- From: John Tall <mjtallx gmail com>
- To: gtk-list gnome org
- Subject: Bind GtkTreeView row to some object
- Date: Wed, 26 Nov 2014 22:59:01 +0100
Hello.
I have a GtkTreeView that is used to display some data. Let's say that
I have a class that defines a person, and that I have a number of
objects representing different persons. I want to display the name of
each person in the tree view so I add a row for each person and set
the value of the first column to the name of the person.
GtkTreeIter iter;
GtkListStore *store = ...;
gtk_list_store_append (liststore, &iter);
gtk_list_store_set (liststore, &iter, 0, x_person_get_name (person), -1);
This works fine. But let's say that I want to select a row in the tree
view and show a dialog with more information on the person. So I
connect to the row-activated signal and implement the callback. But
this is where I need a way to get that person object back. I can't
look up the object based on the name of the person, because there can
be multiple persons with the same name.
Is it possible to bind a row in the tree view, or I guess technically
the list store, to my object so that I can figure out which object the
row represents?
J
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]