Re: Questions about tailoring libdmapsharing API to benefit GObject introspection



On Sat, 2017-11-11 at 17:30 -0500, W. Michael Petullo wrote:
I am the maintainer of libdmapsharing, a GObject-based library. I am
just now getting around to adjusting the library's API to better suit
GObject introspection. I am not sure how to process on two things
having
to do with object properties.

One of my interfaces, the DAAPRecord, has among its properties two
items: hash, a GLib2 ByteArray/g_param_spec_pointer and mediakind, a
g_param_spec_enum. I am trying to implement an object of this
interface in
Python, but I am not sure how to proceed with either of these
properties.
(As I mentioned, I am willing to modify the libdmapsharing interface
to
facilitate this if necessary.)

I am not sure how to best handle hash. Should I create a box type? It
seems like the should be a straightforward approach to handle a
ByteArray.

Can you provide a link to the code in question, and a copy of the
relevant bit of the generated GIR file?

My first guess would be that you are right, and it should be a boxed
type. See the GTlsCertificate:certificate property for an example.

https://git.gnome.org/browse/glib/tree/gio/gtlscertificate.c#n106

For mediakind, I get a warning if I try this:

      class PyDAAPRecord((GObject.GObject, DAAP.Record, DMAP.Record):
            # ...
          mediakind = GObject.property(type=GObject.TYPE_INT,
default=0)

*snip*

That looks like more of a Python thing, which I can’t help with, sorry.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]