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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
* vi:set noexpandtab tabstop=8 shiftwidth=8:
*
* Copyright (C) 2012-2016 Richard Hughes <richard@hughsie.com>
* Copyright (C) 2020 Kalev Lember <klember@redhat.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#pragma once
#include <appstream-glib.h>
#include <glib-object.h>
#include <gmodule.h>
#include <gio/gio.h>
#include <libsoup/soup.h>
#include "gs-app.h"
#include "gs-app-list.h"
#include "gs-category.h"
#include "gs-plugin-event.h"
#include "gs-plugin-types.h"
G_BEGIN_DECLS
#define GS_TYPE_PLUGIN (gs_plugin_get_type ())
G_DECLARE_DERIVABLE_TYPE (GsPlugin, gs_plugin, GS, PLUGIN, GObject)
struct _GsPluginClass
{
GObjectClass parent_class;
void (*updates_changed) (GsPlugin *plugin);
void (*status_changed) (GsPlugin *plugin,
GsApp *app,
guint status);
void (*reload) (GsPlugin *plugin);
void (*report_event) (GsPlugin *plugin,
GsPluginEvent *event);
void (*allow_updates) (GsPlugin *plugin,
gboolean allow_updates);
void (*basic_auth_start) (GsPlugin *plugin,
const gchar *remote,
const gchar *realm,
GCallback callback,
gpointer user_data);
gpointer padding[25];
};
typedef struct GsPluginData GsPluginData;
/* helpers */
#define GS_PLUGIN_ERROR gs_plugin_error_quark ()
GQuark gs_plugin_error_quark (void);
/* public getters and setters */
GsPluginData *gs_plugin_alloc_data (GsPlugin *plugin,
gsize sz);
GsPluginData *gs_plugin_get_data (GsPlugin *plugin);
const gchar *gs_plugin_get_name (GsPlugin *plugin);
const gchar *gs_plugin_get_appstream_id (GsPlugin *plugin);
void gs_plugin_set_appstream_id (GsPlugin *plugin,
const gchar *appstream_id);
gboolean gs_plugin_get_enabled (GsPlugin *plugin);
void gs_plugin_set_enabled (GsPlugin *plugin,
gboolean enabled);
gboolean gs_plugin_has_flags (GsPlugin *plugin,
GsPluginFlags flags);
void gs_plugin_add_flags (GsPlugin *plugin,
GsPluginFlags flags);
void gs_plugin_remove_flags (GsPlugin *plugin,
GsPluginFlags flags);
guint gs_plugin_get_scale (GsPlugin *plugin);
const gchar *gs_plugin_get_locale (GsPlugin *plugin);
const gchar *gs_plugin_get_language (GsPlugin *plugin);
SoupSession *gs_plugin_get_soup_session (GsPlugin *plugin);
void gs_plugin_set_soup_session (GsPlugin *plugin,
SoupSession *soup_session);
void gs_plugin_add_rule (GsPlugin *plugin,
GsPluginRule rule,
const gchar *name);
/* helpers */
GBytes *gs_plugin_download_data (GsPlugin *plugin,
GsApp *app,
const gchar *uri,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_download_file (GsPlugin *plugin,
GsApp *app,
const gchar *uri,
const gchar *filename,
GCancellable *cancellable,
GError **error);
gchar *gs_plugin_download_rewrite_resource (GsPlugin *plugin,
GsApp *app,
const gchar *resource,
GCancellable *cancellable,
GError **error);
gboolean gs_plugin_check_distro_id (GsPlugin *plugin,
const gchar *distro_id);
GsApp *gs_plugin_cache_lookup (GsPlugin *plugin,
const gchar *key);
void gs_plugin_cache_add (GsPlugin *plugin,
const gchar *key,
GsApp *app);
void gs_plugin_cache_remove (GsPlugin *plugin,
const gchar *key);
void gs_plugin_cache_invalidate (GsPlugin *plugin);
void gs_plugin_status_update (GsPlugin *plugin,
GsApp *app,
GsPluginStatus status);
gboolean gs_plugin_app_launch (GsPlugin *plugin,
GsApp *app,
GError **error);
void gs_plugin_updates_changed (GsPlugin *plugin);
void gs_plugin_reload (GsPlugin *plugin);
const gchar *gs_plugin_status_to_string (GsPluginStatus status);
void gs_plugin_report_event (GsPlugin *plugin,
GsPluginEvent *event);
void gs_plugin_set_allow_updates (GsPlugin *plugin,
gboolean allow_updates);
gboolean gs_plugin_get_network_available (GsPlugin *plugin);
void gs_plugin_basic_auth_start (GsPlugin *plugin,
const gchar *remote,
const gchar *realm,
GCallback callback,
gpointer user_data);
G_END_DECLS
|