Web lists-archives.com

Re: GTK3 menu bar


the preferred way to make a menu bar in GTK+ 3.x is to use GMenu and GAction:

 * https://wiki.gnome.org/HowDoI/GMenu
 * https://wiki.gnome.org/HowDoI/GAction

There are various, incremental examples in the C API reference:

 * https://developer.gnome.org/gtk3/stable/ch01s04.html

If you want to build your menu bar by hand — which has not been
recommended since the introduction of GtkBuilder in 2.x — you will
have to build everything by hand, including icons and accelerator

On 30 July 2015 at 13:02, Stefan Salewski <mail@xxxxxxxxxxxx> wrote:

> But I guess I should fix it for latest GTK3: On the fly modifying
> keyboard shortcuts is not supported in GTK3, and icons are deprecated,
> same for gtk_stock_lockup().

Icons are not deprecated. Stock items are deprecated, and
GtkImageMenuItem is deprecated, but you can still add icons to your
menu items, and GMenu allows you to specify an icon in the XML
description. You're strongly encouraged to use icons for objects
(links, files, file types, bookmarks) and *not* to use icons for
actions — it's just overloading the user with small, hard to read, and
hard to differentiate pictograms, when the text and position in the
menu are more recognisable.

> But have I really to use gtk_accel_map_add_entry() to manually set
> keyboard accelerators for menu items? Currently I get these values with
> gtk_stock_lookup(). And now? Where can I find the correct values for
> "save", "load", "quit" menu text?  Or are accelerators deprecated too
> now?

I assume you're referring to mnemonics (the underlined glyph in the
menu label); accelerators are the modifier + key combination, like
Ctrl + S.

Neither has been deprecated, and you can define your own in both
cases. What is deprecated is the stock "_Save" label, because it does
not (and cannot, for obvious reasons) account for collisions of
mnemonics, in multiple languages.

Application developers are strongly encouraged in choosing their own
mnemonics, and translators will be able to choose the right
alternative depending on the application. The tool kit (and the tool
kit translators) cannot do this in any sensible way.


[@] ebassi [@gmail.com]
gtk-list mailing list