Thread: [java-gnome-hackers] Tree/List widgets
Brought to you by:
afcowie
From: Mark H. <mh...@ti...> - 2002-08-23 17:04:35
Attachments:
hs_err_pid10334.log
|
hi, I've been working on these widgets. My initial aims were to implement the minimum methods required to get something to work. I have implemented these and written examples/gtk/tree/TreeExample.java to demonstrate them. Unfortunately, I am having trouble to get this to work. In order to get this far, I had to make a few changes to some glib classes: Type: renamed the jni ...get_STRING method to getSTRING in both the java and c files. (This will also have to be done with the other types) Value: Added temporary methods for assigning values to the object. The offending line in my test app appears to be: Value val = new Value( Type.STRING() ); and in Value: public Value(Type type) { int [] vptr = new int[1]; Value.g_value_init(vptr, type.getHandle()); handle = vptr[0]; } I've attached the full java output. I don't think the iter != null assertion is relevant to this particular error (the iter isn't involved in the value). However, it too is a strange error. There is no way of creating a new TreeIter. list_store_append should create and return the iter. Also, on a different note, How do I get access to the properties of the objects (I don't really know much c). Take GtkCellRendererText for example; This has no get/set methods, but has many read/write properties. I assume something has to be added to the jni files. -- +----------------------------------------------+ | Mark Howard cam.ac.uk mh344@ | | http://www.tildemh.com tildemh.com mh@ | +----------------------------------------------+ |
From: Mark H. <mh...@ti...> - 2002-08-24 10:18:35
|
On Fri, 2002-08-23 at 17:46, Mark Howard wrote: > public Value(Type type) { > int [] vptr =3D new int[1]; > Value.g_value_init(vptr, type.getHandle()); > handle =3D vptr[0]; > } Has anyone successfully used the glib.Value object?=20 The gtk reference says: GValue* g_value_init (GValue *value, GType g_type); Initializes value with the default value of type. value : A zero-filled (uninitialized) GValue structure. g_type : Type the GValue should hold values of. Returns : <no comment> The JNI code, however, uses the return statement: /* * Class: org.gnu.glib.Value * Method: g_value_init * Signature: ([Lint ;I)I */ JNIEXPORT jint JNICALL Java_org_gnu_glib_Value_g_1value_1init (JNIEnv *env, jclass cls,=20 jintArray value, jint type)=20 { gint *value_g_g =3D (gint *) (*env)->GetIntArrayElements (env, value, NULL); GValue *value_g =3D (GValue *)value_g_g; GType type_g =3D (GType)&type; { return (jint)g_value_init (value_g, type_g); } } Although this return value is ignored in the java code: /** * Construct a new Value from a given org.gnu.glib.Value. */ public Value(Type type) { int [] vptr =3D new int[1]; Value.g_value_init(vptr, type.getHandle()); handle =3D vptr[0]; } Could someone who knows more about this please check it and either confirm that the Value code is correct or try to fix it. Thanks --=20 +----------------------------------------------+ | Mark Howard cam.ac.uk mh344@ | | http://www.tildemh.com tildemh.com mh@ | +----------------------------------------------+ |
From: Jeffrey M. <ku...@zo...> - 2002-08-24 13:36:09
|
I will look into this over the weekend. On Sat, 2002-08-24 at 06:00, Mark Howard wrote: > On Fri, 2002-08-23 at 17:46, Mark Howard wrote: > > public Value(Type type) { > > int [] vptr = new int[1]; > > Value.g_value_init(vptr, type.getHandle()); > > handle = vptr[0]; > > } > > Has anyone successfully used the glib.Value object? > > The gtk reference says: > GValue* g_value_init (GValue *value, > GType g_type); > Initializes value with the default value of type. > value : A zero-filled (uninitialized) GValue structure. > g_type : Type the GValue should hold values of. > Returns : <no comment> > > > The JNI code, however, uses the return statement: > /* > * Class: org.gnu.glib.Value > * Method: g_value_init > * Signature: ([Lint ;I)I > */ > JNIEXPORT jint JNICALL Java_org_gnu_glib_Value_g_1value_1init (JNIEnv > *env, jclass cls, > jintArray value, jint type) > { > gint *value_g_g = (gint *) (*env)->GetIntArrayElements (env, value, > NULL); > GValue *value_g = (GValue *)value_g_g; > GType type_g = (GType)&type; > { > return (jint)g_value_init (value_g, type_g); > } > } > > > Although this return value is ignored in the java code: > /** > * Construct a new Value from a given org.gnu.glib.Value. > */ > public Value(Type type) { > int [] vptr = new int[1]; > Value.g_value_init(vptr, type.getHandle()); > handle = vptr[0]; > } > > Could someone who knows more about this please check it and either > confirm that the Value code is correct or try to fix it. > > Thanks > -- > > +----------------------------------------------+ > | Mark Howard cam.ac.uk mh344@ | > | http://www.tildemh.com tildemh.com mh@ | > +----------------------------------------------+ |
From: Mark H. <mh...@ti...> - 2002-08-30 10:58:52
|
On Sat, 2002-08-24 at 14:35, Jeffrey Morgan wrote: > I will look into this over the weekend. did you get anywhere with this? or has anybody else got any ideas? >=20 > On Sat, 2002-08-24 at 06:00, Mark Howard wrote: > > On Fri, 2002-08-23 at 17:46, Mark Howard wrote: > > > public Value(Type type) { > > > int [] vptr =3D new int[1]; > > > Value.g_value_init(vptr, type.getHandle()); > > > handle =3D vptr[0]; > > > } > >=20 > > Has anyone successfully used the glib.Value object?=20 > >=20 > > The gtk reference says: > > GValue* g_value_init (GValue *value, > > GType g_type); > > Initializes value with the default value of type. > > value : A zero-filled (uninitialized) GValue structure. > > g_type : Type the GValue should hold values of. > > Returns : <no comment> > >=20 > >=20 > > The JNI code, however, uses the return statement: > > /* > > * Class: org.gnu.glib.Value > > * Method: g_value_init > > * Signature: ([Lint ;I)I > > */ > > JNIEXPORT jint JNICALL Java_org_gnu_glib_Value_g_1value_1init (JNIEnv > > *env, jclass cls,=20 > > jintArray value, jint type)=20 > > { > > gint *value_g_g =3D (gint *) (*env)->GetIntArrayElements (env, valu= e, > > NULL); > > GValue *value_g =3D (GValue *)value_g_g; > > GType type_g =3D (GType)&type; > > { > > return (jint)g_value_init (value_g, type_g); > > } > > } > >=20 > >=20 > > Although this return value is ignored in the java code: > > /** > > * Construct a new Value from a given org.gnu.glib.Value. > > */ > > public Value(Type type) { > > int [] vptr =3D new int[1]; > > Value.g_value_init(vptr, type.getHandle()); > > handle =3D vptr[0]; > > } > >=20 > > Could someone who knows more about this please check it and either > > confirm that the Value code is correct or try to fix it. > >=20 > > Thanks > > --=20 --=20 +----------------------------------------------+ | Mark Howard cam.ac.uk mh344@ | | http://www.tildemh.com tildemh.com mh@ | +----------------------------------------------+ |