[gedit] Add Vala bindings.



commit e16b196c32cd288bc186abff19e5a23af5f83422
Author: Evan Nemerson <evan coeus-group com>
Date:   Sun Feb 16 12:41:56 2014 -0800

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

 configure.ac             |    4 ++
 gedit/Gedit-3.0.metadata |   37 +++++++++++++++++
 gedit/Makefile.am        |   24 +++++++++++
 m4/vapigen.m4            |  101 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 166 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a93b07c..361f22d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -435,6 +435,9 @@ else
        enable_introspection=no
 fi
 
+# Vala
+VAPIGEN_CHECK
+
 AC_CONFIG_FILES([
 Makefile
 data/gedit.desktop.in
@@ -468,6 +471,7 @@ Configuration:
        GDK Backend:            $gdk_windowing
        Zeitgeist support:      $enable_zeitgeist
        Python support:         $enable_python
+       Vala support:           $enable_vala
 "
 
 if expr ${GEDIT_MINOR_VERSION} % 2 > /dev/null; then
diff --git a/gedit/Gedit-3.0.metadata b/gedit/Gedit-3.0.metadata
new file mode 100644
index 0000000..7042cc7
--- /dev/null
+++ b/gedit/Gedit-3.0.metadata
@@ -0,0 +1,37 @@
+App cheader_filename="gedit/gedit-app.h"
+AppActivatable cheader_filename="gedit/gedit-app-activatable.h"
+LockdownMask cheader_filename="gedit/gedit-app.h"
+DebugSection cheader_filename="gedit/gedit-debug.h"
+Document cheader_filename="gedit/gedit-document.h"
+DocumentCompressionType cheader_filename="gedit/gedit-document.h"
+DocumentNewlineType cheader_filename="gedit/gedit-document.h"
+DocumentSaveFlags cheader_filename="gedit/gedit-document.h"
+Encoding  cheader_filename="gedit/gedit-encodings.h"
+EncodingsComboBox cheader_filename="gedit/gedit-encodings-combo-box.h"
+MenuExtension cheader_filename="gedit/gedit-menu-extension.h"
+Message cheader_filename="gedit/gedit-message.h"
+MessageBus cheader_filename="gedit/gedit-message-bus.h"
+NotebookShowTabsModeType cheader_filename="gedit/gedit-notebook.h"
+ProgressInfoBar cheader_filename="gedit/gedit-progress-info-bar.h"
+Statusbar cheader_filename="gedit/gedit-statusbar.h"
+Tab cheader_filename="gedit/gedit-tab.h"
+TabState cheader_filename="gedit/gedit-tab.h"
+View cheader_filename="gedit/gedit-view.h"
+ViewActivatable cheader_filename="gedit/gedit-view-activatable.h"
+Window cheader_filename="gedit/gedit-window.h"
+WindowActivatable cheader_filename="gedit/gedit-window-activatable.h"
+WindowState cheader_filename="gedit/gedit-window.h"
+
+Document.load#signal skip // https://bugzilla.gnome.org/show_bug.cgi?id=662145
+Document.save#method name="do_save"
+
+commands_* cheader_filename="gedit/gedit-commands.h"
+debug* cheader_filename="gedit/gedit-debug.h"
+marshal_* cheader_filename="gedit/gedit-marshal.h"
+utils_* cheader_filename="gedit/gedit-utils.h"
+
+LOCKDOWN_ALL cheader_filename="gedit/gedit-app.h"
+METADATA_* cheader_filename="gedit/gedit-document.h"
+
+MessageBusForeach cheader_filename="gedit/gedit-message-bus.h"
+MessageCallback cheader_filename="gedit/gedit-message-bus.h"
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 61f43be..997e254 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -263,6 +263,7 @@ EXTRA_DIST +=                                       \
        gedit/gedit-enum-types.c.template       \
        gedit/gedit-marshal.list                \
        gedit/gedit.rc                          \
+       gedit/Gedit-3.0.metadata                \
        $(gedit_resource_deps)
 
 if HAVE_INTROSPECTION
@@ -276,6 +277,8 @@ gedit_Gedit_3_0_gir_NAMESPACE = Gedit
 gedit_Gedit_3_0_gir_VERSION = 3.0
 gedit_Gedit_3_0_gir_PROGRAM = $(builddir)/gedit/gedit
 gedit_Gedit_3_0_gir_INCLUDES = Gtk-3.0 GtkSource-3.0
+gedit_Gedit_3_0_gir_EXPORT_PACKAGES = gedit
+gedit_Gedit_3_0_gir_SCANNERFLAGS = $(foreach header,$(gedit_INST_H_FILES),--c-include="$(header)")
 gedit_Gedit_3_0_gir_FILES =            \
        $(gedit_INST_H_FILES)           \
        $(gedit_libgedit_c_files)       \
@@ -292,6 +295,27 @@ CLEANFILES +=                      \
        $(gedit_typelib_DATA)
 endif
 
+if ENABLE_VAPIGEN
+include $(VAPIGEN_MAKEFILE)
+
+gedit/gedit.vapi: gedit/Gedit-3.0.gir
+
+VAPIGEN_VAPIS = gedit/gedit.vapi
+
+gedit_gedit_vapi_DEPS = atk gdk-3.0 gio-2.0 gtk+-3.0 gtksourceview-3.0
+gedit_gedit_vapi_METADATADIRS = $(top_srcdir)/gedit
+gedit_gedit_vapi_FILES = gedit/Gedit-3.0.gir
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = $(VAPIGEN_VAPIS) gedit/gedit.deps
+
+gedit/gedit.deps:
+       $(AM_V_GEN) echo $(gedit_gedit_vapi_DEPS) | tr ' ' '\n' > $@
+
+CLEANFILES += $(VAPIGEN_VAPIS) gedit/gedit.deps gedit/gedit.deps
+
+endif # ENABLE_VAPIGEN
+
 install-exec-hook:
 if PLATFORM_WIN32
        $(mkinstalldirs) "$(DESTDIR)$(libdir)"
diff --git a/m4/vapigen.m4 b/m4/vapigen.m4
new file mode 100644
index 0000000..2c435e7
--- /dev/null
+++ b/m4/vapigen.m4
@@ -0,0 +1,101 @@
+dnl vapigen.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], [DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+AC_DEFUN([VAPIGEN_CHECK],
+[
+  AS_IF([test "x$3" != "xyes"], [
+      m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [
+          m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [
+              AC_MSG_ERROR([[You must call GOBJECT_INTROSPECTION_CHECK or GOBJECT_INTROSPECTION_REQUIRE 
before using VAPIGEN_CHECK unless using the FOUND_INTROSPECTION argument is "yes"]])
+            ])
+        ])
+    ])
+
+  AC_ARG_ENABLE([vala],
+    [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala bindings 
@<:@default=]ifelse($4,,auto,$4)[@:>@])],,[
+      AS_IF([test "x$4" = "x"], [
+          enable_vala=auto
+        ], [
+          enable_vala=$4
+        ])
+    ])
+
+  AS_CASE([$enable_vala], [no], [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
+        ])
+    ])
+
+  AC_MSG_CHECKING([for vapigen])
+
+  AS_CASE([$enable_vala],
+    [yes], [
+      VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name`
+      VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir $vapigen_pkg_name`/vala/Makefile.vapigen
+      AS_IF([test "x$2" = "x"], [
+          VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir $vapigen_pkg_name`
+        ], [
+          VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned $vapigen_pkg_name`
+        ])
+    ])
+
+  AC_MSG_RESULT([$enable_vala])
+
+  AC_SUBST([VAPIGEN])
+  AC_SUBST([VAPIGEN_VAPIDIR])
+  AC_SUBST([VAPIGEN_MAKEFILE])
+
+  AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
+])


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