I am currently about to migrate Gnome Commander from the very deprecated GnomeUIInfo to GtkUIManager with the help of this document https://developer.gnome.org/gtk2/stable/migrating-gnomeuiinfo.html
This worked out for the toolbar and also for a static popup menu.
What I am missing is how I can create dynamic popups. For example, when someone right-clicks on a file, different entries in the popup menu should be shown, depending on user preferences which are not available at compile time. How is that solved using GtkUIManager and GtkActions? Unfortunately in the migration guide above this part is missing.
Can anyone here kindly point me to a simple example how a dynamic popup would be created in Gtk in C/C++? In particular, I am talking about a popup menu where its entries depend on the file which is clicked on in the file manager.
The minimum Gtk version of Gnome Commander is 2.18 at the moment. I do not consider to lift it to something of >=3.0. Hope that is possible.
Thank you very much and all the best
The typical way to achieve dynamic menus is to use
gtk_ui_manager_add_ui() with a defined identifier, and then call
gtk_ui_manager_remove_ui() when it’s time to change the menu. There is a demo in the GTK
Please, at least bump the requirement to GTK 2.24; anything prior to that is deeply unnecessary, and a ridiculous dependency. GTK 2.18 was released more than 11 years ago, and nothing should ship it. I mean: GTK 2 is basically dead, at this point—it will cease to see any further release and activity as soon as GTK 4.0 is out—but depending on 2.18 is basically pointless.
GtkUIManager is deprecated in GTK3, and has been removed in GTK4 in favour of
GMenu to describe menus. GTK4 also dropped all menu widgets, in favour of a declarative approach. Of course, you cannot use GMenu with GTK2, unless you create your own version of
Thank you for pointing me to those methods, Emmanuele! I will take a look into the example you provided.
Regarding the version: 2.18 is only the minimum dependency as there was no need to increase it from the code perspective. If the system on which Gnome Commander is built has a higher gtk2 version, there should be no problem. No?
Of course, but there should not be a system that ships a version of GTK2 earlier than 2.24, so depending on GTK 2.18 is just pointless.
Got it. I will lift the version in the next release.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.