gtk_image_menu_item() API problems



Hi guys,

after trying to replace GtkPixmapMenuItems with GtkImageMenuItems
in GNOME 2 code, I realized several problems with its API:

1.) gtk_image_menu_item_new() doesn't allow you to pass NULL as label
    and there's no way to change the label later on. This is basically
    a minor issue, but it'd be nice if you could create the widget
    without an accelerator label and add/change it later on.

2.) gtk_image_menu_item_add_image() looks seriously broken to me for
    several reasons:

    a) there's an "image" property which you can use to actually change
       the icon (which is, btw. lacking an accessor function) which
       correctly handles the case if there's already an image set.

    b) gtk_image_menu_item_add_image() is not the accessor function of
       that property

    c) the name of the function is just wrong and does not match what it
       actually does - the name "add" implies that it actually adds
       something - and adding means adding, not changing or overriding.

    d) if you change the name to gtk_image_menu_item_set_item(), it's still
       not the same like setting that property. From looking at the code,
       calling gtk_image_menu_item_add_image() when there's already an image
       set doesn't seem to work.

So, I'd like to suggest the following:

i) allow the label argument of gtk_image_menu_item_new() be NULL and add
   a property for it.

ii) rename gtk_image_menu_item_add_image() to gtk_image_menu_item_set_image()
    and fix it so that it'll actually change an image.

How does that sound ?

-- 
Martin Baulig
martin gnome org (private)
baulig suse de (work)




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