java-gobject-introspection r28 - trunk



Author: otaylor
Date: Thu Sep  4 21:49:28 2008
New Revision: 28
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=28&view=rev

Log:
Fix up gtktest.js to actually work
run.sh: Print an error message if INROOT_DIR is not specified
runjs.sh: New script for invoking Rhino on a javascript file with the right classpath
gtktest.js: Add missing imports, connect handlers, make a guess at a better style


Added:
   trunk/runjs.sh   (contents, props changed)
Modified:
   trunk/gtktest.js
   trunk/run.sh

Modified: trunk/gtktest.js
==============================================================================
--- trunk/gtktest.js	(original)
+++ trunk/gtktest.js	Thu Sep  4 21:49:28 2008
@@ -1,9 +1,23 @@
-print("hello");
-var gtkPkg=Packages.org.gnome.gir.dynamic.Gtk;
-importPackage(gtkPkg);
-print(gtkPkg.Window);
-var win = Window(WindowType.TOPLEVEL);
-var button = Button("hello!");
+var gobject = Packages.org.gnome.gir.gobject.GObjectGlobals.init()
+var gtk = Packages.org.gnome.gir.dynamic.Gtk;
+
+gtk.GtkGlobals.init(null, null)
+
+var win = gtk.Window();
+
+var button = gtk.Button.newWithLabel("hello!");
+button.connect(gtk.Button.Clicked({
+	    onClicked: function () {
+		print("Hello");
+	    }}));
+
 win.add(button);
 win.showAll();
-GtkGlobals.main();
+
+win.connect(gtk.Widget.DeleteEvent({
+	    onDeleteEvent: function (event) {
+		gtk.GtkGlobals.mainQuit();
+		return true;
+	    }}));
+
+gtk.GtkGlobals.main();

Modified: trunk/run.sh
==============================================================================
--- trunk/run.sh	(original)
+++ trunk/run.sh	Thu Sep  4 21:49:28 2008
@@ -1,4 +1,14 @@
 #!/bin/bash
+
+die() {
+    echo 1>&2 $@
+    exit 1
+}
+
+if [ x"$INROOT_DIR" = x ] ; then
+    die "INROOT_DIR environment variable must be specified"
+fi
+
 JGIRSRC=${INROOT_DIR}/share/girepository
 JARS=
 for j in ${JGIRSRC}/*.jar; do

Added: trunk/runjs.sh
==============================================================================
--- (empty file)
+++ trunk/runjs.sh	Thu Sep  4 21:49:28 2008
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+die() {
+    echo 1>&2 $@
+    exit 1
+}
+
+if [ x"$INROOT_DIR" = x ] ; then
+    die "INROOT_DIR environment variable must be specified"
+fi
+
+SYSTEM_JARS="jna objectweb-asm/asm objectweb-asm/asm-{util,analysis,tree}"
+if [ x"$RHINO_JAR" = x ] ; then
+    JARS=
+    SYSTEM_JARS="$SYSTEM_JARS js.jar"
+else
+    JARS=$RHINO_JAR
+fi
+
+JGIRSRC=${INROOT_DIR}/share/girepository
+for j in ${JGIRSRC}/*.jar; do
+  JARS="$JARS:$j"
+done
+JARS="${JARS}:${INROOT_DIR}/share/java/jgir.jar"
+CLASSPATH=$(build-classpath $SYSTEM_JARS):${JARS}
+export CLASSPATH
+echo "CLASSPATH=$CLASSPATH"
+exec env /usr/bin/java org.mozilla.javascript.tools.shell.Main "$@"
\ No newline at end of file



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