summaryrefslogtreecommitdiffstats
path: root/lib/gs-plugin-helpers.h
blob: b4a19f3b487dcff35ae94835305784c001eb6fc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 * vi:set noexpandtab tabstop=8 shiftwidth=8:
 *
 * Copyright (C) 2021 Endless OS Foundation LLC
 *
 * Author: Philip Withnall <pwithnall@endlessos.org>
 *
 * SPDX-License-Identifier: GPL-2.0+
 */

#pragma once

#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>

#include <gnome-software.h>

G_BEGIN_DECLS

typedef struct {
	GsAppList *list;  /* (owned) (not nullable) */
	GsPluginRefineFlags flags;
} GsPluginRefineData;

GsPluginRefineData *gs_plugin_refine_data_new (GsAppList           *list,
                                               GsPluginRefineFlags  flags);
GTask *gs_plugin_refine_data_new_task (gpointer             source_object,
                                       GsAppList           *list,
                                       GsPluginRefineFlags  flags,
                                       GCancellable        *cancellable,
                                       GAsyncReadyCallback  callback,
                                       gpointer             user_data);
void gs_plugin_refine_data_free (GsPluginRefineData *data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GsPluginRefineData, gs_plugin_refine_data_free)

typedef struct {
	guint64 cache_age_secs;
	GsPluginRefreshMetadataFlags flags;
} GsPluginRefreshMetadataData;

GsPluginRefreshMetadataData *gs_plugin_refresh_metadata_data_new (guint64                      cache_age_secs,
                                                                  GsPluginRefreshMetadataFlags flags);
void gs_plugin_refresh_metadata_data_free (GsPluginRefreshMetadataData *data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GsPluginRefreshMetadataData, gs_plugin_refresh_metadata_data_free)

typedef struct {
	GsAppQuery *query;  /* (owned) (nullable) */
	GsPluginListAppsFlags flags;
} GsPluginListAppsData;

GsPluginListAppsData *gs_plugin_list_apps_data_new (GsAppQuery            *query,
                                                    GsPluginListAppsFlags  flags);
GTask *gs_plugin_list_apps_data_new_task (gpointer               source_object,
                                          GsAppQuery            *query,
                                          GsPluginListAppsFlags  flags,
                                          GCancellable          *cancellable,
                                          GAsyncReadyCallback    callback,
                                          gpointer               user_data);
void gs_plugin_list_apps_data_free (GsPluginListAppsData *data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GsPluginListAppsData, gs_plugin_list_apps_data_free)

typedef struct {
	GsApp *repository;  /* (owned) (nullable) */
	GsPluginManageRepositoryFlags flags;
} GsPluginManageRepositoryData;

GsPluginManageRepositoryData *
		gs_plugin_manage_repository_data_new		(GsApp				*repository,
								 GsPluginManageRepositoryFlags   flags);
GTask *		gs_plugin_manage_repository_data_new_task	(gpointer			 source_object,
								 GsApp				*repository,
								 GsPluginManageRepositoryFlags	 flags,
								 GCancellable			*cancellable,
								 GAsyncReadyCallback		 callback,
								 gpointer			 user_data);
void		gs_plugin_manage_repository_data_free		(GsPluginManageRepositoryData	*data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GsPluginManageRepositoryData, gs_plugin_manage_repository_data_free)

typedef struct {
	GPtrArray *list;  /* (element-type GsCategory) (owned) (not nullable) */
	GsPluginRefineCategoriesFlags flags;
} GsPluginRefineCategoriesData;

GsPluginRefineCategoriesData *gs_plugin_refine_categories_data_new (GPtrArray                     *list,
                                                                    GsPluginRefineCategoriesFlags  flags);
GTask *gs_plugin_refine_categories_data_new_task (gpointer                       source_object,
                                                  GPtrArray                     *list,
                                                  GsPluginRefineCategoriesFlags  flags,
                                                  GCancellable                  *cancellable,
                                                  GAsyncReadyCallback            callback,
                                                  gpointer                       user_data);
void gs_plugin_refine_categories_data_free (GsPluginRefineCategoriesData *data);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GsPluginRefineCategoriesData, gs_plugin_refine_categories_data_free)

G_END_DECLS