GsAppList: GNOME Software Reference Manual

## GsAppList GsAppList — An application list |

## Stability Level

Unstable, unless otherwise indicated

## Functions

G_STATIC_ASSERT | sizeof ()
gint | (*GsAppListSortFunc) ()
gboolean | (*GsAppListFilterFunc) ()
GsAppList * | gs_app_list_new ()
GsAppList * | gs_app_list_copy ()
void | gs_app_list_add ()
void | gs_app_list_add_list ()
gboolean | gs_app_list_remove ()
void | gs_app_list_remove_all ()
GsApp * | gs_app_list_index ()
GsApp * | gs_app_list_lookup ()
guint | gs_app_list_length ()
void | gs_app_list_sort ()
void | gs_app_list_filter ()
void | gs_app_list_override_progress ()

## Types and Values

enum | GsAppListFilterFlags
#define | GS_TYPE_APP_LIST
| GsAppList

## Includes

    #include <gnome-software.h>

## Description

These functions provide a refcounted list of GsApp objects.

## Functions

### sizeof ()

    G_STATIC_ASSERT
    sizeof ();

### GsAppListSortFunc ()

    gint
    (*GsAppListSortFunc) (GsApp *app1,
                          GsApp *app2,
                          gpointer user_data);

A version of GCompareFunc which is specific to GsApps.

#### Parameters

user_data | user data passed into the sort function |

#### Returns

zero if `app1` and `app2` are equal, a negative value if `app1` comes before `app2` , or a positive value if `app1` comes after `app2`

Since: 41

### GsAppListFilterFunc ()

    gboolean
    (*GsAppListFilterFunc) (GsApp *app,
                            gpointer user_data);

### gs_app_list_new ()

    GsAppList *
    gs_app_list_new (void);

Creates a new list.

#### Returns

A newly allocated GsAppList

Since: 3.22

### gs_app_list_copy ()

    GsAppList *
    gs_app_list_copy (GsAppList *list);

Returns a deep copy of the application list.

#### Parameters

list | A GsAppList |

#### Returns

A newly allocated GsAppList

Since: 3.22

### gs_app_list_add ()

    void
    gs_app_list_add (GsAppList *list,
                     GsApp *app);

If the application does not already exist in the list then it is added, incrementing the reference count. If the application already exists then a warning is printed to the console.

Applications that have the application ID lazy-loaded will always be added to the list, and to clean these up the plugin loader will also call the `gs_app_list_filter_duplicates()` method when all plugins have run.

#### Parameters

list | A GsAppList |
app | A GsApp |

Since: 3.22

### gs_app_list_add_list ()

    void
    gs_app_list_add_list (GsAppList *list,
                          GsAppList *donor);

Adds all the applications in `donor` to `list` .

#### Parameters

list | A GsAppList |
donor | Another GsAppList |

Since: 3.22

### gs_app_list_remove ()

    gboolean
    gs_app_list_remove (GsAppList *list,
                        GsApp *app);

Removes an application from the list. If the application does not exist the request is ignored.

#### Parameters

list | A GsAppList |
app | A GsApp |

#### Returns

`TRUE` if the app was removed, `FALSE` if it did not exist in the `list`

Since: 43

### gs_app_list_remove_all ()

    void
    gs_app_list_remove_all (GsAppList *list);

Removes all applications from the list.

#### Parameters

list | A GsAppList |

Since: 3.22

### gs_app_list_index ()

    GsApp *
    gs_app_list_index (GsAppList *list,
                       guint idx);

Gets an application at a specific position in the list.

#### Parameters

list | A GsAppList |
idx | An index into the list |

#### Returns

a GsApp, or `NULL` if invalid.

[transfer none]

Since: 3.22

### gs_app_list_lookup ()

    GsApp *
    gs_app_list_lookup (GsAppList *list,
                        const gchar *unique_id);

Finds the first matching application in the list using the usual wildcard rules allowed in unique_ids.

#### Parameters

list | A GsAppList |
unique_id | A unique_id |

#### Returns

a GsApp, or `NULL` if not found.

[transfer none]

Since: 3.22

### gs_app_list_length ()

    guint
    gs_app_list_length (GsAppList *list);

Gets the length of the application list.

#### Parameters

list | A GsAppList |

#### Returns

Integer

Since: 3.22

### gs_app_list_sort ()

    void
    gs_app_list_sort (GsAppList *list,
                      GsAppListSortFunc func,
                      gpointer user_data);

Sorts the application list.

#### Parameters

list | A GsAppList |
func | A GsAppListSortFunc |
user_data | user data to pass to `func` |

Since: 3.22

### gs_app_list_filter ()

    void
    gs_app_list_filter (GsAppList *list,
                        GsAppListFilterFunc func,
                        gpointer user_data);

If `func()` returns TRUE for the GsApp, then the app is kept.

#### Parameters

list | A GsAppList |
func | A GsAppListFilterFunc |
user_data | the user pointer to pass to `func` |

Since: 3.22

### gs_app_list_override_progress ()

    void
    gs_app_list_override_progress (GsAppList *list,
                                   guint progress);

Override the progress property to be this value, or use `GS_APP_PROGRESS_UNKNOWN`, to unset the override. This can be used when only the overall progress is known, instead of a per-application progress.

#### Parameters

list | a GsAppList |
progress | a progress to set, between 0 and 100 inclusive, or `GS_APP_PROGRESS_UNKNOWN` |

Since: 42

## Types and Values

### enum GsAppListFilterFlags

Flags to use when filtering. The priority of each GsApp is used to choose which application object to keep.

#### Members

GS_APP_LIST_FILTER_FLAG_NONE | No flags set |
GS_APP_LIST_FILTER_FLAG_KEY_ID | Filter by ID |
GS_APP_LIST_FILTER_FLAG_KEY_SOURCE | Filter by default source |
GS_APP_LIST_FILTER_FLAG_KEY_VERSION | Filter by version |
GS_APP_LIST_FILTER_FLAG_PREFER_INSTALLED | Prefer installed applications |
GS_APP_LIST_FILTER_FLAG_KEY_ID_PROVIDES | Filter using the provides ID |
GS_APP_LIST_FILTER_FLAG_LAST |  |
GS_APP_LIST_FILTER_FLAG_MASK |  |

Since: 40

### GS_TYPE_APP_LIST

    #define GS_TYPE_APP_LIST (gs_app_list_get_type ())

### GsAppList

    typedef struct _GsAppList GsAppList;