[libgnome-keyring] Add Vala bindings.



commit ea1476c1a941d71d6d7be90aa6fc5b8ba8da7c83
Author: Evan Nemerson <evan coeus-group com>
Date:   Thu Jun 28 11:20:04 2012 -0700

    Add Vala bindings.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678440

 .gitignore                           |    1 +
 build/m4/vapigen.m4                  |   88 ++++++++++++++++++++++++++++++++++
 configure.ac                         |    4 ++
 library/GnomeKeyring-1.0-custom.vala |   24 +++++++++
 library/GnomeKeyring-1.0.metadata    |   63 ++++++++++++++++++++++++
 library/Makefile.am                  |   19 +++++++-
 6 files changed, 198 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index dd96864..106a11a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,7 @@ run-auto-test.h
 /library/Makefile.in
 /library/*.gir
 /library/*.typelib
+/library/*.vapi
 
 # /library/tests
 /library/tests/Makefile
diff --git a/build/m4/vapigen.m4 b/build/m4/vapigen.m4
new file mode 100644
index 0000000..4805107
--- /dev/null
+++ b/build/m4/vapigen.m4
@@ -0,0 +1,88 @@
+dnl vala.m4
+dnl
+dnl Copyright 2012 Evan Nemerson
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of the GNU Lesser General Public
+dnl License as published by the Free Software Foundation; either
+dnl version 2.1 of the License, or (at your option) any later version.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+
+# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION])
+# --------------------------------------
+# Check that vapigen existence and version
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+AC_DEFUN([VAPIGEN_CHECK],
+[
+  AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0])
+  AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0])
+
+  AC_ARG_ENABLE([vala],
+    AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],
+      [build Vala bindings [[default=auto]]]),,
+      [enable_vala=auto])
+
+  AS_CASE([$enable_vala], [no], [],
+      [yes], [
+        AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
+            AC_MSG_ERROR([Vala bindings require GObject Introspection])
+          ])
+      ], [auto], [
+        AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
+            enable_vala=no
+          ])
+      ], [
+        AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@])
+      ])
+
+  AS_IF([test "x$2" = "x"], [
+      vapigen_pkg_name=vapigen
+    ], [
+      vapigen_pkg_name=vapigen-$2
+    ])
+  AS_IF([test "x$1" = "x"], [
+      vapigen_pkg="$vapigen_pkg_name"
+    ], [
+      vapigen_pkg="$vapigen_pkg_name >= $1"
+    ])
+
+  PKG_PROG_PKG_CONFIG
+
+  PKG_CHECK_EXISTS([$vapigen_pkg], [
+      AS_IF([test "$enable_vala" = "auto"], [
+          enable_vala=yes
+        ])
+    ], [
+      AS_CASE([$enable_vala], [yes], [
+          AC_MSG_ERROR([$vapigen_pkg not found])
+        ], [auto], [
+          enable_vala=no
+        ])
+    ])
+
+  AS_CASE([$enable_vala],
+    [yes], [
+      VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen`
+      VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen
+      AS_IF([test "x$2" = "x"], [
+          VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
+        ], [
+          VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen`
+        ])
+    ])
+
+  AC_SUBST([VAPIGEN])
+  AC_SUBST([VAPIGEN_VAPIDIR])
+  AC_SUBST([VAPIGEN_MAKEFILE])
+
+  AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
+])
diff --git a/configure.ac b/configure.ac
index fbd958f..fbadd6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,6 +53,9 @@ AM_GLIB_GNU_GETTEXT
 # Introspection
 GOBJECT_INTROSPECTION_CHECK([1.30.0])
 
+# Vala bindings
+VAPIGEN_CHECK([0.16])
+
 # --------------------------------------------------------------------
 # Check for various credentials.
 #
@@ -243,6 +246,7 @@ echo "CFLAGS: $CFLAGS"
 echo
 echo "OPTIONS:"
 echo "  Introspection:        $found_introspection"
+echo "  Vala:                 $enable_vala"
 echo "  Debug Build:          $debug_status"
 echo "  Strict Build:         $strict_status"
 echo
diff --git a/library/GnomeKeyring-1.0-custom.vala b/library/GnomeKeyring-1.0-custom.vala
new file mode 100644
index 0000000..4aebc8f
--- /dev/null
+++ b/library/GnomeKeyring-1.0-custom.vala
@@ -0,0 +1,24 @@
+namespace GnomeKeyring {
+	[Compact]
+	public class AttributeList : GLib.Array<GnomeKeyring.Attribute> {
+		[CCode (array_length_cname = "len", array_length_type = "guint")]
+		public GnomeKeyring.Attribute[] data;
+		public void append_string (string name, string value);
+		public void append_uint32 (string name, uint32 value);
+		public GnomeKeyring.AttributeList copy ();
+		public AttributeList ();
+	}
+
+	[CCode (cheader_filename = "gnome-keyring.h", free_function = "gnome_keyring_network_password_free")]
+	[Compact]
+	public class NetworkPasswordData { }
+
+	[CCode (cheader_filename = "gnome-keyring.h")]
+	public delegate void OperationGetListCallback<T> (GnomeKeyring.Result result, GLib.List<T> list);
+	[CCode (cheader_filename = "gnome-keyring.h")]
+	public static GnomeKeyring.PasswordSchema NETWORK_PASSWORD;
+	[CCode (cheader_filename = "gnome-keyring.h")]
+	public const string DEFAULT;
+	[CCode (cheader_filename = "gnome-keyring.h")]
+	public static unowned string result_to_message (GnomeKeyring.Result res);
+}
\ No newline at end of file
diff --git a/library/GnomeKeyring-1.0.metadata b/library/GnomeKeyring-1.0.metadata
new file mode 100644
index 0000000..04662fb
--- /dev/null
+++ b/library/GnomeKeyring-1.0.metadata
@@ -0,0 +1,63 @@
+// Metadata file for Vala API generation.
+// See https://live.gnome.org/Vala/UpstreamGuide for more information
+
+Attribute struct=false
+Info
+  .get_ctime type="time_t"
+  .get_mtime type="time_t"
+ItemInfo
+  .get_ctime type="time_t"
+  .get_mtime type="time_t"
+NetworkPasswordData struct=false
+  .keyring unowned=false
+  .protocol unowned=false
+  .server unowned=false
+  .object unowned=false
+  .authtype unowned=false
+  .user unowned=false
+  .domain unowned=false
+  .password unowned=false
+PasswordSchema struct=false
+
+change_password skip=false
+create skip=false
+ delete skip=false
+delete_password skip=false
+delete_password_sync skip=false
+find_items skip=false
+find_itemsv skip=false
+find_itemsv_sync skip=false
+find_network_password skip=false
+find_password skip=false
+find_password_sync skip=false
+get_default_keyring skip=false
+get_info skip=false
+item_create skip=false
+item_delete skip=false
+item_get_acl skip=false
+item_get_attributes skip=false
+item_get_attributes_sync skip=false
+item_get_info skip=false
+item_get_info_full skip=false
+item_get_info_full_sync skip=false
+item_get_info_sync skip=false
+item_grant_access_rights skip=false
+item_set_acl skip=false
+item_set_attributes skip=false
+item_set_info skip=false
+list_item_ids skip=false
+list_keyring_names skip=false
+ lock skip=false
+lock_all skip=false
+memory_* skip=false
+set_info skip=false
+set_network_password skip=false
+store_password skip=false
+store_password_sync skip=false
+unlock skip=false
+
+find_items*.callback type_arguments="GnomeKeyring.Found"
+find_network_password*.callback type_arguments="GnomeKeyring.NetworkPasswordData"
+item_get_acl*.callback type_arguments="GnomeKeyring.AccessControl"
+list_item_ids*.callback type_arguments="uint"
+list_keyring_names*.callback type_arguments="string"
diff --git a/library/Makefile.am b/library/Makefile.am
index 1d06e7b..e2e4c6e 100644
--- a/library/Makefile.am
+++ b/library/Makefile.am
@@ -55,7 +55,9 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gnome-keyring-1.pc
 
 EXTRA_DIST = \
-	gnome-keyring-1-uninstalled.pc.in
+	gnome-keyring-1-uninstalled.pc.in \
+	GnomeKeyring-1.0.metadata \
+	GnomeKeyring-1.0-custom.vala
 
 CLEANFILES=
 
@@ -82,6 +84,21 @@ typelibdir = $(libdir)/girepository-1.0
 typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
 
 CLEANFILES += $(gir_DATA) $(typelib_DATA)
+
+if ENABLE_VAPIGEN
+-include $(VAPIGEN_MAKEFILE)
+
+gnome-keyring-1.vapi: GnomeKeyring-1.0.gir GnomeKeyring-1.0.metadata GnomeKeyring-1.0-custom.vala
+
+VAPIGEN_VAPIS = gnome-keyring-1.vapi
+CLEANFILES += $(VAPIGEN_VAPIS)
+
+gnome_keyring_1_vapi_METADATADIRS = $(srcdir)
+gnome_keyring_1_vapi_FILES = GnomeKeyring-1.0.gir $(srcdir)/GnomeKeyring-1.0-custom.vala
+
+vapidir = $(VAPIGEN_VAPIDIR)
+vapi_DATA = $(VAPIGEN_VAPIS)
+endif
 endif
 
 SUBDIRS = . tests



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]