[PolicyKit-gnome] Add GObject Introspection for libpolkit-gtk-1



commit e988434ee6400e4549cb773492599323dbd7342f
Author: David Zeuthen <davidz redhat com>
Date:   Sun Sep 13 15:33:23 2009 -0400

    Add GObject Introspection for libpolkit-gtk-1

 configure.ac              |   21 +++++++++++++++++++++
 polkitgtk/Makefile.am     |   31 +++++++++++++++++++++++++++++++
 polkitgtk/example-seed.js |   28 ++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5e968e7..767d5b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,6 +144,26 @@ AC_ARG_ENABLE([examples],
 
 AM_CONDITIONAL(BUILD_EXAMPLES, test "x$enable_examples" = "xyes")
 
+# GObject introspection
+#
+AC_ARG_ENABLE([introspection],
+	AS_HELP_STRING([--enable-introspection], [enable GObject introspection]),
+	[], [enable_introspection=yes])
+if test "x$enable_introspection" = xyes; then
+	PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2])
+	AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support])
+	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)])
+	AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)])
+	#AC_SUBST([GIRDIR], [$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)])
+	#AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)])
+        GIRDIR=${datadir}/gir-1.0
+        GIRTYPELIBDIR=${libdir}/girepository-1.0
+        AC_SUBST(GIRDIR)
+        AC_SUBST(GIRTYPELIBDIR)
+fi
+AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes])
+
 # ********************
 # Internationalisation
 # ********************
@@ -191,6 +211,7 @@ echo "
         compiler:                   ${CC}
         cflags:                     ${CFLAGS}
         cppflags:                   ${CPPFLAGS}
+	introspection:		    ${enable_introspection}
 
         Maintainer mode:            ${USE_MAINTAINER_MODE}
         Building api docs:          ${enable_gtk_doc}
diff --git a/polkitgtk/Makefile.am b/polkitgtk/Makefile.am
index 7b1cb8b..f971976 100644
--- a/polkitgtk/Makefile.am
+++ b/polkitgtk/Makefile.am
@@ -72,6 +72,37 @@ example_LDADD = 					\
 
 CLEANFILES = $(BUILT_SOURCES) $(pkgconfig_DATA)
 
+if ENABLE_INTROSPECTION
+girdir = $(GIRDIR)
+gir_DATA = PolkitGtk-1.0.gir
+
+typelibsdir = $(GIRTYPELIBDIR)
+typelibs_DATA = PolkitGtk-1.0.typelib
+
+PolkitGtk-1.0.gir: libpolkit-gtk-1.la $(G_IR_SCANNER) Makefile.am
+	$(G_IR_SCANNER) -v 					\
+		--namespace PolkitGtk 				\
+		--strip-prefix=polkit				\
+		--nsversion=1.0 				\
+		--include=Gtk-2.0 				\
+		--include=Polkit-1.0 				\
+		--library=polkit-gtk-1 				\
+		--output $@ 					\
+		--pkg=polkit-gobject-1				\
+		--pkg=gtk+-2.0 					\
+		--libtool=$(top_builddir)/libtool		\
+                -I$(top_srcdir)		 			\
+	        -DPOLKIT_GTK_COMPILATION                   	\
+		$(srcdir)/polkitgtk.h 				\
+		$(srcdir)/polkitgtktypes.h 			\
+		$(srcdir)/polkitlockbutton.h 			\
+		$(NULL)
+
+PolkitGtk-1.0.typelib: PolkitGtk-1.0.gir $(G_IR_COMPILER)
+	$(G_IR_COMPILER) $< -o $@
+
+endif # ENABLE_INTROSPECTION
+
 clean-local :
 	rm -f *~ $(BUILT_SOURCES)
 
diff --git a/polkitgtk/example-seed.js b/polkitgtk/example-seed.js
new file mode 100755
index 0000000..33e4192
--- /dev/null
+++ b/polkitgtk/example-seed.js
@@ -0,0 +1,28 @@
+#!/usr/bin/env seed
+
+Gtk = imports.gi.Gtk;
+Polkit = imports.gi.Polkit;
+PolkitGtk = imports.gi.PolkitGtk;
+
+Gtk.init (Seed.argv);
+
+var vbox = new Gtk.VBox ();
+
+var label = new Gtk.Label ({label: "Hello world"});
+label.set_alignment (0 ,0);
+vbox.pack_start (label, false, true, 1);
+
+var lock_button = new PolkitGtk.LockButton ({action_id: "org.freedesktop.devicekit.disks.filesystem-mount"});
+vbox.pack_start (lock_button, false, true, 1);
+
+var window = new Gtk.Window ({title: "PolkitGtk Seed Example", resizable: false});
+window.resize (250, 250);
+window.signal.hide.connect (Gtk.main_quit);
+window.add (vbox);
+window.show_all ();
+
+var authority = Polkit.Authority.get ();
+authority.signal.changed.connect (function () {print ("authority changed!");});
+
+Gtk.main ();
+



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