Re: Stock Items Deprecation

On Wed, 2013-07-17 at 13:52 -0300, Juan Pablo Ugarte wrote:
On Wed, 2013-07-17 at 12:55 +0200, Murray Cumming wrote:
On Wed, 2013-07-17 at 11:23 +0100, Emmanuele Bassi wrote:
in general, GtkUIManager should be replaced by GtkBuilder, so that
could be added to the long description of the class instead of each
public entry point in the API.

Is there some way, as with GtkUIManager, to merge in, and later remove
and replace, menu items? I used this with GtkUIManager to dynamically
populate a menu with items not known at compile time.

No there is not, but as with any dynamic UI you can always fallback to
code. IIRC what I did with Glade was to use an action group for all the
dynamic content (project's items) so it is easy to distinguish with one
are autogenerated and need to be regenerated.
You can also use a separator or hidden item as an insertion point.
Of course all this needs some custom code and we should have a simple
way to do this.

Perhaps adding a simple api like this would let you easily know where to
start deleting/adding dynamic items

gtk_menu_shell_get_child_position (GtkMenuShell *menu_shell,
                                   GtkWidget *child);

I see gtk_builder_add_from_string(), but I don't see how to remove items
without destroying the entire GtkBuilder structure.

Anyway we need to improve menu building with GtkBuilder, we need to add
support for GAction/GMenuModel and all those classes.

What kind of thing is missing? I mean, what kind of code can't be
written now?

Actually, I noticed that the bloatpad example already uses GtkBuilder
and the GMenuModel API to dynamically get a menu from the GtkBuilder and
then add menu items via code, so I guess I'll do that. It's actually far
nicer than building a new GtkUIManager UI string at runtime and merging
it in.

murrayc murrayc com

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