gtg icon indicating copy to clipboard operation
gtg copied to clipboard

Port to GTK4

Open ranchester2 opened this issue 2 years ago • 8 comments

Port GTG to GTK4 while keeping things the same. Highly recommended to not look at the entire diff but go through the commits individually.

Mentioning issue: https://github.com/getting-things-gnome/gtg/issues/533

Build with liblarch from here: https://github.com/ranchester2/liblarch/tree/gtk4 Liblarch changes are very minimal, however drag and drop will need to be changed a bit when it starts working in GTK

Mostly works, existing issues:

  • [x] Figure out how to recolor symbolic icons for dark mode in cell_renderer_tags NOTE: fix adds dependency on master sdk, which isn't available on Flathub, an alternative would be to bundle the latest GTK instead
  • [x] ~~cell_renderer_tags is slightly blurry~~ this is also an issue in master, not a gtk4 issue
  • [x] Harder to open right click menu for multi selection, you now have to shift+select and shift+right click instead of just right click
  • [x] .menu-disclose
  • [x] tags sidebar slightly tight spacing
  • [x] plugin about dialog markup
  • [ ] Figure out treeview drag and drop (EDIT: Treeview DND is completely broken in GTK4, GTK4 bug prevents this).

I think this is quite ready currently, however there is the treeview dnd issue that can't really be fixed at the moment. And this now uses the master SDK as GTK 4.5 is needed, this prevents releasing on Flathub with this until GNOME 42 is released (or bundle GTK)

Plugins:

  • [x] Export and print
  • [x] Send tasks via email
  • [x] Untouched tasks
  • [x] Urgency color
  • [x] Hamster
  • [x] Dev console
  • [x] Gamify

Window positions aren't restored, GTK4 removed this feature as the api is now based on Wayland, not X11.

I added a "Today" button to the startdate calendar as you can no longer receive events about selection of the currently selected date in GtkCalendar (nor can you not have any date selected)

gtg-gtk4-screenshot

ranchester2 avatar Nov 05 '21 22:11 ranchester2

Nice! I looked only at some commits for now, but they seemed fine. The commit messages are the cherry on top. I'd probably not merge this for the next release because this will take a while to review and test. (And this is still a draft PR for I just noticed) Also, I wonder if some early stuff can be applied to the current GTK3 version now so some of the changes can already be used and smaller chunks are a bit easier to review. Like making the TagEditor an GtkDialog now (I don't remember why I didn't do that...)

Neui avatar Nov 05 '21 22:11 Neui

Nice! I looked only at some commits for now, but they seemed fine. The commit messages are the cherry on top. I'd probably not merge this for the next release because this will take a while to review and test. (And this is still a draft PR for I just noticed) Also, I wonder if some early stuff can be applied to the current GTK3 version now so some of the changes can already be used and smaller chunks are a bit easier to review. Like making the TagEditor an GtkDialog now (I don't remember why I didn't do that...)

All commits before the update imports commit were for "preparing", and are for GTK3. (However the gmenu commit didn't port the hamster plugin). However I missed quite a lot of stuff there, as PyGObject seems to be really bad at printing deprecation warnings, so I fixed those things later. Later invisible changes could be backported probably, however probably not as-is

ranchester2 avatar Nov 06 '21 08:11 ranchester2

The main remaining issue with this is currently treeview drag and drop.

And that can't be really fixed as GTK broke it when inventing the new drag and drop api and it currently just doesn't work:

https://gitlab.gnome.org/GNOME/gtk/-/issues/3649 https://gitlab.gnome.org/GNOME/gtk/-/issues/4206 https://gitlab.gnome.org/GNOME/gtk/-/issues/3656 https://gitlab.gnome.org/GNOME/gtk/-/issues/3642

Maybe there should be an alternative way of adding parents for tags in the sidebar or reordering in the tree? However that will definitely be worse to use.

EDIT: the PyGObject override issue too, however that isn't really a problem and that override isn't more convenient in GTK4 anyway. That fix is basically done, just needs to be merged, the real issue is that in GTK itself it is broken.

ranchester2 avatar Nov 08 '21 12:11 ranchester2

On a related thing, it seems PyGObject also needs some fixes for gtk4 TreeView. Also I don't think you can "reoder" stuff anyway currently (minus parenting and un-parenting), but looking at your issue pages DnD looks like to be broken completely? We could hope that when we finally merge this PR that it'll be fixed by then...

Diegogangl started a branch https://github.com/getting-things-gnome/gtg/tree/ui_listboxes to migrate away from the TreeView widget, but doesn't seem to be complete however (and would need testing etc.)

(I am also wondering how keyboard-only users do parenting and unparenting?)

Neui avatar Nov 08 '21 13:11 Neui

A possible solution since there seem to be plans to drop treeview anyway, would maybe be to never actually fix treeview drag and drop, and instead not merge this until a port to the new list widgets is done? And then reimplement drag and drop with the non-treeview widgets that aren't broken. However that will definitely require very major changes.

ranchester2 avatar Nov 08 '21 13:11 ranchester2

Hey @ranchester2, thanks for working on this! It really takes a load off our backs :) Shame treeviews are being a problem again. Like @Neui said we don't support manual re-ordering, so DnD is only for parenting. Also I'm impressed we're at 4.2 and DnD is this broken still.

The plan is to eventually move to the new Gtk4 listviews based on the new core (#668). I started a branch to port to Gtk3 listboxes because I was getting impatient, but had to stop to fix some bugs and missing stuff in the new core instead. Also, I was wondering if neui's branch would be a better segway into Gtk4.

If DnD is the only limitation, we could merge this after we plug the new core during the 0.7 cycle. We'll have to accept a temporary regression in master until we complete the switch to listviews.

diegogangl avatar Nov 08 '21 13:11 diegogangl

Hey @ranchester2 could you also open a PR for your liblarch changes when you have some time? That way we can land those as soon as we're ready to land this one too

diegogangl avatar Dec 07 '21 23:12 diegogangl

Hey @ranchester2 , could you could open a PR for your liblarch port? Once we get the new core branches in, it would be nice to work on getting this landed. Then we can move on to newcore + list views

diegogangl avatar Mar 26 '22 23:03 diegogangl

Closing for now since this had +infinity conflicts, is based on an older version of Gtk and is superceded by the megaport branch

diegogangl avatar Aug 08 '23 22:08 diegogangl

For those wishing to help, the successor to this branch is #894

nekohayo avatar Aug 08 '23 22:08 nekohayo