Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk4 port #877

Draft
wants to merge 77 commits into
base: master
Choose a base branch
from
Draft

Gtk4 port #877

wants to merge 77 commits into from

Conversation

leolost2605
Copy link
Member

@leolost2605 leolost2605 commented Apr 19, 2023

As far as I know most features from the gtk3 version are now implemented. It still has some (mainly styling) issues (see below) and if there is anything that could still be back ported please tell me

GTK3:
image

GTK4:
image

A few general things:

  • SourceList was replaced with a ListView and a TreeListModel
  • VirtualizingListBox was replaced with a ListView

A few issues to note:

  • ReadMe wasn't updated yet (new deps: libadwaita, gtk4, libedataserverui4 >= 3.46.4, libedataserver >= 3.45.1, granite-7 >= 7.1, webkitgtk-6-dev)
  • Flatpak manifest wasn't updated yet
  • @danirabbit any suggestion on how to style the sidebar? Does it need to be exactly like the sourcelist was? Because currently it's way further indented because of how Gtk.TreeExpander handles indentation. This can be changed with GTK 4.10 however. It's probably best to make GTK 4.10 mandatory anyway because of some bugs it fixes with ListView. Also I don't know about the account icons I just added them because I thought they might look good :)
  • Some more styling issues, especially with the Gtk.Paned separators (at least for me) and the unread badges and their size and alignment (see TODOs). I'm gonna need some help with these :)
  • The menu for the conversations can't be activated with the menu key anymore (needed? I couldn't find an easy way to do this and make the menu appear at the right position, but it's definitely possible)
  • (I'm not sure whether Gravatars work, sometimes it seems so other times it doesn't but at least the UI won't freeze anymore.) I think they work now...
  • Position isn't remembered anymore. I heard it should be left to the window manager entirely so I don't know 🤷
  • Prompt for credentials if not found (E.CredentialsPrompter replacement ? Or did I miss something?) Turns out it's fixed in libedatserverui4 versions >= 3.46.4 (See this issue). Therefore revert changes to that.
  • Fix a crash on opening a context menu in a MessageListItem
  • Cleanup
  • Fix lint

Feedback and suggestions are always appreciated! 😀

Copy link
Member

@danirabbit danirabbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yeah, getting a lot closer! Left some comments as I was going through.

Is there any way we could land the new accounts list in the Gtk3 version or are we relying on features in Gtk4?

Unfortunately we're stuck with Gtk 4.6.6 until we rebase on Ubuntu 24.04 so we either have to wait until then to land the Gtk 4 port or stick with what is available in that version

public signal void finished ();

private const string ACTION_GROUP_PREFIX = "win";
private const string ACTION_PREFIX = ACTION_GROUP_PREFIX + ".";

private const string ACTION_ADD_ATTACHMENT= "add-attachment";
private const string ACTION_ADD_ATTACHMENT= "append-attachment";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a search/replace error 😅

@@ -18,17 +18,14 @@
* Authored by: Corentin Noël <corentin@elementary.io>
*/

public class Mail.MainWindow : Hdy.ApplicationWindow {
public class Mail.MainWindow : Adw.ApplicationWindow {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for this to be an Adw.ApplicationWindow instead of Gtk.ApplicationWindow?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adw.ApplicationWindow prevents the window manager (or is it gtk that does it? 😅) from adding the standard title bar. I am not sure whether that's the only way to do it but I don't think set_titlebar would work because we've got multiple HeaderBars.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah okay yeah, so the way we've been dealing with this in other places is set_titlebar (new Gtk.Grid () { visible = false });. I'm not sure if using Adw.ApplicationWindow will have any unintended consequences on styling etc

to_grid.add (to_val);
to_grid.add (cc_button);
to_grid.add (bcc_button);
var to_box = new EntryBox ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we don't need this since in Gtk 4 we can parent these buttons into the entry itself

main_box.add (attachment_box);
main_box.add (action_bar);

// main_box.append (headerbar);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably can remove this comment right? :)


unowned var attachment_obj = (Attachment)attachment;
body.add_part (attachment_obj.get_mime_part ());
Gtk.Widget current_attachment = attachment_box.get_first_child ();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be unowned?

box.append (size_label);
box.append (remove_button);

margin_top = 3;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call moving margin here

Comment on lines +64 to +65
// insert_button.can_default = true;
// insert_button.has_default = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paned_start = new Gtk.Paned (Gtk.Orientation.HORIZONTAL) {
shrink_start_child = false,
shrink_end_child = false,
wide_handle = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you added the wide_handle here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped this would fix some style issues with the separators because the black border on the left side of the conversation list is shorter than on the right side but it didn't and I'm not even sure whether the black borders belongs to the separators or to something else entirely. Any idea about the origin of these borders and how to fix their size?


account_settings_menuitem.clicked.connect (() => {
try {
AppInfo.launch_default_for_uri ("settings://accounts/online", null);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to use Gtk.show_uri () here to avoid focus stealing prevention

@@ -20,10 +20,8 @@

public class Mail.WelcomeView : Gtk.Box {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think most of this can be replaced with Granite.Placeholder

@leolost2605
Copy link
Member Author

Is there any way we could land the new accounts list in the Gtk3 version or are we relying on features in Gtk4?

It relies on Gtk.ListView and as SourceList also doesn't seem to support factories I don't think it's possible without some major tweaks but I'll give it a try.

Unfortunately we're stuck with Gtk 4.6.6 until we rebase on Ubuntu 24.04 so we either have to wait until then to land the Gtk 4 port or stick with what is available in that version

If the current look is ok we can stick with Gtk 4.6.6. Maybe a stupid question but does that mean we are stuck with 22.04 packages entirely? Or is there another reason for the gtk 4 restriction?

@danirabbit
Copy link
Member

Yeah exactly we have to ship Mail in deb currently because of issues with accessing the host keychain with evolution and it not working with online accounts. So we're stuck with Ubuntu's packages there

@leolost2605
Copy link
Member Author

I guess we'll have to wait for 24.04 then anyway. In the meantime is there anything I can help with getting the flatpak version to work? I've come over this, is it still relevant?

@danirabbit
Copy link
Member

I think @tintou probably knows the most about this since he's done upstream work with EDS but yeah my understanding is that the Flatpak EDS can't access the credentials stored in the host EDS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants