XfceItemListModel

XfceItemListModel — Model for XfceItemListView

Functions

Properties

Signals

void after-move-item Run Last
void after-remove-item Run Last
void before-move-item Run Last
void before-remove-item Run Last
void reloaded Run Last

Types and Values

Object Hierarchy

    GEnum
    ╰── XfceItemListModelColumn
    GFlags
    ╰── XfceItemListModelFlags
    GObject
    ╰── XfceItemListModel
        ╰── XfceItemListStore

Implemented Interfaces

XfceItemListModel implements GtkTreeModel, GtkTreeDragSource and GtkTreeDragDest.

Includes

#include <libxfce4ui/libxfce4ui.h>

Description

A model that already implements the complex parts of the GtkTreeModel, and allows you to focus on your data.

You don't need to implement the GtkTreeModel, GtkTreeDragSource, GtkTreeDragDest methods yourself. You also shouldn't call signals from GtkTreeModel from overridden methods. However, if you define your new methods in a descendant class, then you must call the GtkTreeView signals yourself.

Not all virtual functions need to be implemented, depending on the value of the “list-flags” property.

Functions

xfce_item_list_model_get_list_n_columns ()

gint
xfce_item_list_model_get_list_n_columns
                               (XfceItemListModel *model);

Parameters

Returns

Number of columns

Since: 4.21.3


xfce_item_list_model_get_list_column_type ()

GType
xfce_item_list_model_get_list_column_type
                               (XfceItemListModel *model,
                                gint column);

Parameters

model

XfceItemListModel

 

column

Columns from XfceItemListModelColumn, or custom columns after XFCE_ITEM_LIST_MODEL_COLUMN_USER

 

Returns

Column type

Since: 4.21.3


xfce_item_list_model_get_list_flags ()

XfceItemListModelFlags
xfce_item_list_model_get_list_flags (XfceItemListModel *model);

Parameters

Returns

Supported model features

Since: 4.21.3


xfce_item_list_model_get_n_items ()

gint
xfce_item_list_model_get_n_items (XfceItemListModel *model);

Parameters

Returns

Number of items

Since: 4.21.3


xfce_item_list_model_get_item_value ()

void
xfce_item_list_model_get_item_value (XfceItemListModel *model,
                                     gint index,
                                     gint column,
                                     GValue *value);

Parameters

model

XfceItemListModel

 

index

Item index

 

column

Columns from XfceItemListModelColumn, or custom columns after XFCE_ITEM_LIST_MODEL_COLUMN_USER

 

value

an empty GValue to set.

[out][transfer none]

Since: 4.21.3


xfce_item_list_model_move ()

void
xfce_item_list_model_move (XfceItemListModel *model,
                           gint source_index,
                           gint dest_index);

Moves one item from the source_index position to the dest_index position

Parameters

model

XfceItemListModel

 

source_index

Index where the item will be taken from

 

dest_index

Index where the item will be inserted

 

Since: 4.21.3


xfce_item_list_model_set_activity ()

void
xfce_item_list_model_set_activity (XfceItemListModel *model,
                                   gint index,
                                   gboolean value);

Parameters

model

XfceItemListModel

 

index

Item index

 

value

Activity value

 

Since: 4.21.3


xfce_item_list_model_remove ()

gboolean
xfce_item_list_model_remove (XfceItemListModel *model,
                             gint index);

Parameters

model

XfceItemListModel

 

index

Item index

 

Returns

If the item was removed then returns TRUE

Since: 4.21.3


xfce_item_list_model_reset ()

void
xfce_item_list_model_reset (XfceItemListModel *model);

Parameters

Since: 4.21.3


xfce_item_list_model_set_index ()

void
xfce_item_list_model_set_index (XfceItemListModel *model,
                                GtkTreeIter *iter,
                                gint index);

Parameters

model

XfceItemListModel

 

iter

Iterator that will be set to the specified index

 

index

The index that will be set to the iterator

 

Since: 4.21.3


xfce_item_list_model_get_index ()

gint
xfce_item_list_model_get_index (XfceItemListModel *model,
                                GtkTreeIter *iter);

Parameters

model

XfceItemListModel

 

iter

Iterator from which the index will be retrieved

 

Returns

Index extracted from iterator

Since: 4.21.3


xfce_item_list_model_test ()

gboolean
xfce_item_list_model_test (XfceItemListModel *model,
                           gint index,
                           gint column);

Returns TRUE if the column value is TRUE.

Parameters

model

XfceItemListModel

 

index

Item index

 

column

Column with type boolean for test

 

Returns

TRUE if test is successful

Since: 4.21.3


xfce_item_list_model_test_any ()

gboolean
xfce_item_list_model_test_any (XfceItemListModel *model,
                               const gint *indexes,
                               gint n_indexes,
                               gint column);

Returns TRUE if there is at least one item with a column value of TRUE.

Parameters

model

XfceItemListModel

 

indexes

Item indexes

 

n_indexes

Number of indexes

 

column

Column with type boolean for test

 

Returns

TRUE if test is successful

Since: 4.21.3


xfce_item_list_model_test_all ()

gboolean
xfce_item_list_model_test_all (XfceItemListModel *model,
                               const gint *indexes,
                               gint n_indexes,
                               gint column);

