java-gobject-introspection r71 - trunk/src/org/gnome/gir/gobject
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r71 - trunk/src/org/gnome/gir/gobject
- Date: Thu, 2 Oct 2008 03:39:56 +0000 (UTC)
Author: walters
Date: Thu Oct 2 03:39:56 2008
New Revision: 71
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=71&view=rev
Log:
Clean up GValue API usage, don't allow G_TYPE_INVALID ctor
Modified:
trunk/src/org/gnome/gir/gobject/GObject.java
trunk/src/org/gnome/gir/gobject/GValue.java
trunk/src/org/gnome/gir/gobject/GValueAPI.java
Modified: trunk/src/org/gnome/gir/gobject/GObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObject.java (original)
+++ trunk/src/org/gnome/gir/gobject/GObject.java Thu Oct 2 03:39:56 2008
@@ -186,8 +186,7 @@
}
final GType propType = propertySpec.value_type;
- GValue propValue = new GValue();
- GValueAPI.gvalue.g_value_init(propValue, propType);
+ GValue propValue = new GValue(propType);
propValue.set(data);
GObjectAPI.gobj.g_object_set_property(this, property, propValue);
GValueAPI.gvalue.g_value_unset(propValue); // Release any memory
@@ -206,8 +205,7 @@
throw new IllegalArgumentException("Unknown property: " + property);
}
final GType propType = propertySpec.value_type;
- GValue propValue = new GValue();
- GValueAPI.gvalue.g_value_init(propValue, propType);
+ GValue propValue = new GValue(propType);
GObjectAPI.gobj.g_object_get_property(this, property, propValue);
return propValue.toJava();
}
Modified: trunk/src/org/gnome/gir/gobject/GValue.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GValue.java (original)
+++ trunk/src/org/gnome/gir/gobject/GValue.java Thu Oct 2 03:39:56 2008
@@ -53,13 +53,15 @@
public class GValue extends com.sun.jna.Structure {
/*< private >*/
public volatile GType g_type;
-
- public GValue() {
- this(GType.INVALID);
+
+ protected GValue() {
}
public GValue(GType type) {
super();
+ if (type == null)
+ throw new NullPointerException();
+ g_type = GType.INVALID;
GValueAPI.gvalue.g_value_init(this, type);
}
@@ -76,14 +78,12 @@
public volatile GValueData data[] = new GValueData[2];
private static GValue transform(GValue src, GType dstType) {
- GValue dst = new GValue();
- GValueAPI.gvalue.g_value_init(dst, dstType);
+ GValue dst = new GValue(dstType);
GValueAPI.gvalue.g_value_transform(src, dst);
return dst;
}
private static void transform(Object data, GType type, GValue dst) {
- GValue src = new GValue();
- GValueAPI.gvalue.g_value_init(src, type);
+ GValue src = new GValue(type);
setGValue(src, type, data);
GValueAPI.gvalue.g_value_transform(src, dst);
}
Modified: trunk/src/org/gnome/gir/gobject/GValueAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GValueAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GValueAPI.java Thu Oct 2 03:39:56 2008
@@ -47,11 +47,12 @@
import java.util.HashMap;
-import org.gnome.gir.gobject.annotation.Return;
import org.gnome.gir.gobject.annotation.Invalidate;
+import org.gnome.gir.gobject.annotation.Return;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
+import com.sun.jna.Pointer;
/**
*
@@ -65,7 +66,7 @@
}
});
- GValue g_value_init(GValue value, GType g_type);
+ Pointer g_value_init(GValue value, GType g_type);
GValue g_value_reset(GValue value);
void g_value_unset(GValue value);
void g_value_set_char(GValue value, byte v_char);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]