summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-03-18 13:45:54 +0100
committerStef Walter <stefw@gnome.org>2012-03-18 15:42:08 +0100
commit65969cf82ef3082bff5d721a90cf60f61a3a36e3 (patch)
tree20a5766a37add7d07d292071ce6dba9db2dea0b1
parent966c1da87b150cc3935d878255c0e978ad3bee6c (diff)
downloadlibsecret-65969cf82ef3082bff5d721a90cf60f61a3a36e3.tar.gz
WIP schemas
-rw-r--r--library/secret-schema.c36
-rw-r--r--library/secret-schema.h11
-rw-r--r--library/secret-schemas.c31
-rw-r--r--library/secret-schemas.h35
4 files changed, 67 insertions, 46 deletions
diff --git a/library/secret-schema.c b/library/secret-schema.c
index d95b715..68cc7a4 100644
--- a/library/secret-schema.c
+++ b/library/secret-schema.c
@@ -83,42 +83,6 @@
* to store integer and boolean values as strings.
*/
-static const SecretSchema network_schema = {
- SECRET_SCHEMA_IDENTIFIER_NETWORK,
- SECRET_SCHEMA_NONE,
- {
- { "user", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "domain", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "object", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "port", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
- { "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
- { "NULL", 0 },
- }
-};
-
-const SecretSchema * SECRET_SCHEMA_NETWORK = &network_schema;
-
-static const SecretSchema generic_schema = {
- SECRET_SCHEMA_IDENTIFIER_GENERIC,
- SECRET_SCHEMA_ALLOW_UNDEFINED,
- {
- { "NULL", 0 },
- }
-};
-
-const SecretSchema * SECRET_SCHEMA_GENERIC = &generic_schema;
-
-static const SecretSchema note_schema = {
- SECRET_SCHEMA_IDENTIFIER_NOTE,
- SECRET_SCHEMA_ALLOW_UNDEFINED,
- {
- { "NULL", 0 },
- }
-};
-
-const SecretSchema * SECRET_SCHEMA_NOTE = &note_schema;
-
static SecretSchemaAttribute *
schema_attribute_copy (SecretSchemaAttribute *attribute)
{
diff --git a/library/secret-schema.h b/library/secret-schema.h
index 1473d69..3bf7ab4 100644
--- a/library/secret-schema.h
+++ b/library/secret-schema.h
@@ -21,10 +21,6 @@
G_BEGIN_DECLS
-#define SECRET_SCHEMA_IDENTIFIER_GENERIC "org.freedesktop.Secret.Generic"
-#define SECRET_SCHEMA_IDENTIFIER_NETWORK "org.gnome.keyring.NetworkPassword"
-#define SECRET_SCHEMA_IDENTIFIER_NOTE "org.gnome.keyring.Note"
-
typedef enum {
SECRET_SCHEMA_ATTRIBUTE_STRING = 0,
SECRET_SCHEMA_ATTRIBUTE_INTEGER = 1,
@@ -39,6 +35,7 @@ typedef struct {
typedef enum {
SECRET_SCHEMA_NONE = 0,
SECRET_SCHEMA_ALLOW_UNDEFINED = 1 << 0,
+ SECRET_SCHEMA_IGNORE_IDENTIFIER = 1 << 1
} SecretSchemaFlags;
typedef struct {
@@ -57,12 +54,6 @@ typedef struct {
gpointer reserved7;
} SecretSchema;
-extern const SecretSchema * SECRET_SCHEMA_NETWORK;
-
-extern const SecretSchema * SECRET_SCHEMA_GENERIC;
-
-extern const SecretSchema * SECRET_SCHEMA_NOTE;
-
GType secret_schema_get_type (void) G_GNUC_CONST;
SecretSchema * secret_schema_new (const gchar *identifier,
diff --git a/library/secret-schemas.c b/library/secret-schemas.c
new file mode 100644
index 0000000..ad6056b
--- /dev/null
+++ b/library/secret-schemas.c
@@ -0,0 +1,31 @@
+/* libsecret - GLib wrapper for Secret Service
+ *
+ * Copyright 2012 Stef Walter
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * See the included COPYING file for more information.
+ */
+
+#include "config.h"
+
+#include "secret-schema.h"
+
+static const SecretSchema network_schema = {
+ "org.gnome.keyring.NetworkPassword",
+ SECRET_SCHEMA_NONE,
+ {
+ { "user", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "domain", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "object", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "protocol", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "port", SECRET_SCHEMA_ATTRIBUTE_INTEGER },
+ { "server", SECRET_SCHEMA_ATTRIBUTE_STRING },
+ { "NULL", 0 },
+ }
+};
+
+const SecretSchema * SECRET_SCHEMA_COMPAT_NETWORK = &network_schema;
diff --git a/library/secret-schemas.h b/library/secret-schemas.h
new file mode 100644
index 0000000..2eb55fc
--- /dev/null
+++ b/library/secret-schemas.h
@@ -0,0 +1,35 @@
+/* libsecret - GLib wrapper for Secret Service
+ *
+ * Copyright 2012 Stef Walter
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * See the included COPYING file for more information.
+ */
+
+#if !defined (__SECRET_INSIDE_HEADER__) && !defined (SECRET_COMPILATION)
+#error "Only <secret/secret.h> can be included directly."
+#endif
+
+#ifndef __SECRET_SCHEMAS_H__
+#define __SECRET_SCHEMAS_H__
+
+#include <glib.h>
+
+#include "secret-schema.h"
+
+G_BEGIN_DECLS
+
+/*
+ * This schema is here for compatibility with libgnome-keyring's network
+ * password functions.
+ */
+
+extern const SecretSchema * SECRET_SCHEMA_COMPAT_NETWORK;
+
+G_END_DECLS
+
+#endif /* __SECRET_SCHEMAS_H___ */