[gtk-vnc] Support GObject introspection & add javascript demo program
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] Support GObject introspection & add javascript demo program
- Date: Sun, 21 Mar 2010 14:10:04 +0000 (UTC)
commit 0057ffabff51acb1a799d38efff91324e582acbf
Author: Daniel P. Berrange <berrange redhat com>
Date: Sat Nov 21 18:58:19 2009 +0000
Support GObject introspection & add javascript demo program
Add Makefile.am rules to generate a typelib with introspection
data. Add a javascript demo program to show how trivial it is.
configure.ac | 26 +++++++++++++++++
examples/gvncviewer.js | 14 +++++++++
gtk-vnc.spec.in | 25 +++++++++++++++-
src/Makefile.am | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 137 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 84903b1..98d0444 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,7 @@ PYTHON_REQUIRED=2.4
FIREFOX_PLUGIN_REQUIRED=2.0.0
MOZILLA_PLUGIN_REQUIRED=1.8
+GOBJECT_INTROSPECTION_REQUIRED=0.6.2
dnl *******************************************************************************
dnl Setup GNULIB - must be before anything else in this file
@@ -302,6 +303,31 @@ AM_CONDITIONAL(WITH_EXAMPLES, [test "$WITH_EXAMPLES" = "yes"])
AM_CONDITIONAL(ENABLE_PLUGIN, [test "$enable_plugin" = "yes"])
+AC_ARG_ENABLE([introspection],
+ AS_HELP_STRING([--enable-introspection], [enable GObject introspection]),
+ [], [enable_introspection=check])
+
+if test "x$enable_introspection" != "xno" ; then
+ PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
+ [gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_REQUIRED],
+ [enable_introspection=yes],
+ [
+ if test "x$enable_introspection" = "xcheck"; then
+ enable_introspection=no
+ else
+ AC_MSG_ERROR([gobject-introspection is not available])
+ fi
+ ])
+ if test "x$enable_introspection" = "xyes" ; then
+ AC_DEFINE([WITH_GOBJECT_INTROSPECTION], [1], [enable GObject introspection support])
+ AC_SUBST(GOBJECT_INTROSPECTION_CFLAGS)
+ AC_SUBST(GOBJECT_INTROSPECTION_LIBS)
+ AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)])
+ AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)])
+ fi
+fi
+AM_CONDITIONAL([WITH_GOBJECT_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
+
AC_CONFIG_FILES(
Makefile
gnulib/lib/Makefile
diff --git a/examples/gvncviewer.js b/examples/gvncviewer.js
new file mode 100755
index 0000000..6870e93
--- /dev/null
+++ b/examples/gvncviewer.js
@@ -0,0 +1,14 @@
+#!/usr/bin/gjs
+
+const Vnc = imports.gi.GtkVnc;
+const Gtk = imports.gi.Gtk;
+
+Gtk.init(0, null);
+
+var win = new Gtk.Window({title: "GTK-VNC with JavaScript"});
+var disp = new Vnc.Display();
+
+win.add(disp);
+disp.open_host("localhost", "5900");
+win.show_all();
+Gtk.main();
\ No newline at end of file
diff --git a/gtk-vnc.spec.in b/gtk-vnc.spec.in
index ded3905..bac40a3 100644
--- a/gtk-vnc.spec.in
+++ b/gtk-vnc.spec.in
@@ -4,6 +4,12 @@
# a security audit at very least
%define with_plugin 0
+%define with_gir 0
+
+%if 0%{fedora} >= 12
+%define with_gir 1
+%endif
+
Summary: A GTK widget for VNC clients
Name: gtk-vnc
Version: @VERSION@
@@ -91,11 +97,19 @@ Libraries, includes, etc. to compile with the gvnc library
%setup -q
%build
+%if %{with_gir}
+%define gir_arg --enable-introspection=yes
+%else
+%define gir_arg --enable-introspection=no
+%endif
+
%if %{with_plugin}
-%configure --enable-plugin=yes
+%define plugin_arg --enable-plugin=yes
%else
-%configure
+%define plugin_arg --enable-plugin=no
%endif
+
+%configure %{plugin_arg} %{gir_arg}
%__make %{?_smp_mflags}
%install
@@ -122,6 +136,10 @@ rm -fr %{buildroot}
%defattr(-, root, root)
%doc AUTHORS ChangeLog NEWS README COPYING.LIB
%{_libdir}/libgtk-vnc-1.0.so.*
+%{_libdir}/lib*.so.*
+%if %{with_gir}
+%{_libdir}/girepository-1.0/GtkVnc-1.0.typelib
+%endif
%files devel
%defattr(-, root, root)
@@ -130,6 +148,9 @@ rm -fr %{buildroot}
%{_libdir}/libgtk-vnc-1.0.so
%{_includedir}/%{name}-1.0/*.h
%{_libdir}/pkgconfig/%{name}-1.0.pc
+%if %{with_gir}
+%{_datadir}/gir-1.0/GtkVnc-1.0.gir
+%endif
%files python
%defattr(-, root, root)
diff --git a/src/Makefile.am b/src/Makefile.am
index dce4255..645489a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -187,4 +187,78 @@ else
EXTRA_DIST += vnc.override vncmodule.c
endif
+if WITH_GOBJECT_INTROSPECTION
+
+GVNC_INTROSPECTION_SRCS = \
+ $(srcdir)/vncpixelformat.h \
+ $(srcdir)/vncframebuffer.h $(srcdir)/vncframebuffer.c \
+ $(srcdir)/vncbaseframebuffer.h $(srcdir)/vncbaseframebuffer.c \
+ $(srcdir)/vnccursor.h $(srcdir)/vnccursor.c \
+ $(srcdir)/vncconnection.h $(srcdir)/vncconnection.c \
+ $(builddir)/vncconnectionenums.h $(builddir)/vncconnectionenums.c
+
+GTK_VNC_INTROSPECTION_SRCS = \
+ $(srcdir)/vncimageframebuffer.h $(srcdir)/vncimageframebuffer.c \
+ $(srcdir)/vncdisplay.h $(srcdir)/vncdisplay.c \
+ $(builddir)/vncdisplayenums.h $(builddir)/vncdisplayenums.c
+
+GVnc-1.0.gir: libgvnc-1.0.la $(G_IR_SCANNER) Makefile.am
+ $(AM_V_GEN)$(G_IR_SCANNER) -v \
+ --namespace GVnc \
+ --nsversion 1.0 \
+ --include GObject-2.0 \
+ --strip-prefix=Vnc \
+ --library=$(builddir)/libgvnc-1.0.la \
+ --add-include-path=$(top_srcdir) \
+ --add-include-path=$(srcdir) \
+ --add-include-path=$(builddir) \
+ --output $@ \
+ -I$(top_srcdir) \
+ -I$(srcdir) \
+ --verbose \
+ --pkg=glib-2.0 \
+ --pkg=gthread-2.0 \
+ --pkg=gdk-pixbuf-2.0 \
+ --pkg=gobject-2.0 \
+ $(GVNC_INTROSPECTION_SRCS)
+
+GtkVnc-1.0.gir: libgtk-vnc-1.0.la $(G_IR_SCANNER) Makefile.am
+ $(AM_V_GEN)$(G_IR_SCANNER) -v \
+ --namespace GtkVnc \
+ --nsversion 1.0 \
+ --include GObject-2.0 \
+ --include Gtk-2.0 \
+ --include GVnc-1.0 \
+ --strip-prefix=Vnc \
+ --library=$(builddir)/libgtk-vnc-1.0.la \
+ --add-include-path=$(top_srcdir) \
+ --add-include-path=$(srcdir) \
+ --add-include-path=$(builddir) \
+ --output $@ \
+ -I$(top_srcdir) \
+ -I$(srcdir) \
+ --verbose \
+ --pkg=glib-2.0 \
+ --pkg=gthread-2.0 \
+ --pkg=gdk-pixbuf-2.0 \
+ --pkg=gobject-2.0 \
+ --pkg=gtk+-2.0 \
+ $(GTK_VNC_INTROSPECTION_SRCS)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = GVnc-1.0.gir GtkVnc-1.0.gir
+
+typelibsdir = $(libdir)/girepository-1.0
+typelibs_DATA = GVnc-1.0.typelib GtkVnc-1.0.typelib
+
+%.typelib: %.gir
+ $(AM_V_GEN)$(G_IR_COMPILER) \
+ --includedir=$(srcdir) \
+ --includedir=$(builddir) \
+ -o $@ $<
+
+CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+
+endif # WITH_GOBJECT_INTROSPECTION
+
-include $(top_srcdir)/git.mk
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]