java-gobject-introspection r125 - in trunk/src/org/gnome/gir: gobject repository
- From: walters svn gnome org
- To: svn-commits-list gnome org
- Subject: java-gobject-introspection r125 - in trunk/src/org/gnome/gir: gobject repository
- Date: Sun, 16 Nov 2008 22:52:16 +0000 (UTC)
Author: walters
Date: Sun Nov 16 22:52:15 2008
New Revision: 125
URL: http://svn.gnome.org/viewvc/java-gobject-introspection?rev=125&view=rev
Log:
Make Repository a GObject
Modified:
trunk/src/org/gnome/gir/gobject/NativeObject.java
trunk/src/org/gnome/gir/repository/GIntrospectionAPI.java
trunk/src/org/gnome/gir/repository/Repository.java
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 Sun Nov 16 22:52:15 2008
@@ -175,8 +175,12 @@
throw new RuntimeException("Couldn't find Stub for interface: " + proxyClass);
}
- @SuppressWarnings("unchecked")
public static <T extends NativeObject> T objectFor(Pointer ptr, Class<T> cls, boolean ownsRef, boolean ownsHandle) {
+ return objectFor(ptr, cls, ownsRef, ownsHandle, true);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T extends NativeObject> T objectFor(Pointer ptr, Class<T> cls, boolean ownsRef, boolean ownsHandle, boolean peekGType) {
// Ignore null pointers
if (ptr == null) {
return null;
@@ -203,7 +207,7 @@
/* For GObject, read the g_class field to find
* the most exact class match
*/
- else if (GObject.class.isAssignableFrom(cls)) {
+ else if (peekGType && GObject.class.isAssignableFrom(cls)) {
cls = classFor(ptr, cls);
/* If it's abstract, pull out the stub */
if ((cls.getModifiers() & Modifier.ABSTRACT) != 0)
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 Sun Nov 16 22:52:15 2008
@@ -44,7 +44,8 @@
}
});
- Repository g_irepository_get_default();
+ GType g_irepostiory_get_type();
+ Pointer g_irepository_get_default();
void g_irepository_prepend_search_path(String path);
int g_irepository_get_n_infos(Repository repo, String namespace);
boolean g_irepository_is_registered (Repository repository, String namespace);
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 Sun Nov 16 22:52:15 2008
@@ -2,13 +2,18 @@
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 com.sun.jna.NativeLong;
-import com.sun.jna.PointerType;
import com.sun.jna.ptr.PointerByReference;
-public class Repository extends PointerType {
+public class Repository extends GObject {
+
+ public Repository(Initializer init) {
+ super(init);
+ }
private boolean disableRequires = false;
@@ -82,7 +87,8 @@
public static synchronized Repository getDefault() {
GObjectGlobals.init();
- return getNativeLibrary().g_irepository_get_default();
+ return (Repository) NativeObject.objectFor(getNativeLibrary().g_irepository_get_default(),
+ Repository.class, false, true, false);
}
public void unloadAll() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]