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 of the licence, 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, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Author: Ryan Lortie <desrt@desrt.ca>
24 #include "gsimplepermission.h"
25 #include "gpermission.h"
30 * SECTION:gsimplepermission
31 * @title: GSimplePermission
32 * @short_description: a GPermission that doesn't change value
34 * #GSimplePermission is a trivial implementation of #GPermission that
35 * represents a permission that is either always or never allowed. The
36 * value is given at constuction and doesn't change.
38 * Calling request or release will result in errors.
44 * #GSimplePermission is an opaque data structure. There are no methods
45 * except for those defined by #GPermission.
48 typedef GPermissionClass GSimplePermissionClass;
50 struct _GSimplePermission
52 GPermission parent_instance;
55 G_DEFINE_TYPE (GSimplePermission, g_simple_permission, G_TYPE_PERMISSION)
58 g_simple_permission_init (GSimplePermission *simple)
63 g_simple_permission_class_init (GSimplePermissionClass *class)
68 * g_simple_permission_new:
69 * @allowed: %TRUE if the action is allowed
70 * @returns: the #GSimplePermission, as a #GPermission
72 * Creates a new #GPermission instance that represents an action that is
73 * either always or never allowed.
78 g_simple_permission_new (gboolean allowed)
80 GPermission *permission = g_object_new (G_TYPE_SIMPLE_PERMISSION, NULL);
82 g_permission_impl_update (permission, allowed, FALSE, FALSE);
87 #define __G_SIMPLE_PERMISSION_C__
88 #include "gioaliasdef.c"