![]() |
![]() |
![]() |
Gwyddion Widgets Library Reference Manual | ![]() |
---|---|---|---|---|
GwyInventoryStoreGwyInventoryStore — GtkTreeModel wrapper around GwyInventory |
GwyInventoryStore; GwyInventoryStoreClass; GwyInventoryStore* gwy_inventory_store_new (GwyInventory *inventory); GwyInventory* gwy_inventory_store_get_inventory (GwyInventoryStore *store); gint gwy_inventory_store_get_column_by_name (GwyInventoryStore *store, const gchar *name); gboolean gwy_inventory_store_get_iter (GwyInventoryStore *store, const gchar *name, GtkTreeIter *iter); gboolean gwy_inventory_store_iter_is_valid (GwyInventoryStore *store, GtkTreeIter *iter);
GwyInventoryStore is a simple adaptor class that wraps GwyInventory in GtkTreeModel interface. It is list-only and has persistent iterators. It offers no methods to manipulate items, this should be done on the underlying inventory.
GwyInventoryStore maps inventory item traits to virtual GtkTreeModel
columns. Zeroth column is always of type G_TYPE_POINTER
and contains item
itself. It exists even if item don't export any traits. Columns from 1
onward are formed by item traits. You can obtain column id of a named
item trait with gwy_inventory_store_get_column_by_name()
.
typedef struct { GObjectClass parent_class; void (*reserved1)(void); } GwyInventoryStoreClass;
GwyInventoryStore* gwy_inventory_store_new (GwyInventory *inventory);
Creates a new GtkTreeModel wrapper around a GwyInventory.
inventory : |
An inventory. |
Returns : | The newly created inventory store. |
GwyInventory* gwy_inventory_store_get_inventory (GwyInventoryStore *store);
Gets the inventory a inventory store wraps.
store : |
An inventory store. |
Returns : | The underlying inventory (its reference count is not increased). |
gint gwy_inventory_store_get_column_by_name (GwyInventoryStore *store, const gchar *name);
Gets tree model column corresponding to a trait name.
The underlying inventory must support trait names, except for name
"item"
which always works (and always maps to 0).
store : |
An inventory store. |
name : |
Trait (column) name. |
Returns : | The underlying inventory (its reference count is not increased). |
gboolean gwy_inventory_store_get_iter (GwyInventoryStore *store, const gchar *name, GtkTreeIter *iter);
Initializes a tree iterator to row corresponding to a inventory item.
gboolean gwy_inventory_store_iter_is_valid (GwyInventoryStore *store, GtkTreeIter *iter);
Checks if the given iter is a valid iter for this inventory store.
store : |
An inventory store. |
iter : |
A GtkTreeIter. |
Returns : | TRUE if the iter is valid, FALSE if the iter is invalid.
|