Re: [Vala] uint8[] GObject properties
- From: Abderrahim Kitouni <a kitouni gmail com>
- To: "W. Michael Petullo" <mike flyn org>
- Cc: vala-list gnome org
- Subject: Re: [Vala] uint8[] GObject properties
- Date: Sat, 22 Jan 2011 23:23:50 +0100
Hello,
في خ، 20-01-2011 عند 22:13 -0600 ، كتب W. Michael Petullo:
I have written a GObject class that has the following property:
[...]
private uint8[] _thumbnail;
[...]
public uint8[] thumbnail {
get { return _thumbnail; }
set { _thumbnail = value; }
}
[...]
When I run my application, I see:
(lt-dpapview:13731): GLib-GObject-WARNING **: g_object_set_valist:
object class `ValaDPAPRecord' has no property named `thumbnail'
But, if I replace uint8[] with string, then I see no such error at
runtime.
When I inspect the generated C source, I find that there is no reference
to thumbnail in _get and _set_property() when it is declared as a uint8[].
Is this expected?
Yes, not all properties are registered with gobject. I don't know if
this is documented somewhere, but here is the source code:
http://git.gnome.org/browse/vala/tree/codegen/valagobjectmodule.vala#n695
In short, it won't be registered if it is private or static, if it is a
delegate with target, _if it is an array_ (except for string[]), or if
it is a struct that isn't registered with gtype.
You should be able to use _get_thumbnail and _set_thumbnail from C, it's
just that you cannot use g_object_set and g_object_get.
What type should be used for properties that hold
binary data, possibly read using GLib.FileUtils.get_data()?
That's a good question, to which I have no answer. uint8[] started being
used systematically for "binary data" only recently, so I doubt you'll
find a definitive answer. You can create a "wrapper" type (i.e. a struct
containing it as it's only field), but there may be there is a better
way.
HTH,
Abderrahim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]