| 1 |
/* |
| 2 |
* Copyright (C) 2008 Red Hat, Inc. |
| 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 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 |
| 15 |
* Public 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. |
| 18 |
* |
| 19 |
* Author: David Zeuthen <[email protected]> |
| 20 |
*/ |
| 21 |
|
| 22 |
#if !defined (_POLKIT_COMPILATION) && !defined(_POLKIT_INSIDE_POLKIT_H) |
| 23 |
#error "Only <polkit/polkit.h> can be included directly, this file may disappear or change contents." |
| 24 |
#endif |
| 25 |
|
| 26 |
#ifndef __POLKIT_SUBJECT_H |
| 27 |
#define __POLKIT_SUBJECT_H |
| 28 |
|
| 29 |
#include <glib-object.h> |
| 30 |
#include <gio/gio.h> |
| 31 |
#include <polkit/polkittypes.h> |
| 32 |
|
| 33 |
G_BEGIN_DECLS |
| 34 |
|
| 35 |
#define POLKIT_TYPE_SUBJECT (polkit_subject_get_type()) |
| 36 |
#define POLKIT_SUBJECT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_SUBJECT, PolkitSubject)) |
| 37 |
#define POLKIT_IS_SUBJECT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_SUBJECT)) |
| 38 |
#define POLKIT_SUBJECT_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), POLKIT_TYPE_SUBJECT, PolkitSubjectIface)) |
| 39 |
|
| 40 |
#if 0 |
| 41 |
/** |
| 42 |
* PolkitSubject: |
| 43 |
* |
| 44 |
* Generic type for all objects that can be used as subjects. |
| 45 |
*/ |
| 46 |
typedef struct _PolkitSubject PolkitSubject; /* Dummy typedef */ |
| 47 |
#endif |
| 48 |
typedef struct _PolkitSubjectIface PolkitSubjectIface; |
| 49 |
|
| 50 |
/** |
| 51 |
* PolkitSubjectIface: |
| 52 |
* @parent_iface: The parent interface. |
| 53 |
* @hash: Gets a hash value for a #PolkitSubject. |
| 54 |
* @equal: Checks if two #PolkitSubject<!-- -->s are equal. |
| 55 |
* @to_string: Serializes a #PolkitSubject to a string that can be |
| 56 |
* used in polkit_subject_from_string(). |
| 57 |
* @exists: Asynchronously check if a #PolkitSubject exists. |
| 58 |
* @exists_finish: Finishes checking if a #PolkitSubject exists. |
| 59 |
* @exists_sync: Synchronously check if a #PolkitSubject exists. |
| 60 |
* |
| 61 |
* An interface for subjects. |
| 62 |
*/ |
| 63 |
struct _PolkitSubjectIface |
| 64 |
{ |
| 65 |
GTypeInterface parent_iface; |
| 66 |
|
| 67 |
guint (*hash) (PolkitSubject *subject); |
| 68 |
|
| 69 |
gboolean (*equal) (PolkitSubject *a, |
| 70 |
PolkitSubject *b); |
| 71 |
|
| 72 |
gchar * (*to_string) (PolkitSubject *subject); |
| 73 |
|
| 74 |
void (*exists) (PolkitSubject *subject, |
| 75 |
GCancellable *cancellable, |
| 76 |
GAsyncReadyCallback callback, |
| 77 |
gpointer user_data); |
| 78 |
|
| 79 |
gboolean (*exists_finish) (PolkitSubject *subject, |
| 80 |
GAsyncResult *res, |
| 81 |
GError **error); |
| 82 |
|
| 83 |
gboolean (*exists_sync) (PolkitSubject *subject, |
| 84 |
GCancellable *cancellable, |
| 85 |
GError **error); |
| 86 |
}; |
| 87 |
|
| 88 |
GType polkit_subject_get_type (void) G_GNUC_CONST; |
| 89 |
guint polkit_subject_hash (PolkitSubject *subject); |
| 90 |
gboolean polkit_subject_equal (PolkitSubject *a, |
| 91 |
PolkitSubject *b); |
| 92 |
gchar *polkit_subject_to_string (PolkitSubject *subject); |
| 93 |
PolkitSubject *polkit_subject_from_string (const gchar *str, |
| 94 |
GError **error); |
| 95 |
void polkit_subject_exists (PolkitSubject *subject, |
| 96 |
GCancellable *cancellable, |
| 97 |
GAsyncReadyCallback callback, |
| 98 |
gpointer user_data); |
| 99 |
gboolean polkit_subject_exists_finish (PolkitSubject *subject, |
| 100 |
GAsyncResult *res, |
| 101 |
GError **error); |
| 102 |
gboolean polkit_subject_exists_sync (PolkitSubject *subject, |
| 103 |
GCancellable *cancellable, |
| 104 |
GError **error); |
| 105 |
|
| 106 |
G_END_DECLS |
| 107 |
|
| 108 |
#endif /* __POLKIT_SUBJECT_H */ |