Re: Questions about tailoring libdmapsharing API to benefit GObject introspection



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)

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

The code is available with:

        git clone git://git.gnome.org/libdmapsharing

Here are the relavent parts of DMAP-3.2.git/DAAP-3.2.gir:

        <enumeration name="MediaKind"
                     glib:type-name="DMAPMediaKind"
                     glib:get-type="dmap_media_kind_get_type"
                     c:type="DMAPMediaKind">
                <member name="music"
                        value="1"
                        c:identifier="DMAP_MEDIA_KIND_MUSIC"
                        glib:nick="music">
                </member>
                <member name="movie"
                        value="2"
                        c:identifier="DMAP_MEDIA_KIND_MOVIE"
                        glib:nick="movie">
                </member>
                <member name="podcast"
                        value="32"
                        c:identifier="DMAP_MEDIA_KIND_PODCAST"
                        glib:nick="podcast">
                </member>
                <member name="tv_show"
                        value="64"
                        c:identifier="DMAP_MEDIA_KIND_TV_SHOW"
                        glib:nick="tv-show">
                </member>
        </enumeration>

        <property name="hash" writable="1" transfer-ownership="none">
                <type name="gpointer" c:type="gpointer"/>
        </property>

-- 
Mike

:wq


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