GNOME Bugzilla – Bug 729735
Latex plugin does not work with gedit 3.12
Last modified: 2019-02-22 03:41:54 UTC
Gedit did a great leap forward with 3.12... gedit-latex is lagging slightly behind! I spent a couple of hours writing some horrible code which restores the minimum of functionality that I need for my daily work: actions and tools are listed in the gear menu (even when they shouldn't), and tools (including their accelerators) even work, but without any feedback (the bottom panel is disabled). Because of its ugliness, my code is not even good as a start, but if somebody finds the time to work on this issue it may possibly provide some hints on what need to be adapted, so here are the changes: http://www.pietrobattiston.it/gitweb?p=gedit-latex.git;a=commit;h=07a1a94383fcb85731615ca45da981ad5ca43513 ... which can also be pulled with git clone git://pietrobattiston.it/gedit-latex cd gedit-latex git checkout origin/towards_3_12 -b towards_3_12 I personally don't have a clear idea on how much work is needed for the real upgrade, and probably it is out of my possibilities, but I plan to at least rewrite what I did so far to make it less gratuitously hackish, and possibly push a new branch to git.gnome with the result. That said, few issues worth mentioning: - some design choices may be needed. pbor in #gedit suggested that we may want to position the toolbar _inside_ the tab rather than over it (after all, buttons are doc-specific): "I am not sure if you want to pack it in the parent (which is ViewFrame) or instead it is better to walk up the hierarchy until you find GeditTab". This would require some thinking, but the idea seems good to me. - I didn't investigate, but I guess all code in file.py could be dropped in favour of GFile - this may be a good occasion to _really_ use external_tools (see branch "remove_tools")
Created attachment 285136 [details] [review] Fix for 3.12 Hi! I never noticed this bug until finished writing my patch to fix 3.12. So I did not check your code. This is similarly a straightforward and not very beautiful attempt to fix the problem. But here I got shortcuts and feedback working. I put toolbar below the tab (it can be improved upon) and a small set of other functions into menu. I duplicated tool actions in toolbar and menu so that shortcuts would work. My point is, maybe we could commit this crude fix now, so that the plugin works, and later improve the ugliness.
I created a fork on github: https://github.com/jimmytheneutrino/gedit-latex/compare/GNOME:master...master
Note that there is also the LaTeXila application: https://wiki.gnome.org/Apps/LaTeXila With the plan to make the gedit source code more reusable, LaTeXila could use more code coming from gedit for the text editor part.
(In reply to comment #3) > Note that there is also the LaTeXila application: > https://wiki.gnome.org/Apps/LaTeXila > > With the plan to make the gedit source code more reusable, LaTeXila could use > more code coming from gedit for the text editor part. While I appreciate your approach: your points about more specific usability are valid, and also an app does not depend so much on the future choices made for gedit and gnome (which can hypothetically remove the plugin system altogether), I think that this plugin still very much deserves the right to live:). It is a very good plugin, it can be easily modified to suit some specific needs by hacking in or out a few python lines, it needs less code (you do admit that you reinvent a wheel with LaTeXila with respect to editor code), hopefully it will remain modern as long as gedit will remain so. @devs Can we expect anybody anysoon to look upon the patch/commit it?
Please consider compatibility with gedit 3.14 also
I'm looking at Aleksei's patch. It uses Gtk.Actions for the toolbar, while I had tried to make the switch to Gio.Actions, so I'm trying to merge the best of my approach and his. But I will give up and push his patch with minimal adjustements if I don't get acceptable results in a matter of days.
Pietro, Aleksei's patch already is using Gio.Actions (look at the simpleactions): this part of the commit is more or less ok, but we need to remove all the dead code before pushing this to git master.
Sorry José, could you be more specific about "all the dead code"? Apart from that: the toolbar is currently based on UiManager and Gtk.Actions, which are obsoleted. But I agree that this is not urgent - and I don't have the code in front of me now to check how much the two migrations overlap. In any case I will post a patch/push a separate branch and wait for comments. (I will also see if I can install and test with 3.13.91)
I mean that Aleksei's patch is already replacing old the old UI manager and gtk action stuff by hooking into new simpleactions and so, but without removing the obsolete code. so to merge this patch this should be done first.
There must be something big I'm missing... to my eyes, the items appearing in the toolbar are only listed in "ui-toolbar-normal.builder", which is parsed with a UIManager (windowactivatable.py, line 196). This list should be encoded in the glade file instead, since (correct me if I'm wrong) the XML definition of toolbars is itself obsoleted. (The menu for sure relies on SimpleActions.)
Yeah, Pietro is right. The toolbar is still made via UIManager and hence uses Gtk.Actions. But in order to get shortcuts working (and also to put actions into menu) I added SimpleActions (they actually duplicate GtkActions now). Once someone translates ui-toolbar-normal.builder to a format usable by GtkBuilder, he can probably get rid of GtkActions and UIManager.
See this delta to my previous patch https://github.com/jimmytheneutrino/gedit-latex/commit/019725bea02151a833835a9aba8c82a55cea57f8 for the minimal fix for gedit 3.14. And see https://bugzilla.gnome.org/show_bug.cgi?id=737781 why one has to temporarily change tools-section to preferences-section.
I am progressing with a Gio.Action based version... but slowly. So in the meanwhile I applied some small fixes to Aleksei's patch, and pushed a branch: https://git.gnome.org/browse/gedit-latex/log/?h=pietro-on-jimmy-3-14 If nobody objects within few days, it will be merged in master, and I will ask someone to make a release. Notice it spits out many warnings. Also notice that the position of the toolbar (bottom) is merely due to the fact that placing it there is simple, while my target is instead to finally stabilize it _inside_ the tab, just under the tab label.
I have created a Fedora package of this branch. Please test https://admin.fedoraproject.org/updates/FEDORA-2014-13131/gedit-latex-3.8.0-7.20141017git8e9970b.fc21
pietro-on-jimmy-3-14 merged in master. I think it is time for a release. But please do test and report bugs.