[Gtk-sharp-list] ItemFactory initial work and issues

Artem Popov artemis@yandex.ru
Fri, 15 Aug 2003 09:10:27 +0400 (MSD)


--------------Boundary-00=_FDANFH7XFQQMYJ0CCJD0
Content-Type: text/plain;
  charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hi, I've recently tried to make ItemFactory work, but I've faced several issues:

I've created an array hint for CreateItems and made it hidden (so that there's only
one custom method without n_entries).

Added to Gtk.Metadata
-------------------------------------------
<!-- array hint -->
<rule>
  <class name="GtkItemFactory">
  <method>CreateItems</method>
  </class>
  <data>
    <attribute target="param">
      <filter level="name">entries</filter>
      <name>array</name>
      <value>1</value>
    </attribute>
  </data>
</rule>

<!-- hide method -->
<rule>
  <class name="GtkItemFactory">
  <method>CreateItems</method>
  </class>
  <data>
    <attribute target="method">
      <name>hidden</name>
      <value>1</value>
    </attribute>
  </data>
</rule>
-------------------------------------------
then I created a custom constructor for ItemFactoryEntry
(only without extra_data field that needs to be converted from either
pixbuf stream of string to pointer (for image and stock items))

both ItemFactory and ItemFactoryEntry .custom files are attached.

then I initialize the ItemFactoryEntry array like:

static ItemFactoryEntry items[] = {
        new ItemFactoryEntry ("/_File", etc...), // "/_File" goes to items[0].path
        ...
};

but CreateItems fails with lots of assertions on the console that look like
"entry->path[0] != '/'"
however when I create exactly one FactoryEntry struct and call CreateItem
everything works somehow.
I cannot figure out why this is so, methods in other classes work great
with struct arrays, so why this one fails?

Regards,
Artem
--------------Boundary-00=_FDANFH7XFQQMYJ0CCJD0
Content-Disposition: attachment;
  Filename="ItemFactory.custom"
Content-Type: application/octet-stream;
  name="ItemFactory.custom"
Content-Transfer-Encoding: base64

W0RsbEltcG9ydCgibGliZ3RrLXdpbjMyLTIuMC0wLmRsbCIpXQpzdGF0aWMgZXh0ZXJuIHZvaWQg
Z3RrX2l0ZW1fZmFjdG9yeV9jcmVhdGVfaXRlbXMoSW50UHRyIHJhdywgdWludCBuX2VudHJpZXMs
IEd0ay5JdGVtRmFjdG9yeUVudHJ5W10gZW50cmllcywgSW50UHRyIGNhbGxiYWNrX2RhdGEpOwoK
cHVibGljIHZvaWQgQ3JlYXRlSXRlbXMgKEd0ay5JdGVtRmFjdG9yeUVudHJ5W10gZW50cmllcywg
SW50UHRyIGNhbGxiYWNrX2RhdGEpCnsKCWd0a19pdGVtX2ZhY3RvcnlfY3JlYXRlX2l0ZW1zIChI
YW5kbGUsICh1aW50KSBlbnRyaWVzLkxlbmd0aCwgZW50cmllcywgY2FsbGJhY2tfZGF0YSk7Cn0K


--------------Boundary-00=_FDANFH7XFQQMYJ0CCJD0
Content-Disposition: attachment;
  Filename="ItemFactoryEntry.custom"
Content-Type: application/octet-stream;
  name="ItemFactoryEntry.custom"
Content-Transfer-Encoding: base64

cHVibGljIEl0ZW1GYWN0b3J5RW50cnkgKHN0cmluZyBwYXRoLCBzdHJpbmcgYWNjZWxlcmF0b3Is
IEludFB0ciBjYWxsYmFjaywgdWludCBjYWxsYmFja19hY3Rpb24sIHN0cmluZyBpdGVtX3R5cGUp
CnsKCXRoaXMucGF0aCA9IHBhdGg7Cgl0aGlzLmFjY2VsZXJhdG9yID0gYWNjZWxlcmF0b3I7Cgl0
aGlzLmNhbGxiYWNrID0gY2FsbGJhY2s7Cgl0aGlzLmNhbGxiYWNrX2FjdGlvbiA9IGNhbGxiYWNr
X2FjdGlvbjsKCXRoaXMuaXRlbV90eXBlID0gaXRlbV90eXBlOwoJdGhpcy5leHRyYV9kYXRhID0g
SW50UHRyLlplcm87IC8vIG5lZWRzIHRvIGJlIGNvbnZlcnRlZCB0byBwb2ludGVyIGZyb20KCSAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBwaXhidWYgb3Igc3RyaW5nIChmb3IgaW1h
Z2UgYW5kIHN0b2NrIGl0ZW1zKQp9Cg==

--------------Boundary-00=_FDANFH7XFQQMYJ0CCJD0--