After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 758722 - Port to GAction, move away from GtkUIManager/GtkAction
Port to GAction, move away from GtkUIManager/GtkAction
Status: RESOLVED OBSOLETE
Product: gnome-latex
Classification: Other
Component: general
unspecified
Other Linux
: Normal enhancement
: unspecified
Assigned To: LaTeXila maintainer(s)
LaTeXila maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-11-26 20:50 UTC by Sébastien Wilmet
Modified: 2018-02-23 16:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtef-menu-bar.c (4.02 KB, text/plain)
2016-11-02 15:48 UTC, Sébastien Wilmet
Details
gtef-menu-bar.h (1.98 KB, text/plain)
2016-11-02 15:48 UTC, Sébastien Wilmet
Details

Description Sébastien Wilmet 2015-11-26 20:50:49 UTC
To be GTK+ 4-ready, LaTeXila needs to be ported to GAction/GMenu instead of GtkAction/GtkUIManager.

This can be done in incremental steps:
1. Implement the actions as GActions and activate them from the GtkActionEntry callbacks.
2. Create the toolbars manually (I think a toolbar cannot be created automatically from a GMenu). When a toolbar icon is clicked, the GAction is activated.
3. Port to GMenu.
Comment 1 Sébastien Wilmet 2016-01-31 11:09:06 UTC
When doing the port, there will be a problem with the 'Open Recent' menu. It is currently not easily possible to add that submenu with GMenu/GAction. See bug #707422.

The 'Open Recent' menu will probably need to be replaced by what is available in the GtkFileChooserDialog. And in the toolbar, have something like in gedit (the gedit source code should be made more re-usable first).
Comment 2 Sébastien Wilmet 2016-10-26 14:30:39 UTC
There has been a fundraising, so assign the bug to myself.

https://people.gnome.org/~swilmet/latexila/support.html
Comment 3 Sébastien Wilmet 2016-11-02 15:21:37 UTC
In LaTeXila, when a menu item is selected, a longer description is shown in the statusbar. Implementing that with GMenu is currently not (easily) possible.

What I've tried is to use gtk_menu_shell_bind_model(), because the documentation talks about GtkActionable being implemented on the menu items. By connecting to the GtkMenuItem::select and ::deselect signals, calling gtk_actionable_get_action_name() and then retrieving the long description from a hash table (action name -> long description). But gtk_actionable_get_action_name() returns NULL, so it doesn't work.

From a GtkMenuBar, to connect to the GtkMenuItem::select and ::deselect signals, there are GtkMenuShell::insert, GtkContainer::removed and listing the direct children with gtk_container_get_children(). I started to write a subclass of GtkMenuBar that does that, to provide the higher-level signals ::menu-item-selected and ::menu-item-deselected.

Even if gtk_actionable_get_action_name(menu_item) returns the correct action name after calling gtk_menu_shell_bind_model(), I'm not sure it was a great solution to implement placeholders. For example to integrate a GtkRecentChooserMenu.
Comment 4 Sébastien Wilmet 2016-11-02 15:48:10 UTC
Created attachment 338962 [details]
gtef-menu-bar.c

Subclass of GtkMenuBar to receive the GtkMenuItem::select and ::deselect signals. Can be useful in the future, keep a copy in bugzilla.
Comment 5 Sébastien Wilmet 2016-11-02 15:48:47 UTC
Created attachment 338963 [details]
gtef-menu-bar.h
Comment 6 Sébastien Wilmet 2017-03-05 14:35:15 UTC
I've made a lot of progress in the Gtef library:
https://github.com/swilmet/gtef

(compile with --enable-gtk-doc, see the classes under the "Actions and Menus" section)

I can now create a menu easily (programmatically, not with an XML file unfortunately, but it's possible to write readable code if each submenu is split in its own function). With the long descriptions shown in the statusbar.

A GtkRecentChooserMenu can be added, with the full paths shown in the statusbar (that's better than with GtkUIManager!).

It is not yet used in LaTeXila, it is used in gCSVedit (much smaller app that already used GAction).
Comment 7 Sébastien Wilmet 2017-07-20 11:52:32 UTC
New progress report:
https://blogs.gnome.org/swilmet/2017/07/20/amtk-actions-menus-and-toolbars-kit-for-gtk/
Comment 8 GNOME Infrastructure Team 2018-02-23 16:24:45 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-latex/issues/33.