Re: GTK3 menu bar
Hi; On Friday, July 31, 2015, Stefan Salewski m...@ssalewski.de wrote: On Thu, 2015-07-30 at 13:25 +0100, Emmanuele Bassi wrote: Hi; the preferred way to make a menu bar in GTK+ 3.x is to use GMenu and GAction: * https://wiki.gnome.org/HowDoI/GMenu Just to let you know: That cited wiki page is a plain copy of the original gnome developer page https://developer.gnome.org/GMenu/ I really wonder why people do that. It's the other way around: the static page is generated from the wiki. It's done this way because some people feel the wiki is less official than a static page, and to increase the Google page ranking and results. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK3 menu bar
On Thu, 2015-07-30 at 13:25 +0100, Emmanuele Bassi wrote: Hi; the preferred way to make a menu bar in GTK+ 3.x is to use GMenu and GAction: * https://wiki.gnome.org/HowDoI/GMenu Just to let you know: That cited wiki page is a plain copy of the original gnome developer page https://developer.gnome.org/GMenu/ I really wonder why people do that. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
GTK3 menu bar
I am still not really sure how to create a FINE pulldown menu bar. (http://ssalewski.de/PetEd.html.en) Currently I am still using this Ruby code, which originates from the initial GTK2 version and still works with GTK 3.14 -- I may have done some modifications for GTK3, can not really remember. == class PetedMenuItemStock Gtk::ImageMenuItem def initialize(menu, item, id) super(:label = nil, :mnemonic = nil, :stock_id = id, :accel_group = nil) self.accel_path = MenuWindowName + '/' + menu + '/' + item self.always_show_image = true modifier, keyval = Gtk::Stock.lookup(id)[2, 2] Gtk::AccelMap.add_entry(self.accel_path, keyval, modifier) end end class PetedMenuItemText Gtk::ImageMenuItem def initialize(menu, itemtext, keyval = nil, modifier = nil) super(:label = itemtext, :mnemonic = nil, :stock_id = nil, :accel_group = nil) self.accel_path = MenuWindowName + '/' + menu + '/' + itemtext if keyval and modifier Gtk::AccelMap.add_entry(self.accel_path, keyval, modifier) end end end == 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(). OK, plain text menu is easy with gtk_menu_item_new_with_label() described in https://developer.gnome.org/gtk3/stable/GtkMenuItem.html 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 have done some Google search for a fine GTK3 example, but was not really successful. The zetcode.com menu example is still GTK2, inkscape too, and tools like gedit have the new app layout style. ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK3 menu bar
Hi; 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 labels. On 30 July 2015 at 13:02, Stefan Salewski m...@ssalewski.de 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. Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK3 menu bar
Hi; On 30 July 2015 at 18:31, Stefan Salewski m...@ssalewski.de wrote: On Thu, 2015-07-30 at 13:25 +0100, Emmanuele Bassi wrote: Hi; 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 Thanks for that hint -- seems I missed that, more or less... The reason may be that I am generally looking for GTK docs, not for Gnome docs, so I often start at http://www.gtk.org/ www.gtk.org should just point to developer.gnome.org; they are on the same infrastructure anyway, and the documentation is automatically pushed there. Personally I do not really care much about Windows and Mac, but I know that GTK3 can be used on Windows. For all what is called GNOME I generally do not know if it has unmet dependencies for Mac and Window. As part of the consolidation effort for the core GNOME platform that was started mid-2.x, most of the GNOME dependencies are, these days, limited to GTK and its own dependencies. Generally speaking, anything that requires GTK should also work on MacOS and Windows. I just unpacked evolution 3.16.4 source code, one of the bigger tools that uses GTK3. grepping for g_menu or gtk_menu gives me currently only results for the later, so that one still ignores g-menu? Guess the menu is too large for GMenu? Not at all. Evolution has been ported to GTK 3.x early in the process, but most of its code base is old, huge, not heavily maintained, and thus slow moving, so it's not odd that it only uses older technologies. I personally would not take it as a shining example of a GTK 3 application. If you want to see a better use of the more recent GTK API, you should look at gedit instead. The whole set of core GNOME applications are also good examples of the GTK API in multiple languages: https://wiki.gnome.org/GnomeLove/CoreApps Ciao, Emmanuele. -- https://www.bassi.io [@] ebassi [@gmail.com] ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list
Re: GTK3 menu bar
On Thu, 2015-07-30 at 13:25 +0100, Emmanuele Bassi wrote: Hi; 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 Thanks for that hint -- seems I missed that, more or less... The reason may be that I am generally looking for GTK docs, not for Gnome docs, so I often start at http://www.gtk.org/ Personally I do not really care much about Windows and Mac, but I know that GTK3 can be used on Windows. For all what is called GNOME I generally do not know if it has unmet dependencies for Mac and Window. I just unpacked evolution 3.16.4 source code, one of the bigger tools that uses GTK3. grepping for g_menu or gtk_menu gives me currently only results for the later, so that one still ignores g-menu? Guess the menu is too large for GMenu? Best regards, Stefan Salewski ___ gtk-list mailing list gtk-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-list