Merge branch 'test-ip_mreq_source-android-only' into 'master'
[glib.git] / gio / gpermission.h
blob0c2b0bdf5d97813333c74b6c3a116e6ba4413b8a
1 /*
2 * Copyright © 2010 Codethink Limited
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.
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.
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/>.
17 * Author: Ryan Lortie <desrt@desrt.ca>
20 #ifndef __G_PERMISSION_H__
21 #define __G_PERMISSION_H__
23 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
24 #error "Only <gio/gio.h> can be included directly."
25 #endif
27 #include <gio/giotypes.h>
29 G_BEGIN_DECLS
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))
43 typedef struct _GPermissionPrivate GPermissionPrivate;
44 typedef struct _GPermissionClass GPermissionClass;
46 struct _GPermission
48 GObject parent_instance;
50 /*< private >*/
51 GPermissionPrivate *priv;
54 struct _GPermissionClass {
55 GObjectClass parent_class;
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);
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);
79 gpointer reserved[16];
82 GLIB_AVAILABLE_IN_ALL
83 GType g_permission_get_type (void);
84 GLIB_AVAILABLE_IN_ALL
85 gboolean g_permission_acquire (GPermission *permission,
86 GCancellable *cancellable,
87 GError **error);
88 GLIB_AVAILABLE_IN_ALL
89 void g_permission_acquire_async (GPermission *permission,
90 GCancellable *cancellable,
91 GAsyncReadyCallback callback,
92 gpointer user_data);
93 GLIB_AVAILABLE_IN_ALL
94 gboolean g_permission_acquire_finish (GPermission *permission,
95 GAsyncResult *result,
96 GError **error);
98 GLIB_AVAILABLE_IN_ALL
99 gboolean g_permission_release (GPermission *permission,
100 GCancellable *cancellable,
101 GError **error);
102 GLIB_AVAILABLE_IN_ALL
103 void g_permission_release_async (GPermission *permission,
104 GCancellable *cancellable,
105 GAsyncReadyCallback callback,
106 gpointer user_data);
107 GLIB_AVAILABLE_IN_ALL
108 gboolean g_permission_release_finish (GPermission *permission,
109 GAsyncResult *result,
110 GError **error);
112 GLIB_AVAILABLE_IN_ALL
113 gboolean g_permission_get_allowed (GPermission *permission);
114 GLIB_AVAILABLE_IN_ALL
115 gboolean g_permission_get_can_acquire (GPermission *permission);
116 GLIB_AVAILABLE_IN_ALL
117 gboolean g_permission_get_can_release (GPermission *permission);
119 GLIB_AVAILABLE_IN_ALL
120 void g_permission_impl_update (GPermission *permission,
121 gboolean allowed,
122 gboolean can_acquire,
123 gboolean can_release);
125 G_END_DECLS
127 #endif /* __G_PERMISSION_H__ */