summaryrefslogtreecommitdiffstats
path: root/lib/gs-plugin-job.h
blob: dcdbc85e5095f3d6c1679cbc8cec714e03ce68b6 (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
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 * vi:set noexpandtab tabstop=8 shiftwidth=8:
 *
 * Copyright (C) 2017-2018 Richard Hughes <richard@hughsie.com>
 *
 * SPDX-License-Identifier: GPL-2.0+
 */

#pragma once

#include <glib-object.h>

#include "gs-app-list.h"
#include "gs-plugin-types.h"

G_BEGIN_DECLS

#define GS_TYPE_PLUGIN_JOB (gs_plugin_job_get_type ())

G_DECLARE_DERIVABLE_TYPE (GsPluginJob, gs_plugin_job, GS, PLUGIN_JOB, GObject)

#include "gs-plugin-loader.h"

struct _GsPluginJobClass
{
	GObjectClass parent_class;

	void (*run_async) (GsPluginJob         *self,
	                   GsPluginLoader      *plugin_loader,
	                   GCancellable        *cancellable,
	                   GAsyncReadyCallback  callback,
	                   gpointer             user_data);
	gboolean (*run_finish) (GsPluginJob   *self,
	                        GAsyncResult  *result,
	                        GError       **error);
};

void		 gs_plugin_job_set_refine_flags		(GsPluginJob	*self,
							 GsPluginRefineFlags refine_flags);
void		 gs_plugin_job_set_dedupe_flags		(GsPluginJob	*self,
							 GsAppListFilterFlags dedupe_flags);
void		 gs_plugin_job_set_interactive		(GsPluginJob	*self,
							 gboolean	 interactive);
void		 gs_plugin_job_set_propagate_error	(GsPluginJob	*self,
							 gboolean	 propagate_error);
void		 gs_plugin_job_set_max_results		(GsPluginJob	*self,
							 guint		 max_results);
void		 gs_plugin_job_set_sort_func		(GsPluginJob	*self,
							 GsAppListSortFunc sort_func,
							 gpointer	 user_data);
void		 gs_plugin_job_set_search		(GsPluginJob	*self,
							 const gchar	*search);
void		 gs_plugin_job_set_app			(GsPluginJob	*self,
							 GsApp		*app);
void		 gs_plugin_job_set_list			(GsPluginJob	*self,
							 GsAppList	*list);
void		 gs_plugin_job_set_file			(GsPluginJob	*self,
							 GFile		*file);
void		 gs_plugin_job_set_plugin		(GsPluginJob	*self,
							 GsPlugin	*plugin);

#define		 gs_plugin_job_newv(a,...)		GS_PLUGIN_JOB(g_object_new(GS_TYPE_PLUGIN_JOB, "action", a, __VA_ARGS__))

#define		 GS_PLUGIN_JOB_DEDUPE_FLAGS_DEFAULT	(GS_APP_LIST_FILTER_FLAG_KEY_ID | \
							 GS_APP_LIST_FILTER_FLAG_KEY_SOURCE | \
							 GS_APP_LIST_FILTER_FLAG_KEY_VERSION)

G_END_DECLS