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."
27 #include <gio/giotypes.h>
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), \
38 #define G_IS_PERMISSION_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
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
;
48 GObject parent_instance
;
51 GPermissionPrivate
*priv
;
54 struct _GPermissionClass
{
55 GObjectClass parent_class
;
57 gboolean (*acquire
) (GPermission
*permission
,
58 GCancellable
*cancellable
,
60 void (*acquire_async
) (GPermission
*permission
,
61 GCancellable
*cancellable
,
62 GAsyncReadyCallback callback
,
64 gboolean (*acquire_finish
) (GPermission
*permission
,
68 gboolean (*release
) (GPermission
*permission
,
69 GCancellable
*cancellable
,
71 void (*release_async
) (GPermission
*permission
,
72 GCancellable
*cancellable
,
73 GAsyncReadyCallback callback
,
75 gboolean (*release_finish
) (GPermission
*permission
,
79 gpointer reserved
[16];
83 GType
g_permission_get_type (void);
85 gboolean
g_permission_acquire (GPermission
*permission
,
86 GCancellable
*cancellable
,
89 void g_permission_acquire_async (GPermission
*permission
,
90 GCancellable
*cancellable
,
91 GAsyncReadyCallback callback
,
94 gboolean
g_permission_acquire_finish (GPermission
*permission
,
99 gboolean
g_permission_release (GPermission
*permission
,
100 GCancellable
*cancellable
,
102 GLIB_AVAILABLE_IN_ALL
103 void g_permission_release_async (GPermission
*permission
,
104 GCancellable
*cancellable
,
105 GAsyncReadyCallback callback
,
107 GLIB_AVAILABLE_IN_ALL
108 gboolean
g_permission_release_finish (GPermission
*permission
,
109 GAsyncResult
*result
,
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
,
122 gboolean can_acquire
,
123 gboolean can_release
);
127 #endif /* __G_PERMISSION_H__ */