1/*
2 * Copyright © 2010 Codethink Limited
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 *
17 * Author: Ryan Lortie <desrt@desrt.ca>
18 */
19
20#ifndef __G_PERMISSION_H__
21#define __G_PERMISSION_H__
22
23#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24#error "Only <gio/gio.h> can be included directly."
25#endif
26
27#include <gio/giotypes.h>
28
29G_BEGIN_DECLS
30
31#define G_TYPE_PERMISSION (g_permission_get_type ())
32#define G_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
33 G_TYPE_PERMISSION, GPermission))
34#define G_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
35 G_TYPE_PERMISSION, GPermissionClass))
36#define G_IS_PERMISSION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
37 G_TYPE_PERMISSION))
38#define G_IS_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
39 G_TYPE_PERMISSION))
40#define G_PERMISSION_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
41 G_TYPE_PERMISSION, GPermissionClass))
42
43typedef struct _GPermissionPrivate GPermissionPrivate;
44typedef struct _GPermissionClass GPermissionClass;
45
46struct _GPermission
47{
48 GObject parent_instance;
49
50 /*< private >*/
51 GPermissionPrivate *priv;
52};
53
54struct _GPermissionClass {
55 GObjectClass parent_class;
56
57 gboolean (*acquire) (GPermission *permission,
58 GCancellable *cancellable,
59 GError **error);
60 void (*acquire_async) (GPermission *permission,
61 GCancellable *cancellable,
62 GAsyncReadyCallback callback,
63 gpointer user_data);
64 gboolean (*acquire_finish) (GPermission *permission,
65 GAsyncResult *result,
66 GError **error);
67
68 gboolean (*release) (GPermission *permission,
69 GCancellable *cancellable,
70 GError **error);
71 void (*release_async) (GPermission *permission,
72 GCancellable *cancellable,
73 GAsyncReadyCallback callback,
74 gpointer user_data);
75 gboolean (*release_finish) (GPermission *permission,
76 GAsyncResult *result,
77 GError **error);
78
79 gpointer reserved[16];
80};
81
82GLIB_AVAILABLE_IN_ALL
83GType g_permission_get_type (void);
84GLIB_AVAILABLE_IN_ALL
85gboolean g_permission_acquire (GPermission *permission,
86 GCancellable *cancellable,
87 GError **error);
88GLIB_AVAILABLE_IN_ALL
89void g_permission_acquire_async (GPermission *permission,
90 GCancellable *cancellable,
91 GAsyncReadyCallback callback,
92 gpointer user_data);
93GLIB_AVAILABLE_IN_ALL
94gboolean g_permission_acquire_finish (GPermission *permission,
95 GAsyncResult *result,
96 GError **error);
97
98GLIB_AVAILABLE_IN_ALL
99gboolean g_permission_release (GPermission *permission,
100 GCancellable *cancellable,
101 GError **error);
102GLIB_AVAILABLE_IN_ALL
103void g_permission_release_async (GPermission *permission,
104 GCancellable *cancellable,
105 GAsyncReadyCallback callback,
106 gpointer user_data);
107GLIB_AVAILABLE_IN_ALL
108gboolean g_permission_release_finish (GPermission *permission,
109 GAsyncResult *result,
110 GError **error);
111
112GLIB_AVAILABLE_IN_ALL
113gboolean g_permission_get_allowed (GPermission *permission);
114GLIB_AVAILABLE_IN_ALL
115gboolean g_permission_get_can_acquire (GPermission *permission);
116GLIB_AVAILABLE_IN_ALL
117gboolean g_permission_get_can_release (GPermission *permission);
118
119GLIB_AVAILABLE_IN_ALL
120void g_permission_impl_update (GPermission *permission,
121 gboolean allowed,
122 gboolean can_acquire,
123 gboolean can_release);
124
125G_END_DECLS
126
127#endif /* __G_PERMISSION_H__ */
128

source code of include/glib-2.0/gio/gpermission.h