Re: Stock Items Deprecation



On Wed, 2013-07-17 at 12:55 +0200, Murray Cumming wrote:
On Wed, 2013-07-17 at 11:23 +0100, Emmanuele Bassi wrote:
[snip]
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.
[snip]

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

gint
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.
The problem I see with this is that some of those classes
(GSimpleActionGroup for example) will have to implement GtkBuildable
which can not be done because its on another library.

So maybe it is time to move GtkBuilder to GLib
I guess we could rename GtkBuilder to GBuilder and move it to glib.
I am not sure if we can maintain ABI by making a new GtkBuilder class
derive from GBuilder. In any case we would also deprecate GtkBuilder.

so its a lot of work, and that is why Glade still does not support
GAction :(

cheers

JP




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