java-gobject-introspection-examples r6 - in trunk: . src/org/verbum
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection-examples r6 - in trunk: . src/org/verbum
- Date: Sun, 7 Sep 2008 03:27:56 +0000 (UTC)
Author: walters
Date: Sun Sep 7 03:27:56 2008
New Revision: 6
URL: http://svn.gnome.org/viewvc/java-gobject-introspection-examples?rev=6&view=rev
Log:
Add GConfTest, tweak GtkTest to use GError again
Added:
trunk/src/org/verbum/GConfTest.java
Modified:
trunk/.classpath
trunk/src/org/verbum/GtkTest.java
Modified: trunk/.classpath
==============================================================================
--- trunk/.classpath (original)
+++ trunk/.classpath Sun Sep 7 03:27:56 2008
@@ -25,5 +25,7 @@
<classpathentry kind="lib" path="/src/build/gi/share/girepository/ClutterGtk.jar"/>
<classpathentry kind="lib" path="/src/build/gi/share/girepository/cairo.jar"/>
<classpathentry kind="lib" path="/src/build/gi/share/girepository/GooCanvas.jar"/>
+ <classpathentry kind="lib" path="/src/build/gi/share/girepository/GnomeKeyring.jar"/>
+ <classpathentry kind="lib" path="/src/build/gi/share/girepository/GConf.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
Added: trunk/src/org/verbum/GConfTest.java
==============================================================================
--- (empty file)
+++ trunk/src/org/verbum/GConfTest.java Sun Sep 7 03:27:56 2008
@@ -0,0 +1,63 @@
+package org.verbum;
+
+import org.gnome.gir.dynamic.GConf.Client;
+import org.gnome.gir.dynamic.GConf.ClientNotifyFunc;
+import org.gnome.gir.dynamic.GConf.ClientPreloadType;
+import org.gnome.gir.dynamic.GConf.Entry;
+import org.gnome.gir.dynamic.GConf.GConfGlobals;
+import org.gnome.gir.dynamic.Gdk.Event;
+import org.gnome.gir.dynamic.Gtk.GtkGlobals;
+import org.gnome.gir.dynamic.Gtk.Label;
+import org.gnome.gir.dynamic.Gtk.Widget;
+import org.gnome.gir.dynamic.Gtk.Window;
+import org.gnome.gir.dynamic.Gtk.WindowType;
+import org.gnome.gir.gobject.GErrorException;
+
+import com.sun.jna.Pointer;
+
+public class GConfTest {
+
+ public static void main(String...args) throws GErrorException {
+ GtkGlobals.init(null, null);
+ GConfGlobals.init(null, null);
+
+ Window w = new Window(WindowType.TOPLEVEL);
+ w.setSizeRequest(320, 240);
+
+ final Client client = GConfGlobals.clientGetDefault();
+
+ boolean bg = client.getBool("/desktop/gnome/background/draw_background");
+
+ final Label label = new Label("drawing background:" + bg);
+ w.add(label);
+
+ client.addDir("/desktop/gnome/background", ClientPreloadType.PRELOAD_NONE);
+ client.notifyAdd("/desktop/gnome/background/draw_background",
+ new ClientNotifyFunc() {
+ @Override
+ public void callback(Client arg0, Integer arg1, Entry arg2,
+ Pointer arg3) {
+ boolean bg;
+ try {
+ bg = client.getBool("/desktop/gnome/background/draw_background");
+ } catch (GErrorException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ label.setText("drawing background:" + bg);
+ }
+
+ }, null, null);
+
+ w.connect(new Widget.DeleteEvent() {
+ @Override
+ public Boolean onDeleteEvent(Widget arg0, Event arg1) {
+ GtkGlobals.mainQuit();
+ return true;
+ }
+ });
+
+ w.showAll();
+ GtkGlobals.main();
+ }
+}
Modified: trunk/src/org/verbum/GtkTest.java
==============================================================================
--- trunk/src/org/verbum/GtkTest.java (original)
+++ trunk/src/org/verbum/GtkTest.java Sun Sep 7 03:27:56 2008
@@ -43,6 +43,9 @@
iter.forwardChars(5);
buf.insert(iter, " TO THE WHOLE ", -1);
w.showAll();
+
+ w.setIconFromFile("/usr/share/icons/abiword_48.png");
+
GtkGlobals.main();
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]