Returns TRUE if all columns of all items are TRUE, or n_indexes is 0.

Parameters

model

XfceItemListModel

 

indexes

Item indexes

 

n_indexes

Number of indexes

 

column

Column with type boolean for test

 

Returns

TRUE if test is successful

Since: 4.21.3


xfce_item_list_model_changed ()

void
xfce_item_list_model_changed (XfceItemListModel *model);

Makes GtkTreeView think that all items have changed their value.

Parameters

Since: 4.21.3


xfce_item_list_model_reloaded ()

void
xfce_item_list_model_reloaded (XfceItemListModel *model);

Synchronizes GtkTreeView with the new state of the model after it has been reloaded.

Parameters

Since: 4.21.3

Types and Values

XfceItemListModel

typedef struct _XfceItemListModel XfceItemListModel;

struct XfceItemListModelClass

struct XfceItemListModelClass {
  gint (*get_list_n_columns) (XfceItemListModel *model);

  GType (*get_list_column_type) (XfceItemListModel *model,
                                 gint column);

  gint (*get_n_items) (XfceItemListModel *model);

  void (*get_item_value) (XfceItemListModel *model,
                          gint index,
                          gint column,
                          GValue *value);

  void (*move) (XfceItemListModel *model,
                gint source_index,
                gint dest_index);

  void (*set_activity) (XfceItemListModel *model,
                        gint index,
                        gboolean value);

  gboolean (*remove) (XfceItemListModel *model,
                      gint index);

  void (*reset) (XfceItemListModel *model);
};

Members

get_list_n_columns ()

You can override this method to add more columns

 

get_list_column_type ()

You can override this method to add your own columns

 

get_n_items ()

Required for implementation

 

get_item_value ()

Required for implementation

 

move ()

Method must be implemented if the XFCE_ITEM_LIST_MODEL_REORDERABLE flag is set

 

set_activity ()

Method must be implemented if there is at least one item with column XFCE_ITEM_LIST_MODEL_COLUMN_ACTIVABLE that is TRUE

 

remove ()

Method must be implemented if the XFCE_ITEM_LIST_MODEL_REMOVABLE flag is set

 

reset ()

Method must be implemented if the XFCE_ITEM_LIST_MODEL_RESETTABLE flag is set

 

Since: 4.21.3


enum XfceItemListModelColumn

Members

XFCE_ITEM_LIST_MODEL_COLUMN_ACTIVE

boolean, required.

 

XFCE_ITEM_LIST_MODEL_COLUMN_ACTIVABLE

boolean, required.

 

XFCE_ITEM_LIST_MODEL_COLUMN_ICON

GIcon, required.

 

XFCE_ITEM_LIST_MODEL_COLUMN_NAME

string, markup, required.

 

XFCE_ITEM_LIST_MODEL_COLUMN_TOOLTIP

string, required.

 

XFCE_ITEM_LIST_MODEL_COLUMN_EDITABLE

boolean, required if the XFCE_ITEM_LIST_MODEL_EDITABLE flag is set.

 

XFCE_ITEM_LIST_MODEL_COLUMN_REMOVABLE

boolean, required if the XFCE_ITEM_LIST_MODEL_REMOVABLE flag is set.

 

XFCE_ITEM_LIST_MODEL_COLUMN_USER

If you need to add your own columns, then your first column should have this value.

 

Since: 4.21.3


enum XfceItemListModelFlags

Specifies the model's capabilities

Members

XFCE_ITEM_LIST_MODEL_NONE

No additional features.

 

XFCE_ITEM_LIST_MODEL_REORDERABLE

The order of items can be changed.

 

XFCE_ITEM_LIST_MODEL_ADDABLE

Items can be added.

 

XFCE_ITEM_LIST_MODEL_REMOVABLE

Items can be removed.

 

XFCE_ITEM_LIST_MODEL_EDITABLE

An edit dialog can be opened for each item.

 

XFCE_ITEM_LIST_MODEL_RESETTABLE

A button "reset to default" will be offered.

 

Since: 4.21.3

Property Details

The “list-flags” property

  “list-flags”               XfceItemListModelFlags

Model feature flags, XfceItemListView automatically responds to their changes.

Owner: XfceItemListModel

Flags: Read / Write

Since: 4.21.3

Signal Details

The “after-move-item” signal

void
user_function (XfceItemListModel *xfceitemlistmodel,
               int                arg1,
               int                arg2,
               gpointer           user_data)

Flags: Run Last


The “after-remove-item” signal

void
user_function (XfceItemListModel *xfceitemlistmodel,
               int                arg1,
               gpointer           user_data)

Flags: Run Last


The “before-move-item” signal

void
user_function (XfceItemListModel *xfceitemlistmodel,
               int                arg1,
               int                arg2,
               gpointer           user_data)

Flags: Run Last


The “before-remove-item” signal

void
user_function (XfceItemListModel *xfceitemlistmodel,
               int                arg1,
               gpointer           user_data)

Flags: Run Last


The “reloaded” signal

void
user_function (XfceItemListModel *xfceitemlistmodel,
               gpointer           user_data)

Flags: Run Last