Branch data Line data Source code
1 : : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 : : *
3 : : * Copyright 2025 GNOME Foundation, Inc.
4 : : *
5 : : * SPDX-License-Identifier: LGPL-2.1-or-later
6 : : *
7 : : * This library is free software; you can redistribute it and/or
8 : : * modify it under the terms of the GNU Lesser General Public
9 : : * License as published by the Free Software Foundation; either
10 : : * version 2.1 of the License, or (at your option) any later version.
11 : : *
12 : : * This library is distributed in the hope that it will be useful,
13 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 : : * Lesser General Public License for more details.
16 : : *
17 : : * You should have received a copy of the GNU Lesser General Public
18 : : * License along with this library; if not, write to the Free Software
19 : : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 : : *
21 : : * Authors:
22 : : * - Philip Withnall <pwithnall@gnome.org>
23 : : */
24 : :
25 : : #pragma once
26 : :
27 : : #include <glib.h>
28 : : #include <glib-object.h>
29 : : #include <gio/gio.h>
30 : : #include <libmalcontent/malcontent.h>
31 : :
32 : : G_BEGIN_DECLS
33 : :
34 : : /**
35 : : * MctFilterUpdaterError:
36 : : * @MCT_FILTER_UPDATER_ERROR_BUSY: Filters are already being updated.
37 : : * @MCT_FILTER_UPDATER_ERROR_DISABLED: Web filtering is disabled for the
38 : : * specified user.
39 : : * @MCT_FILTER_UPDATER_ERROR_QUERYING_POLICY: Web filtering policy for the
40 : : * given user was invalid or could not be retrieved.
41 : : * @MCT_FILTER_UPDATER_ERROR_INVALID_FILTER_FORMAT: An input filter list was in
42 : : * an invalid format.
43 : : * @MCT_FILTER_UPDATER_ERROR_FILE_SYSTEM: A local file operation failed.
44 : : * @MCT_FILTER_UPDATER_ERROR_DOWNLOADING: Failed to download a filter list over
45 : : * the network.
46 : : *
47 : : * Errors which can be returned by [class@Malcontent.FilterUpdater].
48 : : *
49 : : * Since: 0.14.0
50 : : */
51 : : typedef enum
52 : : {
53 : : MCT_FILTER_UPDATER_ERROR_BUSY = 0,
54 : : MCT_FILTER_UPDATER_ERROR_DISABLED,
55 : : MCT_FILTER_UPDATER_ERROR_QUERYING_POLICY,
56 : : MCT_FILTER_UPDATER_ERROR_INVALID_FILTER_FORMAT,
57 : : MCT_FILTER_UPDATER_ERROR_FILE_SYSTEM,
58 : : MCT_FILTER_UPDATER_ERROR_DOWNLOADING,
59 : : } MctFilterUpdaterError;
60 : : #define MCT_FILTER_UPDATER_N_ERRORS (MCT_FILTER_UPDATER_ERROR_DOWNLOADING + 1)
61 : :
62 : : GQuark mct_filter_updater_error_quark (void);
63 : : #define MCT_FILTER_UPDATER_ERROR mct_filter_updater_error_quark ()
64 : :
65 : : #define MCT_TYPE_FILTER_UPDATER mct_filter_updater_get_type ()
66 [ - + + - : 8 : G_DECLARE_FINAL_TYPE (MctFilterUpdater, mct_filter_updater, MCT,
+ - ][ + - ]
67 : : FILTER_UPDATER, GObject)
68 : :
69 : : MctFilterUpdater *mct_filter_updater_new (MctManager *policy_manager,
70 : : MctUserManager *user_manager,
71 : : GFile *state_directory,
72 : : GFile *cache_directory);
73 : :
74 : : void mct_filter_updater_update_filters_async (MctFilterUpdater *self,
75 : : uid_t uid,
76 : : GCancellable *cancellable,
77 : : GAsyncReadyCallback callback,
78 : : void *user_data);
79 : : gboolean mct_filter_updater_update_filters_finish (MctFilterUpdater *self,
80 : : GAsyncResult *result,
81 : : GError **error);
82 : :
83 : : G_END_DECLS
|