## gva-columns gva-columns — Column Creation and Persistence |

## Synopsis

    GtkTreeViewColumn *  gva_columns_new_from_id            (GvaGameStoreColumn column_id);
    GtkTreeViewColumn *  gva_columns_new_from_name          (const gchar *column_name);
    gboolean            gva_columns_lookup_id               (const gchar *column_name,
                                                             GvaGameStoreColumn *column_id);
    const gchar *        gva_columns_lookup_name            (GvaGameStoreColumn column_id);
    const gchar *        gva_columns_lookup_title           (GvaGameStoreColumn column_id);
    void                gva_columns_load                    (GtkTreeView *view);
    void                gva_columns_save                    (GtkTreeView *view);
    GSList *             gva_columns_get_names              (GtkTreeView *view,
                                                             gboolean visible_only);
    GSList *             gva_columns_get_names_full         (GtkTreeView *view);
    gboolean            gva_columns_query_tooltip           (GtkTreeViewColumn *column,
                                                             GtkTreePath *path,
                                                             GtkTooltip *tooltip);

## Description

These functions manipulate the columns in the main tree view.

## Details

### gva_columns_new_from_id ()

    GtkTreeViewColumn *  gva_columns_new_from_id            (GvaGameStoreColumn column_id);

Creates a new GtkTreeViewColumn from the given `column_id`, configured for use in the main tree view.

`column_id` : | the ID of the column to create
Returns : | a new GtkTreeViewColumn

### gva_columns_new_from_name ()

    GtkTreeViewColumn *  gva_columns_new_from_name          (const gchar *column_name);

Creates a new GtkTreeViewColumn from the given `column_name` (as stored in GSettings), configured for use in the main tree view.

`column_name` : | the name of the column to create
Returns : | a new GtkTreeViewColumn

### gva_columns_lookup_id ()

    gboolean            gva_columns_lookup_id               (const gchar *column_name,
                                                             GvaGameStoreColumn *column_id);

Looks up the numeric column ID corresponding to `column_name`, and write the result to `column_id` if found.

`column_name` : | the name of the column to lookup
`column_id` : | return location for the column ID
Returns : | `TRUE` if a column ID was found, `FALSE` otherwise

### gva_columns_lookup_name ()

    const gchar *        gva_columns_lookup_name            (GvaGameStoreColumn column_id);

Looks up the column name corresponding to `column_id`.

`column_id` : | the ID of the column to lookup
Returns : | the column name, or `NULL` if not found

### gva_columns_lookup_title ()

    const gchar *        gva_columns_lookup_title           (GvaGameStoreColumn column_id);

Looks up the column title corresponding to `column_id`.

`column_id` : | the ID of the column to lookup
Returns : | the column title, or `NULL` if not found

### gva_columns_load ()

    void                gva_columns_load                    (GtkTreeView *view);

Loads `view` with columns in the order stored in the GSettings key `all-columns`, but only makes visible those columns listed in `columns`. Newly supported columns are appended to `view` but remain invisible until explicitly selected in the Preferences window.

Each column is loaded by reading the column name from GSettings and passing it to `gva_columns_new_from_name()` to create the GtkTreeViewColumn.

`view` : | a GtkTreeView

### gva_columns_save ()

    void                gva_columns_save                    (GtkTreeView *view);

Writes the column order and visible columns of `view` to the GSettings keys `all-columns` and `columns` respectively, using `gva_columns_get_names()` to extract the column names.

`view` : | a GtkTreeView

### gva_columns_get_names ()

    GSList *             gva_columns_get_names              (GtkTreeView *view,
                                                             gboolean visible_only);

Extracts a list of column names from `view`, using `gva_columns_lookup_name()` to convert each numeric column ID to a name. If `visible_only` is `TRUE` then only visible columns are included in the list. The column name strings are owned by `view` and should not be freed; only the list itself should be freed using `g_slist_free()`.

`view` : | a GtkTreeView
`visible_only` : | only extract visible columns
Returns : | a GSList of column names

### gva_columns_get_names_full ()

    GSList *             gva_columns_get_names_full         (GtkTreeView *view);

Extracts a list of column names from `view`, plus any additional column names from the game database necessary to render the tree view cells. The column name strings are owned by `view` and should not be freed; only the list itself should be freed using `g_slist_free()`.

`view` : | a GtkTreeView
Returns : | a GSList of column names

### gva_columns_query_tooltip ()

    gboolean            gva_columns_query_tooltip           (GtkTreeViewColumn *column,
                                                             GtkTreePath *path,
                                                             GtkTooltip *tooltip);

Configures `tooltip` for the given `column` and `path`.

`column` : | a GtkTreeViewColumn
`path` : | a GtkTreePath
`tooltip` : | a GtkTooltip
Returns : | `TRUE` if the tooltip should be shown