| 1 |
/* |
| 2 |
* gnome-keyring |
| 3 |
* |
| 4 |
* Copyright (C) 2008 Stefan Walter |
| 5 |
* |
| 6 |
* This program is free software; you can redistribute it and/or modify |
| 7 |
* it under the terms of the GNU Lesser General Public License as |
| 8 |
* published by the Free Software Foundation; either version 2.1 of |
| 9 |
* the License, or (at your option) any later version. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, but |
| 12 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
* Lesser General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU Lesser General Public |
| 17 |
* License along with this program; if not, see |
| 18 |
* <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef __GKM_GNOME2_FILE_H__ |
| 22 |
#define __GKM_GNOME2_FILE_H__ |
| 23 |
|
| 24 |
#include <glib-object.h> |
| 25 |
|
| 26 |
#include "gkm/gkm-data-types.h" |
| 27 |
#include "gkm/gkm-secret.h" |
| 28 |
|
| 29 |
enum { |
| 30 |
GKM_GNOME2_FILE_SECTION_PUBLIC = 0x01, |
| 31 |
GKM_GNOME2_FILE_SECTION_PRIVATE = 0x02, |
| 32 |
}; |
| 33 |
|
| 34 |
#define GKM_TYPE_GNOME2_FILE (gkm_gnome2_file_get_type ()) |
| 35 |
#define GKM_GNOME2_FILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKM_TYPE_GNOME2_FILE, GkmGnome2File)) |
| 36 |
#define GKM_GNOME2_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GKM_TYPE_GNOME2_FILE, GkmGnome2FileClass)) |
| 37 |
#define GKM_IS_GNOME2_FILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKM_TYPE_GNOME2_FILE)) |
| 38 |
#define GKM_IS_GNOME2_FILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GKM_TYPE_GNOME2_FILE)) |
| 39 |
#define GKM_GNOME2_FILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKM_TYPE_GNOME2_FILE, GkmGnome2FileClass)) |
| 40 |
|
| 41 |
typedef struct _GkmGnome2File GkmGnome2File; |
| 42 |
typedef struct _GkmGnome2FileClass GkmGnome2FileClass; |
| 43 |
|
| 44 |
struct _GkmGnome2FileClass { |
| 45 |
GObjectClass parent_class; |
| 46 |
|
| 47 |
/* signals */ |
| 48 |
|
| 49 |
void (*entry_added) (GkmGnome2File *store, const gchar *identifier); |
| 50 |
|
| 51 |
void (*entry_changed) (GkmGnome2File *store, const gchar *identifier, CK_ATTRIBUTE_TYPE type); |
| 52 |
|
| 53 |
void (*entry_removed) (GkmGnome2File *store, const gchar *identifier); |
| 54 |
}; |
| 55 |
|
| 56 |
typedef void (*GkmGnome2FileFunc) (GkmGnome2File *file, const gchar *identifier, gpointer user_data); |
| 57 |
|
| 58 |
GType gkm_gnome2_file_get_type (void); |
| 59 |
|
| 60 |
GkmGnome2File* gkm_gnome2_file_new (void); |
| 61 |
|
| 62 |
GkmDataResult gkm_gnome2_file_read_fd (GkmGnome2File *self, |
| 63 |
int fd, |
| 64 |
GkmSecret *login); |
| 65 |
|
| 66 |
GkmDataResult gkm_gnome2_file_write_fd (GkmGnome2File *self, |
| 67 |
int fd, |
| 68 |
GkmSecret *login); |
| 69 |
|
| 70 |
gboolean gkm_gnome2_file_have_section (GkmGnome2File *self, |
| 71 |
guint section); |
| 72 |
|
| 73 |
gboolean gkm_gnome2_file_lookup_entry (GkmGnome2File *self, |
| 74 |
const gchar *identifier, |
| 75 |
guint *section); |
| 76 |
|
| 77 |
void gkm_gnome2_file_foreach_entry (GkmGnome2File *self, |
| 78 |
GkmGnome2FileFunc func, |
| 79 |
gpointer user_data); |
| 80 |
|
| 81 |
GkmDataResult gkm_gnome2_file_unique_entry (GkmGnome2File *self, |
| 82 |
gchar **identifier); |
| 83 |
|
| 84 |
GkmDataResult gkm_gnome2_file_create_entry (GkmGnome2File *self, |
| 85 |
const gchar *identifier, |
| 86 |
guint section); |
| 87 |
|
| 88 |
GkmDataResult gkm_gnome2_file_destroy_entry (GkmGnome2File *self, |
| 89 |
const gchar *identifier); |
| 90 |
|
| 91 |
GkmDataResult gkm_gnome2_file_write_value (GkmGnome2File *self, |
| 92 |
const gchar *identifier, |
| 93 |
gulong type, |
| 94 |
gconstpointer value, |
| 95 |
gsize n_value); |
| 96 |
|
| 97 |
GkmDataResult gkm_gnome2_file_read_value (GkmGnome2File *self, |
| 98 |
const gchar *identifier, |
| 99 |
gulong type, |
| 100 |
gconstpointer *value, |
| 101 |
gsize *n_value); |
| 102 |
|
| 103 |
void gkm_gnome2_file_foreach_value (GkmGnome2File *self, |
| 104 |
const gchar *identifier); |
| 105 |
|
| 106 |
void gkm_gnome2_file_dump (GkmGnome2File *self); |
| 107 |
|
| 108 |
#endif /* __GKM_GNOME2_FILE_H__ */ |