java-gobject-introspection r143 - in trunk: src/org/gnome/gir/compiler src/org/gnome/gir/gobject src/org/gnome/gir/gobject/annotation src/org/gnome/gir/repository src/org/gnome/gir/runtime stub-examples
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r143 - in trunk: src/org/gnome/gir/compiler src/org/gnome/gir/gobject src/org/gnome/gir/gobject/annotation src/org/gnome/gir/repository src/org/gnome/gir/runtime stub-examples
- Date: Mon, 1 Dec 2008 04:40:09 +0000 (UTC)
Author: walters
Date: Mon Dec 1 04:40:09 2008
New Revision: 143
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=143&view=rev
Log:
Massive cleanup; split out main API into "runtime" from "gobject"
We want to expose a few classes for primary public usage; MainLoop,
for example. Having it mixed in with the other far less interesting
(but still public) APIs was ugly. So, create a new "runtime" package
which holds those classes which are most interesting.
Rework compiler to use more Type. APIs instead of hardcoded strings.
Added:
trunk/src/org/gnome/gir/runtime/
trunk/src/org/gnome/gir/runtime/BooleanByReference.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/BooleanByReference.java
trunk/src/org/gnome/gir/runtime/BoxedStructure.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/BoxedStructure.java
trunk/src/org/gnome/gir/runtime/BoxedUnion.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/BoxedUnion.java
trunk/src/org/gnome/gir/runtime/GBoxed.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/GBoxed.java
trunk/src/org/gnome/gir/runtime/GInitiallyUnowned.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/GInitiallyUnowned.java
trunk/src/org/gnome/gir/runtime/GObject.java
trunk/src/org/gnome/gir/runtime/GType.java
trunk/src/org/gnome/gir/runtime/GValue.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/GValue.java
trunk/src/org/gnome/gir/runtime/MainLoop.java
- copied, changed from r142, /trunk/src/org/gnome/gir/gobject/MainLoop.java
Removed:
trunk/src/org/gnome/gir/gobject/BooleanByReference.java
trunk/src/org/gnome/gir/gobject/BoxedStructure.java
trunk/src/org/gnome/gir/gobject/BoxedUnion.java
trunk/src/org/gnome/gir/gobject/ComplexReturn.java
trunk/src/org/gnome/gir/gobject/GBoxed.java
trunk/src/org/gnome/gir/gobject/GInitiallyUnowned.java
trunk/src/org/gnome/gir/gobject/GObject.java
trunk/src/org/gnome/gir/gobject/GType.java
trunk/src/org/gnome/gir/gobject/GValue.java
trunk/src/org/gnome/gir/gobject/MainLoop.java
trunk/src/org/gnome/gir/gobject/Util.java
trunk/src/org/gnome/gir/gobject/ZeroTerminatedArray.java
trunk/src/org/gnome/gir/gobject/annotation/ConstField.java
trunk/src/org/gnome/gir/gobject/annotation/IncRef.java
trunk/src/org/gnome/gir/gobject/annotation/Invalidate.java
trunk/src/org/gnome/gir/gobject/annotation/RepositoryId.java
trunk/src/org/gnome/gir/gobject/annotation/Return.java
trunk/src/org/gnome/gir/gobject/annotation/ReturnContainer.java
trunk/stub-examples/TestStructure.java
Modified:
trunk/src/org/gnome/gir/compiler/ClassCompilation.java
trunk/src/org/gnome/gir/compiler/CodeFactory.java
trunk/src/org/gnome/gir/compiler/StubClassCompilation.java
trunk/src/org/gnome/gir/compiler/TypeMap.java
trunk/src/org/gnome/gir/gobject/EnumMapper.java
trunk/src/org/gnome/gir/gobject/GBoxedAPI.java
trunk/src/org/gnome/gir/gobject/GClosure.java
trunk/src/org/gnome/gir/gobject/GHashTable.java
trunk/src/org/gnome/gir/gobject/GList.java
trunk/src/org/gnome/gir/gobject/GMainContext.java
trunk/src/org/gnome/gir/gobject/GObjectAPI.java
trunk/src/org/gnome/gir/gobject/GSignalAPI.java
trunk/src/org/gnome/gir/gobject/GSignalQuery.java
trunk/src/org/gnome/gir/gobject/GTypeInstance.java
trunk/src/org/gnome/gir/gobject/GTypeMapper.java
trunk/src/org/gnome/gir/gobject/GTypeModule.java
trunk/src/org/gnome/gir/gobject/GValueAPI.java
trunk/src/org/gnome/gir/gobject/GlibAPI.java
trunk/src/org/gnome/gir/gobject/GlibRuntime.java
trunk/src/org/gnome/gir/gobject/Handle.java
trunk/src/org/gnome/gir/gobject/NativeObject.java
trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
trunk/src/org/gnome/gir/repository/Repository.java
trunk/stub-examples/Test.java
trunk/stub-examples/TestAbs.java
Modified: trunk/src/org/gnome/gir/compiler/ClassCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/ClassCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/ClassCompilation.java Mon Dec 1 04:40:09 2008
@@ -6,8 +6,8 @@
import static org.objectweb.asm.Opcodes.ACC_STATIC;
import static org.objectweb.asm.Opcodes.RETURN;
-import org.gnome.gir.gobject.GType;
import org.gnome.gir.repository.Repository;
+import org.gnome.gir.runtime.GType;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
Modified: trunk/src/org/gnome/gir/compiler/CodeFactory.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/CodeFactory.java (original)
+++ trunk/src/org/gnome/gir/compiler/CodeFactory.java Mon Dec 1 04:40:09 2008
@@ -24,10 +24,10 @@
import static org.objectweb.asm.Opcodes.CHECKCAST;
import static org.objectweb.asm.Opcodes.DUP;
import static org.objectweb.asm.Opcodes.GETSTATIC;
+import static org.objectweb.asm.Opcodes.IADD;
import static org.objectweb.asm.Opcodes.ICONST_0;
import static org.objectweb.asm.Opcodes.IFNULL;
import static org.objectweb.asm.Opcodes.ILOAD;
-import static org.objectweb.asm.Opcodes.IADD;
import static org.objectweb.asm.Opcodes.INVOKESPECIAL;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
import static org.objectweb.asm.Opcodes.INVOKEVIRTUAL;
@@ -73,13 +73,12 @@
import org.gnome.gir.gobject.GList;
import org.gnome.gir.gobject.GObjectAPI;
import org.gnome.gir.gobject.GSList;
-import org.gnome.gir.gobject.GType;
+import org.gnome.gir.gobject.GTypeMapper;
import org.gnome.gir.gobject.GenericGList;
import org.gnome.gir.gobject.GlibAPI;
import org.gnome.gir.gobject.GlibRuntime;
import org.gnome.gir.gobject.NativeEnum;
import org.gnome.gir.gobject.NativeObject;
-import org.gnome.gir.gobject.annotation.Return;
import org.gnome.gir.repository.ArgInfo;
import org.gnome.gir.repository.BaseInfo;
import org.gnome.gir.repository.BoxedInfo;
@@ -105,6 +104,9 @@
import org.gnome.gir.repository.TypeTag;
import org.gnome.gir.repository.UnionInfo;
import org.gnome.gir.repository.ValueInfo;
+import org.gnome.gir.runtime.GBoxed;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.FieldVisitor;
@@ -118,8 +120,8 @@
import com.sun.jna.Callback;
import com.sun.jna.Function;
import com.sun.jna.NativeLibrary;
-import com.sun.jna.NativeMapped;
import com.sun.jna.Pointer;
+import com.sun.jna.PointerType;
import com.sun.jna.TypeMapper;
import com.sun.jna.ptr.PointerByReference;
@@ -400,9 +402,11 @@
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType", "()Lorg/gnome/gir/gobject/GType;");
+ mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType",
+ Type.getMethodDescriptor(getType(GType.class), new Type[] {}));
mv.visitInsn(ACONST_NULL);
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>", "(Lorg/gnome/gir/gobject/GType;[Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Object[].class)}));
Label l1 = new Label();
mv.visitLabel(l1);
mv.visitInsn(RETURN);
@@ -417,9 +421,11 @@
l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType", "()Lorg/gnome/gir/gobject/GType;");
+ mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType",
+ Type.getMethodDescriptor(getType(GType.class), new Type[] {}));
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>", "(Lorg/gnome/gir/gobject/GType;[Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Object[].class)}));
l1 = new Label();
mv.visitLabel(l1);
mv.visitInsn(RETURN);
@@ -436,9 +442,11 @@
l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType", "()Lorg/gnome/gir/gobject/GType;");
+ mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "getGType",
+ Type.getMethodDescriptor(getType(GType.class), new Type[] {}));
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>", "(Lorg/gnome/gir/gobject/GType;Ljava/util/Map;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Map.class)}));
l1 = new Label();
mv.visitLabel(l1);
mv.visitInsn(RETURN);
@@ -449,41 +457,45 @@
mv.visitMaxs(0, 0);
mv.visitEnd();
- mv = compilation.writer.visitMethod(ACC_PROTECTED, "<init>", "(Lorg/gnome/gir/gobject/GType;[Ljava/lang/Object;)V", null, null);
+ mv = compilation.writer.visitMethod(ACC_PROTECTED, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Object[].class)}), null, null);
mv.visitCode();
l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>", "(Lorg/gnome/gir/gobject/GType;[Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Object[].class)}));
l1 = new Label();
mv.visitLabel(l1);
mv.visitInsn(RETURN);
l2 = new Label();
mv.visitLabel(l2);
mv.visitLocalVariable("this", "L"+ compilation.internalName + ";", null, l0, l2, 0);
- mv.visitLocalVariable("gtype", "Lorg/gnome/gir/gobject/GType;", null, l0, l2, 1);
+ mv.visitLocalVariable("gtype", Type.getDescriptor(GType.class), null, l0, l2, 1);
mv.visitLocalVariable("args", "[Ljava/lang/Object;", null, l0, l2, 2);
mv.visitMaxs(0, 0);
mv.visitEnd();
- mv = compilation.writer.visitMethod(ACC_PROTECTED, "<init>", "(Lorg/gnome/gir/gobject/GType;Ljava/util/Map;)V",
- "(Lorg/gnome/gir/gobject/GType;Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V", null);
+ mv = compilation.writer.visitMethod(ACC_PROTECTED, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Map.class)}),
+ "(" + Type.getDescriptor(GType.class) + "Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V", null);
mv.visitCode();
l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>", "(Lorg/gnome/gir/gobject/GType;Ljava/util/Map;)V");
+ mv.visitMethodInsn(INVOKESPECIAL, parentInternalType, "<init>",
+ Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { getType(GType.class), getType(Map.class)}));
l1 = new Label();
mv.visitLabel(l1);
mv.visitInsn(RETURN);
l2 = new Label();
mv.visitLabel(l2);
mv.visitLocalVariable("this", "L"+ compilation.internalName + ";", null, l0, l2, 0);
- mv.visitLocalVariable("gtype", "Lorg/gnome/gir/gobject/GType;", null, l0, l2, 1);
+ mv.visitLocalVariable("gtype", Type.getDescriptor(GType.class), null, l0, l2, 1);
mv.visitLocalVariable("args", "Ljava/util/Map;", "(Ljava/util/Map<Ljava/lang/String;Ljava/lang/Object;>;)V", l0, l2, 2);
mv.visitMaxs(0, 0);
mv.visitEnd();
@@ -579,7 +591,7 @@
mv.visitInsn(AASTORE);
}
mv.visitFieldInsn(GETSTATIC, globalInternalsName, "invocationOptions", "Ljava/util/Map;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "com/sun/jna/Function", "invoke", "(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, Type.getInternalName(Function.class), "invoke", "(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;");
mv.visitTypeInsn(CHECKCAST, "com/sun/jna/Pointer");
mv.visitMethodInsn(INVOKESTATIC, compilation.internalName, "initializer",
"(Lcom/sun/jna/Pointer;)Lorg/gnome/gir/gobject/Handle$Initializer;");
@@ -941,7 +953,7 @@
String internalName = getInternalName(info);
List<String> extendsList = new ArrayList<String>();
- extendsList.add("org/gnome/gir/gobject/GObject$GObjectProxy");
+ extendsList.add(Type.getInternalName(GObject.GObjectProxy.class));
for (BaseInfo prereq : info.getPrerequisites()) {
if (!(prereq instanceof InterfaceInfo))
@@ -982,9 +994,10 @@
InnerClassCompilation anonProxy = compilation.newInner("AnonStub");
compilation.writer.visitInnerClass(anonProxy.internalName,
compilation.internalName, "AnonStub", ACC_PUBLIC + ACC_FINAL + ACC_STATIC);
- anonProxy.writer.visit(V1_6, ACC_PUBLIC + ACC_SUPER + ACC_FINAL, anonProxy.internalName, null, "org/gnome/gir/gobject/GObject",
+ anonProxy.writer.visit(V1_6, ACC_PUBLIC + ACC_SUPER + ACC_FINAL, anonProxy.internalName, null,
+ Type.getInternalName(GObject.class),
new String[] { compilation.internalName });
- writeHandleInitializer(anonProxy, "org/gnome/gir/gobject/GObject");
+ writeHandleInitializer(anonProxy, Type.getInternalName(GObject.class));
sigs = new HashSet<String>();
for (FunctionInfo fi: info.getMethods()) {
CallableCompilationContext ctx = tryCompileCallable(fi, info, true, false, sigs);
@@ -1227,12 +1240,6 @@
nativeReturnType = ctx.returnType;
}
- if (primitiveBox == null) {
- AnnotationVisitor av = mv.visitAnnotation(Type.getDescriptor(Return.class), true);
- av.visitEnum("transfer", Type.getDescriptor(Transfer.class), returnTransfer.name());
- av.visitEnd();
- }
-
mv.visitCode();
LocalVariableTable locals = ctx.allocLocals();
int functionOffset = locals.allocTmp("function", Type.getType(Function.class));
@@ -1381,19 +1388,21 @@
private void writeGetGType(RegisteredTypeInfo rti, ClassCompilation compilation) {
String globalInternalsName = getInternals(rti);
- MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC + ACC_STATIC, "getGType", "()Lorg/gnome/gir/gobject/GType;", null, null);
+ MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC + ACC_STATIC, "getGType",
+ Type.getMethodDescriptor(getType(GType.class), new Type[] {}), null, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
- mv.visitFieldInsn(GETSTATIC, globalInternalsName, "library", "Lcom/sun/jna/NativeLibrary;");
+ mv.visitFieldInsn(GETSTATIC, globalInternalsName, "library",
+ Type.getDescriptor(NativeLibrary.class));
mv.visitLdcInsn(rti.getTypeInit());
- mv.visitMethodInsn(INVOKEVIRTUAL, "com/sun/jna/NativeLibrary", "getFunction", "(Ljava/lang/String;)Lcom/sun/jna/Function;");
- mv.visitLdcInsn(Type.getType("Lorg/gnome/gir/gobject/GType;"));
+ mv.visitMethodInsn(INVOKEVIRTUAL, Type.getInternalName(NativeLibrary.class), "getFunction", "(Ljava/lang/String;)Lcom/sun/jna/Function;");
+ mv.visitLdcInsn(getType(GType.class));
mv.visitInsn(ICONST_0);
- mv.visitTypeInsn(ANEWARRAY, "java/lang/Object");
+ mv.visitTypeInsn(ANEWARRAY, Type.getInternalName(Object.class));
mv.visitFieldInsn(GETSTATIC, globalInternalsName, "invocationOptions", "Ljava/util/Map;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "com/sun/jna/Function", "invoke", "(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;");
- mv.visitTypeInsn(CHECKCAST, "org/gnome/gir/gobject/GType");
+ mv.visitMethodInsn(INVOKEVIRTUAL, Type.getInternalName(Function.class), "invoke", "(Ljava/lang/Class;[Ljava/lang/Object;Ljava/util/Map;)Ljava/lang/Object;");
+ mv.visitTypeInsn(CHECKCAST, Type.getInternalName(GType.class));
mv.visitInsn(ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
@@ -1414,7 +1423,8 @@
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, "org/gnome/gir/gobject/GTypeMapper", "getInstance", "()Lorg/gnome/gir/gobject/GTypeMapper;");
+ mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(GTypeMapper.class), "getInstance",
+ Type.getMethodDescriptor(getType(GTypeMapper.class), new Type[] {}));
mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>", "(Lcom/sun/jna/TypeMapper;)V");
mv.visitInsn(RETURN);
Label l1 = new Label();
@@ -1435,14 +1445,14 @@
boolean hasFields = fields.length > 0;
if (isRegistered) {
if (hasFields)
- parentInternalName = "org/gnome/gir/gobject/Boxed" + type;
+ parentInternalName = "org/gnome/gir/runtime/Boxed" + type;
else
- parentInternalName = "org/gnome/gir/gobject/GBoxed";
+ parentInternalName = Type.getInternalName(GBoxed.class);
} else {
if (hasFields)
parentInternalName = "com/sun/jna/" + type;
else
- parentInternalName = "com/sun/jna/PointerType";
+ parentInternalName = Type.getInternalName(PointerType.class);
}
compilation.writer.visit(V1_6, ACC_PUBLIC + ACC_SUPER, internalName, null,
parentInternalName, null);
@@ -1511,8 +1521,8 @@
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, "org/gnome/gir/gobject/GTypeMapper", "getInstance",
- "()Lorg/gnome/gir/gobject/GTypeMapper;");
+ mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(GTypeMapper.class), "getInstance",
+ Type.getMethodDescriptor(getType(GTypeMapper.class), new Type[] {}));
mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>", "(Lcom/sun/jna/TypeMapper;)V");
mv.visitInsn(RETURN);
Label l1 = new Label();
@@ -1562,8 +1572,8 @@
l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESTATIC, "org/gnome/gir/gobject/GTypeMapper", "getInstance",
- "()Lorg/gnome/gir/gobject/GTypeMapper;");
+ mv.visitMethodInsn(INVOKESTATIC, Type.getInternalName(GTypeMapper.class), "getInstance",
+ Type.getMethodDescriptor(Type.getType(GTypeMapper.class), new Type[] {}));
mv.visitMethodInsn(INVOKESPECIAL, parentInternalName, "<init>", "(Lcom/sun/jna/TypeMapper;)V");
Label l2 = new Label();
mv.visitLabel(l2);
@@ -1622,14 +1632,15 @@
ClassCompilation compilation = getCompilation(info);
String internalName = getInternalName(info);
- compilation.writer.visit(V1_6, ACC_PUBLIC + ACC_SUPER, internalName, null, "org/gnome/gir/gobject/GBoxed", null);
+ compilation.writer.visit(V1_6, ACC_PUBLIC + ACC_SUPER, internalName, null,
+ Type.getInternalName(GBoxed.class), null);
MethodVisitor mv = compilation.writer.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
mv.visitCode();
Label l0 = new Label();
mv.visitLabel(l0);
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESPECIAL, "org/gnome/gir/gobject/GBoxed", "<init>", "()V");
+ mv.visitMethodInsn(INVOKESPECIAL, Type.getInternalName(GBoxed.class), "<init>", "()V");
mv.visitInsn(RETURN);
Label l1 = new Label();
mv.visitLabel(l1);
Modified: trunk/src/org/gnome/gir/compiler/StubClassCompilation.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/StubClassCompilation.java (original)
+++ trunk/src/org/gnome/gir/compiler/StubClassCompilation.java Mon Dec 1 04:40:09 2008
@@ -6,7 +6,7 @@
import java.util.HashSet;
import java.util.Set;
-import org.gnome.gir.gobject.GType;
+import org.gnome.gir.runtime.GType;
class StubClassCompilation extends ClassCompilation {
Set<InnerClassCompilation> innerClasses;
Modified: trunk/src/org/gnome/gir/compiler/TypeMap.java
==============================================================================
--- trunk/src/org/gnome/gir/compiler/TypeMap.java (original)
+++ trunk/src/org/gnome/gir/compiler/TypeMap.java Mon Dec 1 04:40:09 2008
@@ -10,7 +10,6 @@
import org.gnome.gir.gobject.GList;
import org.gnome.gir.gobject.GSList;
-import org.gnome.gir.gobject.GType;
import org.gnome.gir.gobject.UnmappedPointer;
import org.gnome.gir.repository.ArgInfo;
import org.gnome.gir.repository.BaseInfo;
@@ -25,6 +24,7 @@
import org.gnome.gir.repository.TypeInfo;
import org.gnome.gir.repository.TypeTag;
import org.gnome.gir.repository.UnionInfo;
+import org.gnome.gir.runtime.GType;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureVisitor;
Modified: trunk/src/org/gnome/gir/gobject/EnumMapper.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/EnumMapper.java (original)
+++ trunk/src/org/gnome/gir/gobject/EnumMapper.java Mon Dec 1 04:40:09 2008
@@ -47,8 +47,6 @@
import java.util.EnumSet;
-import com.sun.jna.NativeMapped;
-
/**
* Maps to and from native int and an Enum value.
* @author wayne
Modified: trunk/src/org/gnome/gir/gobject/GBoxedAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GBoxedAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GBoxedAPI.java Mon Dec 1 04:40:09 2008
@@ -47,6 +47,8 @@
import java.util.HashMap;
+import org.gnome.gir.runtime.GType;
+
import com.sun.jna.Library;
import com.sun.jna.Pointer;
Modified: trunk/src/org/gnome/gir/gobject/GClosure.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GClosure.java (original)
+++ trunk/src/org/gnome/gir/gobject/GClosure.java Mon Dec 1 04:40:09 2008
@@ -1,5 +1,7 @@
package org.gnome.gir.gobject;
+import org.gnome.gir.runtime.GBoxed;
+
import com.sun.jna.Pointer;
Modified: trunk/src/org/gnome/gir/gobject/GHashTable.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GHashTable.java (original)
+++ trunk/src/org/gnome/gir/gobject/GHashTable.java Mon Dec 1 04:40:09 2008
@@ -1,5 +1,7 @@
package org.gnome.gir.gobject;
+import org.gnome.gir.runtime.GBoxed;
+
import com.sun.jna.Pointer;
Modified: trunk/src/org/gnome/gir/gobject/GList.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GList.java (original)
+++ trunk/src/org/gnome/gir/gobject/GList.java Mon Dec 1 04:40:09 2008
@@ -1,10 +1,5 @@
package org.gnome.gir.gobject;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.gnome.gir.repository.Transfer;
-
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
Modified: trunk/src/org/gnome/gir/gobject/GMainContext.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GMainContext.java (original)
+++ trunk/src/org/gnome/gir/gobject/GMainContext.java Mon Dec 1 04:40:09 2008
@@ -45,7 +45,6 @@
package org.gnome.gir.gobject;
-import com.sun.jna.Pointer;
/**
*
Modified: trunk/src/org/gnome/gir/gobject/GObjectAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GObjectAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GObjectAPI.java Mon Dec 1 04:40:09 2008
@@ -47,6 +47,10 @@
import java.util.HashMap;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
+import org.gnome.gir.runtime.GValue;
+
import com.sun.jna.Callback;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
Modified: trunk/src/org/gnome/gir/gobject/GSignalAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GSignalAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GSignalAPI.java Mon Dec 1 04:40:09 2008
@@ -48,6 +48,8 @@
import java.util.HashMap;
import org.gnome.gir.gobject.GObjectAPI.GClosureNotify;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
import com.sun.jna.Callback;
import com.sun.jna.Library;
Modified: trunk/src/org/gnome/gir/gobject/GSignalQuery.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GSignalQuery.java (original)
+++ trunk/src/org/gnome/gir/gobject/GSignalQuery.java Mon Dec 1 04:40:09 2008
@@ -25,6 +25,8 @@
*/
package org.gnome.gir.gobject;
+import org.gnome.gir.runtime.GType;
+
import com.sun.jna.Pointer;
public final class GSignalQuery extends com.sun.jna.Structure {
Modified: trunk/src/org/gnome/gir/gobject/GTypeInstance.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GTypeInstance.java (original)
+++ trunk/src/org/gnome/gir/gobject/GTypeInstance.java Mon Dec 1 04:40:09 2008
@@ -45,6 +45,8 @@
package org.gnome.gir.gobject;
+import org.gnome.gir.runtime.GType;
+
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
Modified: trunk/src/org/gnome/gir/gobject/GTypeMapper.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GTypeMapper.java (original)
+++ trunk/src/org/gnome/gir/gobject/GTypeMapper.java Mon Dec 1 04:40:09 2008
@@ -45,22 +45,15 @@
package org.gnome.gir.gobject;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
import java.net.URI;
import java.util.Date;
-import org.gnome.gir.gobject.annotation.ConstField;
-import org.gnome.gir.gobject.annotation.IncRef;
-import org.gnome.gir.gobject.annotation.Invalidate;
-import org.gnome.gir.gobject.annotation.Return;
-import org.gnome.gir.repository.Transfer;
+import org.gnome.gir.runtime.GObject;
import com.sun.jna.CallbackParameterContext;
import com.sun.jna.FromNativeContext;
import com.sun.jna.FromNativeConverter;
import com.sun.jna.FunctionResultContext;
-import com.sun.jna.MethodParameterContext;
import com.sun.jna.MethodResultContext;
import com.sun.jna.Pointer;
import com.sun.jna.StructureReadContext;
Modified: trunk/src/org/gnome/gir/gobject/GTypeModule.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GTypeModule.java (original)
+++ trunk/src/org/gnome/gir/gobject/GTypeModule.java Mon Dec 1 04:40:09 2008
@@ -23,6 +23,9 @@
package org.gnome.gir.gobject;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
+
public class GTypeModule extends GObject {
protected GTypeModule(GType gtype, Object[] args) {
super(gtype, args);
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 Mon Dec 1 04:40:09 2008
@@ -47,8 +47,9 @@
import java.util.HashMap;
-import org.gnome.gir.gobject.annotation.Invalidate;
-import org.gnome.gir.gobject.annotation.Return;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
+import org.gnome.gir.runtime.GValue;
import com.sun.jna.Library;
import com.sun.jna.NativeLong;
@@ -101,7 +102,6 @@
boolean g_value_transform(GValue src_value, GValue dest_value);
void g_value_set_object(GValue value, GObject v_object);
- void g_value_take_object(GValue value, @Invalidate GObject v_object);
/* Should not use this one - _dup_object will be handled correctly, just use that */
/* GObject g_value_get_object(GValue value); */
GObject g_value_dup_object(GValue value);
Modified: trunk/src/org/gnome/gir/gobject/GlibAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GlibAPI.java (original)
+++ trunk/src/org/gnome/gir/gobject/GlibAPI.java Mon Dec 1 04:40:09 2008
@@ -46,7 +46,7 @@
package org.gnome.gir.gobject;
import java.util.HashMap;
-import org.gnome.gir.gobject.annotation.Return;
+import org.gnome.gir.runtime.MainLoop;
import com.sun.jna.Callback;
import com.sun.jna.Library;
@@ -69,7 +69,7 @@
Pointer g_main_loop_new(GMainContext context, boolean running);
void g_main_loop_run(MainLoop loop);
boolean g_main_loop_is_running(MainLoop loop);
- @Return GMainContext g_main_loop_get_context(MainLoop loop);
+ GMainContext g_main_loop_get_context(MainLoop loop);
void g_main_loop_quit(MainLoop loop);
void g_main_loop_ref(MainLoop ptr);
void g_main_loop_unref(MainLoop ptr);
@@ -89,9 +89,9 @@
boolean g_main_context_is_owner(GMainContext ctx);
boolean g_main_context_wait(GMainContext ctx);
- @Return GSource g_idle_source_new();
- @Return GSource g_timeout_source_new(int interval);
- @Return GSource g_timeout_source_new_seconds(int interval);
+ GSource g_idle_source_new();
+ GSource g_timeout_source_new(int interval);
+ GSource g_timeout_source_new_seconds(int interval);
int g_source_attach(GSource source, GMainContext context);
void g_source_destroy(Pointer source);
void g_source_destroy(GSource source);
Modified: trunk/src/org/gnome/gir/gobject/GlibRuntime.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/GlibRuntime.java (original)
+++ trunk/src/org/gnome/gir/gobject/GlibRuntime.java Mon Dec 1 04:40:09 2008
@@ -29,6 +29,7 @@
import java.util.Set;
import org.gnome.gir.repository.Transfer;
+import org.gnome.gir.runtime.GObject;
import com.sun.jna.Callback;
import com.sun.jna.Pointer;
Modified: trunk/src/org/gnome/gir/gobject/Handle.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/Handle.java (original)
+++ trunk/src/org/gnome/gir/gobject/Handle.java Mon Dec 1 04:40:09 2008
@@ -49,7 +49,7 @@
abstract public class Handle extends NativeValue {
// Use this to propagate low level pointer arguments up the constructor chain
- protected static class Initializer {
+ public static class Initializer {
public final Pointer ptr;
public final boolean ownsRef;
Modified: trunk/src/org/gnome/gir/gobject/NativeObject.java
==============================================================================
--- trunk/src/org/gnome/gir/gobject/NativeObject.java (original)
+++ trunk/src/org/gnome/gir/gobject/NativeObject.java Mon Dec 1 04:40:09 2008
@@ -53,6 +53,8 @@
import java.util.concurrent.ConcurrentMap;
import org.gnome.gir.repository.BaseInfo;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
import com.sun.jna.Pointer;
@@ -141,7 +143,7 @@
System.err.printf(fmt, args);
}
- protected static NativeObject instanceFor(Pointer ptr) {
+ public static NativeObject instanceFor(Pointer ptr) {
WeakReference<NativeObject> ref = NativeObject.instanceMap.get(ptr);
//
Modified: trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java (original)
+++ trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java Mon Dec 1 04:40:09 2008
@@ -27,8 +27,8 @@
import java.util.HashMap;
-import org.gnome.gir.gobject.GType;
import org.gnome.gir.gobject.GTypeMapper;
+import org.gnome.gir.runtime.GType;
import com.sun.jna.Library;
import com.sun.jna.Native;
Modified: trunk/src/org/gnome/gir/repository/Repository.java
==============================================================================
--- trunk/src/org/gnome/gir/repository/Repository.java (original)
+++ trunk/src/org/gnome/gir/repository/Repository.java Mon Dec 1 04:40:09 2008
@@ -2,9 +2,9 @@
import org.gnome.gir.gobject.GErrorException;
import org.gnome.gir.gobject.GErrorStruct;
-import org.gnome.gir.gobject.GObject;
import org.gnome.gir.gobject.GObjectGlobals;
import org.gnome.gir.gobject.NativeObject;
+import org.gnome.gir.runtime.GObject;
import com.sun.jna.NativeLong;
import com.sun.jna.ptr.PointerByReference;
Copied: trunk/src/org/gnome/gir/runtime/BooleanByReference.java (from r142, /trunk/src/org/gnome/gir/gobject/BooleanByReference.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/BooleanByReference.java (original)
+++ trunk/src/org/gnome/gir/runtime/BooleanByReference.java Mon Dec 1 04:40:09 2008
@@ -1,7 +1,13 @@
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
import com.sun.jna.ptr.ByReference;
+/**
+ * A simple class for passing Boolean values by reference,
+ * similar to the other JNA classes.
+ *
+ * @author walters
+ */
public class BooleanByReference extends ByReference {
protected BooleanByReference() {
Copied: trunk/src/org/gnome/gir/runtime/BoxedStructure.java (from r142, /trunk/src/org/gnome/gir/gobject/BoxedStructure.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/BoxedStructure.java (original)
+++ trunk/src/org/gnome/gir/runtime/BoxedStructure.java Mon Dec 1 04:40:09 2008
@@ -1,4 +1,8 @@
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
+
+import org.gnome.gir.gobject.GBoxedAPI;
+import org.gnome.gir.gobject.GObjectAPI;
+import org.gnome.gir.gobject.RegisteredType;
import com.sun.jna.Pointer;
import com.sun.jna.Structure;
@@ -26,7 +30,7 @@
/**
* Return the GType associated with this boxed. Not intended for public use.
*/
- GType getGType() {
+ public GType getGType() {
return gtype;
}
Copied: trunk/src/org/gnome/gir/runtime/BoxedUnion.java (from r142, /trunk/src/org/gnome/gir/gobject/BoxedUnion.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/BoxedUnion.java (original)
+++ trunk/src/org/gnome/gir/runtime/BoxedUnion.java Mon Dec 1 04:40:09 2008
@@ -1,4 +1,8 @@
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
+
+import org.gnome.gir.gobject.GBoxedAPI;
+import org.gnome.gir.gobject.GObjectAPI;
+import org.gnome.gir.gobject.RegisteredType;
import com.sun.jna.Pointer;
import com.sun.jna.TypeMapper;
@@ -26,7 +30,7 @@
/**
* Return the GType associated with this boxed. Not intended for public use.
*/
- GType getGType() {
+ public GType getGType() {
return gtype;
}
Copied: trunk/src/org/gnome/gir/runtime/GBoxed.java (from r142, /trunk/src/org/gnome/gir/gobject/GBoxed.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/GBoxed.java (original)
+++ trunk/src/org/gnome/gir/runtime/GBoxed.java Mon Dec 1 04:40:09 2008
@@ -1,7 +1,11 @@
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
import java.lang.reflect.Constructor;
+import org.gnome.gir.gobject.GBoxedAPI;
+import org.gnome.gir.gobject.GTypeMapper;
+import org.gnome.gir.gobject.RegisteredType;
+
import com.sun.jna.Pointer;
import com.sun.jna.PointerType;
import com.sun.jna.Structure;
@@ -23,7 +27,7 @@
/**
* Return the GType associated with this boxed. Not intended for public use.
*/
- GType getGType() {
+ public GType getGType() {
return gtype;
}
Copied: trunk/src/org/gnome/gir/runtime/GInitiallyUnowned.java (from r142, /trunk/src/org/gnome/gir/gobject/GInitiallyUnowned.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/GInitiallyUnowned.java (original)
+++ trunk/src/org/gnome/gir/runtime/GInitiallyUnowned.java Mon Dec 1 04:40:09 2008
@@ -1,4 +1,4 @@
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
import java.util.Map;
Added: trunk/src/org/gnome/gir/runtime/GObject.java
==============================================================================
--- (empty file)
+++ trunk/src/org/gnome/gir/runtime/GObject.java Mon Dec 1 04:40:09 2008
@@ -0,0 +1,382 @@
+/*
+ * Copyright (c) 2008 Colin Walters <walters verbum org>
+ *
+ * This file is part of java-gobject-introspection.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307 USA.
+ *
+ */
+/*
+ * Copyright (c) 2007 Wayne Meissner
+ *
+ * This file was originally part of gstreamer-java; modified for use in
+ * jgir. By permission of author, this file has been relicensed from LGPLv3
+ * to the license of jgir; see below.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307 USA.
+ */
+
+package org.gnome.gir.runtime;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.gnome.gir.gobject.GObjectAPI;
+import org.gnome.gir.gobject.GSignalAPI;
+import org.gnome.gir.gobject.GTypeMapper;
+import org.gnome.gir.gobject.IntPtr;
+import org.gnome.gir.gobject.NativeObject;
+import org.gnome.gir.gobject.GObjectAPI.GObjectStruct;
+import org.gnome.gir.gobject.GObjectAPI.GParamSpec;
+import org.gnome.gir.gobject.GObjectAPI.GToggleNotify;
+import org.gnome.gir.gobject.GObjectAPI.GWeakNotify;
+
+import com.sun.jna.Callback;
+import com.sun.jna.NativeLong;
+import com.sun.jna.Pointer;
+import com.sun.jna.TypeMapper;
+
+/**
+ * This class provides the base Java peer for a GObject. It should generally not
+ * be necessary to call functions in this class directly, as more convenient wrapper
+ * functions for e.g. property retrieval are generated by the JGIR compiler.
+ *
+ * The one component which is important to understand is the fundamental constructors.
+ * GObject has a powerful property mechanism, and object authors can specify properties
+ * which are accessible at object construction time. This is mapped as two different
+ * kinds of constructors, one which takes a Map, and one which takes an Array of pairs.
+ *
+ */
+public abstract class GObject extends NativeObject {
+ private static final Map<GObject, Boolean> strongReferences = new ConcurrentHashMap<GObject, Boolean>();
+
+ private final IntPtr objectID = new IntPtr(System.identityHashCode(this));
+ private boolean disposed = false;
+
+ /*
+ * Hold a strong Java reference between this proxy object and any signal
+ * handlers installed. Often this would be done anyways, but if you're just
+ * calling System.out.println in a callback, it would otherwise be eligible
+ * for GC.
+ */
+ private Map<Long, Callback> signalHandlers = new HashMap<Long, Callback>();
+
+ private static final void debugMemory(GObject obj, String fmt, Object... args) {
+ if (NativeObject.Internals.debugMemory) {
+ Object[] newArgs = new Object[args.length + 2];
+ System.arraycopy(args, 0, newArgs, 1, args.length);
+ newArgs[0] = obj;
+ if (obj != null) {
+ GObjectStruct objStruct = new GObjectAPI.GObjectStruct(obj);
+ newArgs[newArgs.length - 1] = objStruct.ref_count;
+ } else {
+ newArgs[newArgs.length - 1] = "<null>";
+ }
+ NativeObject.Internals.debugMemory(fmt, newArgs);
+ }
+ }
+
+ private static final void debugMemoryFinal(GObject obj, String fmt, Object... args) {
+ if (!NativeObject.Internals.debugMemoryFinalization)
+ return;
+ debugMemory(obj, fmt, args);
+ }
+
+ /**
+ * A tagging interface to mark classes which are GObject property bags.
+ *
+ * @author walters
+ *
+ */
+ public static interface GProperties {
+ };
+
+ /**
+ * A tagging interface used in the code generator - if a method returns an
+ * interface, we have it extend this interface so we know it's a GObject.
+ *
+ * @author walters
+ */
+ public static interface GObjectProxy {
+ };
+
+ /**
+ * The core GObject initializer function, intended for invocation from
+ * return values of unmanaged code.
+ *
+ * @param init
+ */
+ public GObject(Initializer init) {
+ super(init);
+
+ strongReferences.put(this, Boolean.TRUE);
+
+ /*
+ * Floating refs are just a convenience for C; we always want only
+ * strong nonfloating refs for objects which have a JVM peer.
+ */
+ boolean wasFloating = GObjectAPI.gobj.g_object_is_floating(this);
+ if (wasFloating) {
+ debugMemory(this, "SINK AND TOGGLE %s %s%n");
+ GObjectAPI.gobj.g_object_ref_sink(this);
+ } else {
+ debugMemory(this, "INIT TOGGLE %s %s%n");
+ }
+
+ /*
+ * The toggle reference is our primary means of memory management
+ * between this Proxy object and the GObject.
+ */
+ GObjectAPI.gobj.g_object_add_toggle_ref(init.ptr, toggle, objectID);
+
+ /*
+ * The weak notify is just a convenient hook into object destruction so
+ * we can clear out our signal handlers and strong ref; see below.
+ */
+ GObjectAPI.gobj.g_object_weak_ref(this, weakNotify, null);
+
+ /*
+ * Normally we have a strong reference given to us by constructors,
+ * GValue property gets, etc. So here we unref, leaving the toggle
+ * reference we just added.
+ *
+ * An example case where we don't own a ref are C convenience getters -
+ * need to ensure those are annotated with (transfer none).
+ */
+ if (init.ownsRef) {
+ GObjectAPI.gobj.g_object_unref(this);
+ }
+ }
+
+ private static Initializer getInitializer(GType gtype, Object[] args) {
+ Object[] newArgs;
+ String firstProp = null;
+ if (args != null && args.length > 0) {
+ if ((args.length % 2) != 0)
+ throw new IllegalArgumentException("Number of construct parameters must be even");
+ firstProp = (String) args[0];
+ newArgs = new Object[args.length];
+ System.arraycopy(args, 1, newArgs, 0, args.length);
+ newArgs[args.length - 1] = null;
+ } else {
+ newArgs = new Object[1];
+ newArgs[0] = null;
+ }
+ return new Initializer(GObjectAPI.gobj.g_object_new(gtype, firstProp, newArgs));
+ }
+
+ protected GObject(GType gtype, Object[] args) {
+ this(getInitializer(gtype, args));
+ }
+
+ private static Initializer getInitializer(GType gtype, Map<String, Object> args) {
+ String firstProp = null;
+ Object[] newArgs = new Object[args.size() * 2];
+ int i = 0;
+ Iterator<Map.Entry<String, Object>> it = args.entrySet().iterator();
+ if (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+ firstProp = entry.getKey();
+ newArgs[i] = entry.getValue();
+ i++;
+ }
+ while (it.hasNext()) {
+ Map.Entry<String, Object> entry = it.next();
+ newArgs[i] = entry.getKey();
+ newArgs[i + 1] = entry.getValue();
+ i += 2;
+ }
+ newArgs[i] = null;
+ return new Initializer(GObjectAPI.gobj.g_object_new(gtype, firstProp, newArgs));
+ }
+
+ protected GObject(GType gtype, Map<String, Object> args) {
+ this(getInitializer(gtype, args));
+ }
+
+ /**
+ * Sets the value of a <tt>GObject</tt> property.
+ *
+ * @param property
+ * The property to set.
+ * @param data
+ * The value for the property. This must be an instance of a
+ * class which maps to the corresponding GType.
+ */
+ public void set(String property, Object data) {
+ GParamSpec propertySpec = findProperty(property);
+ if (propertySpec == null) {
+ throw new IllegalArgumentException("Unknown property: " + property);
+ }
+ final GType propType = propertySpec.value_type;
+
+ GValue propValue = new GValue(propType, data);
+ GObjectAPI.gobj.g_object_set_property(this, property, propValue);
+ propValue.unset();
+ }
+
+ /**
+ * Gets the current value of a <tt>GObject</tt> property.
+ *
+ * @param property
+ * The name of the property to get.
+ *
+ * @return A java value representing the <tt>GObject</tt> property value.
+ */
+ public Object get(String property) {
+ GObjectAPI.GParamSpec propertySpec = findProperty(property);
+ if (propertySpec == null) {
+ throw new IllegalArgumentException("Unknown property: " + property);
+ }
+ final GType propType = propertySpec.value_type;
+ GValue propValue = new GValue(propType);
+ GObjectAPI.gobj.g_object_get_property(this, property, propValue);
+ return propValue.unboxAndUnset();
+ }
+
+ private static void handleDispose(GObject object) {
+ if (object.disposed)
+ return;
+ /* Make sure we're not holding a hidden strong ref anymore */
+ strongReferences.remove(object);
+ /* Clear out our signal handler references */
+ object.signalHandlers = null;
+ object.disposed = true;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ super.finalize();
+ /* If the native object already went away, we have nothing to do here. */
+ if (disposed)
+ return;
+ /* Take away the toggle reference */
+ debugMemoryFinal(this, "REMOVING TOGGLE %s %s%n");
+ GObjectAPI.gobj.g_object_remove_toggle_ref(getNativeAddress(), toggle, objectID);
+ }
+
+ public synchronized long connect(String signal, Callback closure) {
+ NativeLong connectID = GSignalAPI.gsignal.g_signal_connect_data(GObject.this, signal, closure, null, null, 0);
+ if (connectID.intValue() == 0) {
+ throw new IllegalArgumentException(String.format("Failed to connect signal '%s'", signal));
+ }
+ long id = connectID.longValue();
+ signalHandlers.put(id, closure);
+ return id;
+ }
+
+ public interface NotifyCallback extends Callback {
+ public final TypeMapper TYPE_MAPPER = GTypeMapper.getInstance();
+
+ public void onNotify(GObject object, GParamSpec param, Pointer data);
+ }
+
+ public synchronized long connectNotify(final String propName, final Callback callback) {
+ /*
+ * FIXME - need to hold this trampoline's lifecycle to the signal
+ * connection
+ */
+ NotifyCallback trampoline = new NotifyCallback() {
+ @Override
+ public void onNotify(GObject object, GParamSpec param, Pointer data) {
+ Method[] methods = callback.getClass().getDeclaredMethods();
+ if (methods.length != 1)
+ throw new RuntimeException(String.format("Callback %s must declare exactly one method", callback
+ .getClass()));
+ Method meth = methods[0];
+ meth.setAccessible(true);
+ Class<?>[] params = meth.getParameterTypes();
+ if (params.length != 2)
+ throw new RuntimeException(String.format("Callback %s entry must have exactly two parameters",
+ callback.getClass()));
+ Object propValue = get(propName);
+ try {
+ methods[0].invoke(callback, new Object[] { object, propValue });
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ };
+ return connect("notify::" + propName, trampoline);
+ }
+
+ public synchronized void disconnect(long id) {
+ Callback cb = signalHandlers.get(id);
+ if (cb == null)
+ throw new IllegalArgumentException("Invalid signal handler id:" + id);
+ GSignalAPI.gsignal.g_signal_handler_disconnect(GObject.this, new NativeLong(id));
+ signalHandlers.remove(id);
+ }
+
+ private GObjectAPI.GParamSpec findProperty(String propertyName) {
+ return GObjectAPI.gobj.g_object_class_find_property(getNativeAddress().getPointer(0), propertyName);
+ }
+
+ /*
+ * Hooks to/from native disposal. These callbacks are global statics, and
+ * should never themselves be GC'd.
+ */
+ private static final GToggleNotify toggle = new GToggleNotify() {
+ public void callback(Pointer data, Pointer ptr, boolean is_last_ref) {
+ /*
+ * Manage the strong reference to this instance. When this is the
+ * last reference to the underlying object, remove the strong
+ * reference so it can be garbage collected. If it is owned by
+ * someone else, then make it a strong ref, so the java GObject for
+ * the underlying C object can be retained for later retrieval
+ */
+ GObject o = (GObject) Internals.instanceFor(ptr);
+ if (o == null) {
+ return;
+ }
+ debugMemory(o, "TOGGLE NOTIFY %s %s %s%n", is_last_ref);
+ if (is_last_ref) {
+ strongReferences.remove(o);
+ } else {
+ strongReferences.put(o, Boolean.TRUE);
+ }
+ }
+ };
+
+ private static final GWeakNotify weakNotify = new GWeakNotify() {
+ @Override
+ public void callback(Pointer data, Pointer obj) {
+ GObject o = (GObject) Internals.instanceFor(obj);
+ NativeObject.Internals.debugMemoryFinal("WEAK %s target=%s%n", obj, o);
+ if (o == null)
+ return;
+ synchronized (o) {
+ handleDispose(o);
+ }
+ }
+ };
+}
Added: trunk/src/org/gnome/gir/runtime/GType.java
==============================================================================
--- (empty file)
+++ trunk/src/org/gnome/gir/runtime/GType.java Mon Dec 1 04:40:09 2008
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2008 Colin Walters <walters verbum org>
+ *
+ * This file is part of java-gobject-introspection.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307 USA.
+ *
+ */
+/*
+ * Copyright (c) 2007 Wayne Meissner
+ *
+ * This file was originally part of gstreamer-java; modified for use in
+ * jgir. By permission of author, this file has been relicensed from LGPLv3
+ * to the license of jgir; see below.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307 USA.
+ */
+
+package org.gnome.gir.runtime;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.gnome.gir.gobject.GObjectAPI;
+import org.gnome.gir.gobject.UnmappedPointer;
+import org.gnome.gir.repository.BaseInfo;
+import org.gnome.gir.repository.Repository;
+import org.objectweb.asm.Type;
+
+import com.sun.jna.Callback;
+import com.sun.jna.FromNativeContext;
+import com.sun.jna.NativeLong;
+import com.sun.jna.Pointer;
+
+/**
+ * GType is the fundamental building block of GObject. It provides
+ * runtime-accessible type information. GTypes can be full GObjects, or just
+ * boxed integers or structures.
+ *
+ * This class provides an API for accessing fundamental GTypes, as well as
+ * looking up the GType associated with a mapped GObject.
+ *
+ * @author walters
+ *
+ */
+public class GType extends NativeLong {
+ private static final long serialVersionUID = 1L;
+
+ private static final Map<GType, Class<?>> classTypeMap = new HashMap<GType, Class<?>>();
+
+ public static final String dynamicNamespace = "org/gnome/gir/dynamic/";
+
+ public static final Map<String, String> overrides = new HashMap<String, String>() {
+ private static final long serialVersionUID = 1L;
+
+ {
+ put("GLib.Value", "org/gnome/gir/gobject/GValue");
+
+ put("GLib.MainContext", "org/gnome/gir/gobject/GMainContext");
+ put("GLib.Closure", "org/gnome/gir/gobject/GClosure");
+ put("GLib.Quark", "org/gnome/gir/gobject/GQuark");
+ put("GLib.TimeVal", "org/gnome/gir/gobject/GTimeVal");
+ put("GLib.Scanner", "org/gnome/gir/gobject/GScanner");
+ put("GLib.OptionContext", "org/gnome/gir/gobject/GOptionContext");
+ put("GLib.OptionGroup", "org/gnome/gir/gobject/GOptionGroup");
+ put("GLib.OptionEntry", "org/gnome/gir/gobject/GOptionEntry");
+ put("GLib.String", "org/gnome/gir/gobject/GString");
+ put("GLib.Callback", "com/sun/jna/Callback");
+ put("GLib.Mutex", "org/gnome/gir/gobject/GlibAPI$GMutex");
+ put("GLib.StaticRecMutex", "org/gnome/gir/gobject/GlibAPI$GStaticRecMutex");
+ put("GLib.IOFunc", "org/gnome/gir/gobject/GIOFunc");
+ put("GLib.SourceFunc", "org/gnome/gir/gobject/GSourceFunc");
+
+ String[] glibPointerUnmapped = new String[] { "Mutex", "Cond", "FreeFunc", "DestroyNotify", "MarkupParser",
+ "SpawnChildSetupFunc", "Node", "CompareFunc", "KeyFile", "PtrArray", "Func", "ThreadPool",
+ "Source", "CompareDataFunc", "Array", "Data", "DataSet", "Date", "IOChannel", "Regex",
+ "MappedFile", "GList", "GSList" };
+ for (String unmapped : glibPointerUnmapped)
+ put("GLib." + unmapped, "org/gnome/gir/gobject/UnmappedPointer");
+ String[] glibIntegerUnmapped = new String[] { "SpawnFlags", "SeekType", "IOCondition", "RegexMatchFlags" };
+ for (String unmapped : glibIntegerUnmapped)
+ put("GLib." + unmapped, "java/lang/Integer");
+
+ put("GObject.Object", "org/gnome/gir/runtime/GObject");
+ put("GObject.Callback", "com/sun/jna/Callback");
+ put("GObject.InitiallyUnowned", "org/gnome/gir/runtime/GInitiallyUnowned");
+ put("GObject.Type", "org/gnome/gir/runtime/GType");
+ put("GObject.Value", "org/gnome/gir/runtime/GValue");
+ put("GObject.ParamSpec", "org/gnome/gir/gobject/GObjectAPI$GParamSpec");
+ put("GObject.Parameter", "org/gnome/gir/gobject/GObjectAPI$GParameter");
+ put("GObject.TypePlugin", "org/gnome/gir/gobject/GTypePlugin");
+ put("GObject.TypeModule", "org/gnome/gir/gobject/GTypeModule");
+ put("GObject.TypeClass", "org/gnome/gir/gobject/GObjectAPI$GTypeClass");
+ put("GObject.TypeQuery", "org/gnome/gir/gobject/GObjectAPI$GTypeQuery");
+ put("GObject.TypeInfo", "org/gnome/gir/gobject/GObjectAPI$GTypeInfo");
+ put("GObject.InterfaceInfo", "org/gnome/gir/gobject/GObjectAPI$GInterfaceInfo");
+ put("GObject.TypeValueTable", "org/gnome/gir/gobject/GObjectAPI$GTypeValueTable");
+ put("GObject.TypeFundamentalInfo", "org/gnome/gir/gobject/GObjectAPI$GTypeFundamentalInfo");
+ put("GObject.ObjectClass", "org/gnome/gir/gobject/GObjectAPI$GObjectClass");
+ put("GObject.InitiallyUnownedClass", "org/gnome/gir/gobject/GObjectAPI$GInitiallyUnownedClass");
+ put("GObject.TypeDebugFlags", "org/gnome/gir/gobject/GObjectAPI$GTypeDebugFlags");
+ put("GObject.TypeInstance", "org/gnome/gir/gobject/GObjectAPI$GTypeInstance");
+ put("GObject.TypeInterface", "org/gnome/gir/gobject/GObjectAPI$GTypeInterface");
+ put("GObject.String", "org/gnome/gir/gobject/GString");
+ put("GObject.HashTable", "org/gnome/gir/gobject/GHashTable");
+ put("GObject.Closure", "org/gnome/gir/gobject/GClosure");
+ put("GObject.SignalInvocationHint", "org/gnome/gir/gobject/GSignalAPI$GSignalInvocationHint");
+ put("GObject.EnumValue", "org/gnome/gir/gobject/GObjectAPI$GEnumValue");
+ put("GObject.EnumClass", "org/gnome/gir/gobject/GObjectAPI$GEnumClass");
+ put("GObject.FlagsValue", "org/gnome/gir/gobject/GObjectAPI$GFlagsValue");
+ put("GObject.FlagsClass", "org/gnome/gir/gobject/GObjectAPI$GFlagsClass");
+
+ String[] gobjectUnmapped = new String[] { "BaseInitFunc", "InstanceInitFunc", "SignalAccumulator",
+ "ClosureMarshal", "ClassInitFunc", "SignalEmissionHook", "IOChannel", "Date", "BaseFinalizeFunc",
+ "ClassFinalizeFunc", "ValueArray" };
+ for (String unmapped : gobjectUnmapped)
+ put("GObject." + unmapped, "org/gnome/gir/gobject/UnmappedPointer");
+ String[] gobjectIntegerUnmapped = new String[] { "SignalFlags", "ConnectFlags", "SignalMatchType",
+ "TypeFlags", "ParamFlags" };
+ for (String unmapped : gobjectIntegerUnmapped)
+ put("GObject." + unmapped, "java/lang/Integer");
+
+ for (String name : new String[] { "Context" }) {
+ put("Cairo." + name, "org/gnome/gir/gobject/UnmappedPointer");
+ }
+ }
+ };
+
+ public static String getInternalNameMapped(String namespace, String name) {
+ String key = namespace + "." + name;
+ String val = GType.overrides.get(key);
+ if (val != null)
+ return val;
+ if (namespace.equals("GLib") || namespace.equals("GObject"))
+ throw new RuntimeException(String.format("Unmapped internal ns=%s name=%s", namespace, name));
+ return getInternalName(namespace, name);
+ }
+
+ public static String getInternalName(String namespace, String name) {
+ String caps = name.substring(0, 1).toUpperCase() + name.substring(1);
+ return dynamicNamespace + namespace + "/" + caps;
+ }
+
+ public static String getPublicNameMapped(String namespace, String name) {
+ return getInternalNameMapped(namespace, name).replace('/', '.');
+ }
+
+ public static final void registerProxyClass(GType gtype, Class<?> klass) {
+ classTypeMap.put(gtype, klass);
+ };
+
+ /*
+ * If we haven't yet seen a GType, we do a full search of the repository.
+ * This is VERY slow right now, so it's cached.
+ */
+ public static synchronized final Class<?> lookupProxyClass(NativeLong g_type) {
+ Class<?> klass = classTypeMap.get(g_type);
+ if (klass != null)
+ return klass;
+ BaseInfo info = Repository.getDefault().findByGType(g_type);
+ if (info == null)
+ return null;
+ String klassName = getPublicNameMapped(info.getNamespace(), info.getName());
+ try {
+ klass = Class.forName(klassName);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ classTypeMap.put(new GType(g_type.longValue()), klass);
+ return klass;
+ }
+
+ public final Class<?> lookupProxyClass() {
+ return lookupProxyClass((NativeLong) this);
+ }
+
+ public static final GType objectPeekType(Pointer ptr) {
+ Pointer g_class = ptr.getPointer(0);
+ NativeLong g_type = g_class.getNativeLong(0);
+ return valueOf(g_type.longValue());
+ }
+
+ public static final Class<?> lookupProxyClass(Pointer ptr) {
+ GType gtype = objectPeekType(ptr);
+ return lookupProxyClass(gtype);
+ };
+
+ public static final void init() {
+ GObjectAPI.gobj.g_type_init();
+ }
+
+ private static final GType[] cache;
+ static {
+ cache = new GType[21];
+ for (int i = 0; i < cache.length; ++i) {
+ cache[i] = new GType(i << 2);
+ }
+ };
+ public static final GType INVALID = initFundamental(0);
+ public static final GType NONE = initFundamental(1);
+ public static final GType INTERFACE = initFundamental(2);
+ public static final GType CHAR = initFundamental(3);
+ public static final GType UCHAR = initFundamental(4);
+ public static final GType BOOLEAN = initFundamental(5);
+ public static final GType INT = initFundamental(6);
+ public static final GType UINT = initFundamental(7);
+ public static final GType LONG = initFundamental(8);
+ public static final GType ULONG = initFundamental(9);
+ public static final GType INT64 = initFundamental(10);
+ public static final GType UINT64 = initFundamental(11);
+ public static final GType ENUM = initFundamental(12);
+ public static final GType FLAGS = initFundamental(13);
+ public static final GType FLOAT = initFundamental(14);
+ public static final GType DOUBLE = initFundamental(15);
+ public static final GType STRING = initFundamental(16);
+ public static final GType POINTER = initFundamental(17);
+ public static final GType BOXED = initFundamental(18);
+ public static final GType PARAM = initFundamental(19);
+ public static final GType OBJECT = initFundamental(20);
+
+ private static GType initFundamental(int v) {
+ return valueOf(v << 2);
+ }
+
+ GType(long t) {
+ super(t);
+ }
+
+ public GType() {
+ super(0);
+ }
+
+ public static GType valueOf(long value) {
+ if (value >= 0 && (value >> 2) < cache.length) {
+ return cache[(int) value >> 2];
+ }
+ return new GType(value);
+ }
+
+ private static GType invokeGetGType(Class<?> klass) {
+ try {
+ return (GType) klass.getDeclaredMethod("getGType", new Class<?>[] {}).invoke(null, new Object[] {});
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static GType fromInstance(Object obj) {
+ if (obj instanceof Integer) {
+ return INT;
+ } else if (obj instanceof Long) {
+ return INT64;
+ } else if (obj instanceof Float) {
+ return FLOAT;
+ } else if (obj instanceof Double) {
+ return DOUBLE;
+ } else if (obj instanceof String) {
+ return STRING;
+ } else if (obj instanceof GObject || obj instanceof GObject.GObjectProxy) {
+ return objectPeekType(((GObject) obj).getNativeAddress());
+ } else if (obj instanceof GBoxed) {
+ return ((GBoxed) obj).getGType();
+ } else if (obj instanceof BoxedStructure || obj instanceof BoxedUnion) {
+ GType type;
+ if (obj instanceof BoxedStructure)
+ type = ((BoxedStructure) obj).getGType();
+ else
+ type = ((BoxedUnion) obj).getGType();
+ if (type.equals(GType.INVALID)) {
+ type = invokeGetGType(obj.getClass());
+ }
+ return type;
+ } else {
+ throw new IllegalArgumentException(String.format("Unhandled GType lookup for object %s", obj));
+ }
+ }
+
+ public GType getFundamental() {
+ return GObjectAPI.gobj.g_type_fundamental(this);
+ }
+
+ @Override
+ public Object fromNative(Object nativeValue, FromNativeContext context) {
+ return valueOf(((Number) nativeValue).longValue());
+ }
+
+ public GType getParent() {
+ return GObjectAPI.gobj.g_type_parent(this);
+ }
+
+ public String toString() {
+ return "GType(" + GObjectAPI.gobj.g_type_name(this) + ")";
+ }
+}
Copied: trunk/src/org/gnome/gir/runtime/GValue.java (from r142, /trunk/src/org/gnome/gir/gobject/GValue.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/GValue.java (original)
+++ trunk/src/org/gnome/gir/runtime/GValue.java Mon Dec 1 04:40:09 2008
@@ -43,11 +43,18 @@
* Boston, MA 02111-1307 USA.
*/
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
+
+import org.gnome.gir.gobject.EnumMapper;
+import org.gnome.gir.gobject.GValueAPI;
import com.sun.jna.NativeLong;
import com.sun.jna.Pointer;
+/**
+ * GValue is a the native GObject concept of a "boxed" value; i.e. a pair of data
+ * with metadata about its type.
+ */
public class GValue extends com.sun.jna.Structure {
/*< private >*/
public volatile GType g_type;
Copied: trunk/src/org/gnome/gir/runtime/MainLoop.java (from r142, /trunk/src/org/gnome/gir/gobject/MainLoop.java)
==============================================================================
--- /trunk/src/org/gnome/gir/gobject/MainLoop.java (original)
+++ trunk/src/org/gnome/gir/runtime/MainLoop.java Mon Dec 1 04:40:09 2008
@@ -43,7 +43,7 @@
* Boston, MA 02111-1307 USA.
*/
-package org.gnome.gir.gobject;
+package org.gnome.gir.runtime;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -54,6 +54,11 @@
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
+import org.gnome.gir.gobject.GMainContext;
+import org.gnome.gir.gobject.GSourceFunc;
+import org.gnome.gir.gobject.GlibAPI;
+import org.gnome.gir.gobject.GlibRuntime;
+import org.gnome.gir.gobject.RefCountedObject;
import com.sun.jna.Pointer;
Modified: trunk/stub-examples/Test.java
==============================================================================
--- trunk/stub-examples/Test.java (original)
+++ trunk/stub-examples/Test.java Mon Dec 1 04:40:09 2008
@@ -1,6 +1,5 @@
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -8,15 +7,14 @@
import org.gnome.gir.gobject.GErrorException;
import org.gnome.gir.gobject.GErrorStruct;
import org.gnome.gir.gobject.GList;
-import org.gnome.gir.gobject.GObject;
-import org.gnome.gir.gobject.GType;
import org.gnome.gir.gobject.GTypeMapper;
import org.gnome.gir.gobject.GlibRuntime;
import org.gnome.gir.gobject.NativeObject;
-import org.gnome.gir.gobject.annotation.Return;
import org.gnome.gir.repository.Direction;
import org.gnome.gir.repository.Repository;
import org.gnome.gir.repository.Transfer;
+import org.gnome.gir.runtime.GObject;
+import org.gnome.gir.runtime.GType;
import com.sun.jna.Callback;
import com.sun.jna.Function;
@@ -173,7 +171,6 @@
f.invoke(Void.class, args, Internals.invocationOptions);
}
- @Return(transfer=Transfer.NOTHING)
public static GObject getStage() {
return null;
}
Modified: trunk/stub-examples/TestAbs.java
==============================================================================
--- trunk/stub-examples/TestAbs.java (original)
+++ trunk/stub-examples/TestAbs.java Mon Dec 1 04:40:09 2008
@@ -1,6 +1,6 @@
-import org.gnome.gir.gobject.GObject.GObjectProxy;
+import org.gnome.gir.runtime.GObject.GObjectProxy;
public interface TestAbs extends GObjectProxy {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]