GtkPropertySelection

GtkPropertySelection — A selection model that uses an item property

Functions

GListModel * gtk_property_selection_new ()

Properties

GListModel * model Read / Write / Construct Only
gchar * property Read / Write / Construct Only

Types and Values

Object Hierarchy

    GObject
    ╰── GtkPropertySelection

Implemented Interfaces

GtkPropertySelection implements GListModel and GtkSelectionModel.

Includes

#include <gtk/gtk.h>

Description

GtkPropertySelection is an implementation of the GtkSelectionModel interface that stores the selected state for each item in a property of the item.

The property named by “property” must be writable boolean property of the item type. GtkPropertySelection preserves the selected state of items when they are added to the model, but it does not listen to changes of the property while the item is a part of the model. It assumes that it has *exclusive* access to the property.

The advantage of storing the selected state in item properties is that the state is *persistent* -- when an item is removed and re-added to the model, it will still have the same selection state. In particular, this makes the selection persist across changes of the sort order if the underlying model is a GtkSortListModel.

Functions

gtk_property_selection_new ()

GListModel *
gtk_property_selection_new (GListModel *model,
                            const char *property);

Creates a new property selection to handle model .

property must be the name of a writable boolean property of the item type of model .

Note that GtkPropertySelection does not monitor the property for changes while the item is part of the model, but it does inherit the initial value when an item is added to the model.

Parameters

model

the GListModel to manage.

[transfer none]

property

the item property to use

 

Returns

a new GtkPropertySelection.

[transfer full][type GtkPropertySelection]

Types and Values

GtkPropertySelection

typedef struct _GtkPropertySelection GtkPropertySelection;

Property Details

The “model” property

  “model”                    GListModel *

The list managed by this selection

Owner: GtkPropertySelection

Flags: Read / Write / Construct Only


The “property” property

  “property”                 gchar *

Item property to store selection state in.

Owner: GtkPropertySelection

Flags: Read / Write / Construct Only

Default value: NULL