Branch data Line data Source code
1 : : /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
2 : : *
3 : : * Copyright © 2018, 2019 Endless Mobile, Inc.
4 : : *
5 : : * This library is free software; you can redistribute it and/or
6 : : * modify it under the terms of the GNU Lesser General Public
7 : : * License as published by the Free Software Foundation; either
8 : : * version 2.1 of the License, or (at your option) any later version.
9 : : *
10 : : * This library is distributed in the hope that it will be useful,
11 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 : : * Lesser General Public License for more details.
14 : : *
15 : : * You should have received a copy of the GNU Lesser General Public
16 : : * License along with this library; if not, write to the Free Software
17 : : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 : : *
19 : : * Authors:
20 : : * - Philip Withnall <withnall@endlessm.com>
21 : : */
22 : :
23 : : #pragma once
24 : :
25 : : #include <gio/gio.h>
26 : : #include <glib.h>
27 : : #include <glib-object.h>
28 : : #include <libmogwai-schedule-client/schedule-entry.h>
29 : :
30 : : G_BEGIN_DECLS
31 : :
32 : : /**
33 : : * MwscSchedulerError:
34 : : * @MWSC_SCHEDULER_ERROR_INVALIDATED: The scheduler has disappeared on the bus,
35 : : * due to the service disappearing.
36 : : * @MWSC_SCHEDULER_ERROR_FULL: There are enough schedule entries in the
37 : : * scheduler and it has hit its resource limits.
38 : : * @MWSC_SCHEDULER_ERROR_IDENTIFYING_PEER: The scheduler could not determine
39 : : * required details about this peer process.
40 : : *
41 : : * Errors which can be returned by #MwscScheduler.
42 : : *
43 : : * Since: 0.1.0
44 : : */
45 : : typedef enum
46 : : {
47 : : /* These are local-only: */
48 : : MWSC_SCHEDULER_ERROR_INVALIDATED = 0,
49 : : /* These map to errors from the daemon: */
50 : : MWSC_SCHEDULER_ERROR_FULL,
51 : : MWSC_SCHEDULER_ERROR_IDENTIFYING_PEER,
52 : : } MwscSchedulerError;
53 : : #define MWSC_SCHEDULER_N_ERRORS (MWSC_SCHEDULER_ERROR_IDENTIFYING_PEER - MWSC_SCHEDULER_ERROR_INVALIDATED)
54 : :
55 : : GQuark mwsc_scheduler_error_quark (void);
56 : : #define MWSC_SCHEDULER_ERROR mwsc_scheduler_error_quark ()
57 : :
58 : : #define MWSC_TYPE_SCHEDULER mwsc_scheduler_get_type ()
59 [ - + # # : 19 : G_DECLARE_FINAL_TYPE (MwscScheduler, mwsc_scheduler, MWSC, SCHEDULER, GObject)
# # ]
60 : :
61 : : MwscScheduler *mwsc_scheduler_new (GCancellable *cancellable,
62 : : GError **error);
63 : : void mwsc_scheduler_new_async (GCancellable *cancellable,
64 : : GAsyncReadyCallback callback,
65 : : gpointer user_data);
66 : : MwscScheduler *mwsc_scheduler_new_finish (GAsyncResult *result,
67 : : GError **error);
68 : :
69 : : MwscScheduler *mwsc_scheduler_new_full (GDBusConnection *connection,
70 : : const gchar *name,
71 : : const gchar *object_path,
72 : : GCancellable *cancellable,
73 : : GError **error);
74 : : void mwsc_scheduler_new_full_async (GDBusConnection *connection,
75 : : const gchar *name,
76 : : const gchar *object_path,
77 : : GCancellable *cancellable,
78 : : GAsyncReadyCallback callback,
79 : : gpointer user_data);
80 : : MwscScheduler *mwsc_scheduler_new_full_finish (GAsyncResult *result,
81 : : GError **error);
82 : :
83 : : MwscScheduler *mwsc_scheduler_new_from_proxy (GDBusProxy *proxy,
84 : : GError **error);
85 : :
86 : : MwscScheduleEntry *mwsc_scheduler_schedule (MwscScheduler *self,
87 : : GVariant *parameters,
88 : : GCancellable *cancellable,
89 : : GError **error);
90 : : void mwsc_scheduler_schedule_async (MwscScheduler *self,
91 : : GVariant *parameters,
92 : : GCancellable *cancellable,
93 : : GAsyncReadyCallback callback,
94 : : gpointer user_data);
95 : : MwscScheduleEntry *mwsc_scheduler_schedule_finish (MwscScheduler *self,
96 : : GAsyncResult *result,
97 : : GError **error);
98 : :
99 : : GPtrArray *mwsc_scheduler_schedule_entries (MwscScheduler *self,
100 : : GPtrArray *parameters,
101 : : GCancellable *cancellable,
102 : : GError **error);
103 : : void mwsc_scheduler_schedule_entries_async (MwscScheduler *self,
104 : : GPtrArray *parameters,
105 : : GCancellable *cancellable,
106 : : GAsyncReadyCallback callback,
107 : : gpointer user_data);
108 : : GPtrArray *mwsc_scheduler_schedule_entries_finish (MwscScheduler *self,
109 : : GAsyncResult *result,
110 : : GError **error);
111 : :
112 : : gboolean mwsc_scheduler_hold (MwscScheduler *self,
113 : : const gchar *reason,
114 : : GCancellable *cancellable,
115 : : GError **error);
116 : : void mwsc_scheduler_hold_async (MwscScheduler *self,
117 : : const gchar *reason,
118 : : GCancellable *cancellable,
119 : : GAsyncReadyCallback callback,
120 : : gpointer user_data);
121 : : gboolean mwsc_scheduler_hold_finish (MwscScheduler *self,
122 : : GAsyncResult *result,
123 : : GError **error);
124 : :
125 : : gboolean mwsc_scheduler_release (MwscScheduler *self,
126 : : GCancellable *cancellable,
127 : : GError **error);
128 : : void mwsc_scheduler_release_async (MwscScheduler *self,
129 : : GCancellable *cancellable,
130 : : GAsyncReadyCallback callback,
131 : : gpointer user_data);
132 : : gboolean mwsc_scheduler_release_finish (MwscScheduler *self,
133 : : GAsyncResult *result,
134 : : GError **error);
135 : :
136 : : gboolean mwsc_scheduler_get_allow_downloads (MwscScheduler *self);
137 : :
138 : : G_END_DECLS
|