Gtk3::Stock->add: need an array ref to convert to GArray

Hi all

I try to translate the C code of app_main_window.c (out of package gtk-demo)
into Perl.

Original code:

    static GtkStockItem items[] = {
      { "demo-gtk-logo",
        0, 0, NULL }

    registered = TRUE;

    /* Register our stock items */
    gtk_stock_add (items, G_N_ELEMENTS (items));

Perl Code:
    my $items = [
        ["demo-gtk-logo", "_GTK!", 0, 0] ,

    $registered = 1;

    # Register our stock items

    Gtk3::Stock->add ($items);

This gives the error
"need an array ref to convert to GArray" when calling the function Gtk3::Stock->add

Well, $items is an array reference and I don't see what's wrong with it.

In the documentation of Glib::Object::Introspection
in chapter "Converting a Perl variable to a GValue" I see:
      my $type = ...; # somehow get the package name that
                      # corresponds to the correct GType
      my $real_value =
         Glib::Object::Introspection::GValueWrapper->new ($type, $value);
         # now use Glib::Object::Introspection->invoke and
         # substitute $real_value where you'd use $value
but this does not help. I always get an error "Could not find GType for '<myType>'".
<myType> = GArray, GArray*, gpointer, Glib.Array, ...

What's the correct value for $type in my case?

Any hints are appreciated.

Thank you,

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