Gtk::ItemFactory, create_items

First off, I’m not having a problem here, other that tying to understand
how something is actually working.

I was writing a new GUI the other day, and was looking at a chunk of
code I generally just cut and paste into a new app and reuse part of it.
It is for the GtkItemFactory for the TYPE_MENU_BAR at the top of my App.
I started wondering exactly how it was working, I looked at the example
application that ships with Ruby/Gnome2, item_factory.rb and it brought
up a question.

I have a question on that. I’m looking at where it is building the
menu_items array to pass to create_items. My question is on the second
argument, the item_type arg. This is in the case when it is a type
.

In the Preferences/Color example:
Preferences/Color/Red uses
Preferences/Color/Green uses Preferences/Color/Red
Preferences/Color/Blue uses Preferences/Color/Red

However, on the Preferences/Shape example:
Preferences/Shape/Square uses
Preferences/Shape/Rectangle uses Preferences/Shape/Square
Preferences/Shape/Oval uses Preferences/Shape/Rectangle

So for the color, both subsequent ones “attach” to the Red.
But in the Shape example, subsequent ones “attach” to the previous one.

Either way, I don’t seem to see a difference in the how it looks. I just
noticed that alot of my stuff has it mixed up like this too. I never
noticed it before. Wondering what this is really suppose to be. The
documentation on Ruby/Gnome2 for class Gtk::ItemFactory says the
following on item_type

“item_type: GtkItemType?. A simple item when nil is given. If it is set
path, it is for a radio item to link against”

Here is an extract of the code, it is probably easier to just look at
the actual item_factory.rb file in the samples area.

menu_items = [
[’/_File’],
[’/File/tearoff1’,
‘’, nil, nil, ifactory_cb],
[’/File/_New’,
‘’, ‘N’, nil, ifactory_cb],
[’/File/_Open’,
‘’, ‘O’, nil, ifactory_cb],
[’/File/_Save’,
‘’, ‘S’, nil, ifactory_cb],
[’/File/Save _As…’,
‘’, nil, nil, ifactory_cb],
[’/File/sep1’, ‘’],
[’/File/_Quit’,
‘’, ‘Q’, nil, ifactory_cb],

[’/_Preferences’],
[’/_Preferences/_Color’],
[’/_Preferences/Color/_Red’, ‘’, nil, nil,
ifactory_cb],
[’/_Preferences/Color/_Green’, ‘/Preferences/Color/Red’, nil,
nil, ifactory_cb],
[’/_Preferences/Color/_Blue’, ‘/Preferences/Color/Red’, nil,
nil, ifactory_cb],
[’/_Preferences/_Shape’],
[’/_Preferences/Shape/_Square’, ‘’, nil, nil,
ifactory_cb],
[’/_Preferences/Shape/_Rectangle’, ‘/Preferences/Shape/Square’, nil,
nil, ifactory_cb],
[’/_Preferences/Shape/_Oval’, ‘/Preferences/Shape/Rectangle’,
nil, nil, ifactory_cb],

[’/_Help’, ‘’],
[’/Help/_About’, ‘’, nil, nil, ifactory_cb],
]
item_factory.create_items(menu_items)