diff --git a/pkgs/desktops/pantheon/apps/elementary-mail/default.nix b/pkgs/desktops/pantheon/apps/elementary-mail/default.nix index d289431bf008..5562eb3e77da 100644 --- a/pkgs/desktops/pantheon/apps/elementary-mail/default.nix +++ b/pkgs/desktops/pantheon/apps/elementary-mail/default.nix @@ -1,6 +1,5 @@ { lib, stdenv , fetchFromGitHub -, fetchpatch , nix-update-script , pantheon , pkg-config @@ -43,12 +42,6 @@ stdenv.mkDerivation rec { }; }; - patches = [ - # The app stuck when loading gravatar, temporarily reverts part - # of https://github.com/elementary/mail/pull/600 to fix this - ./revert-fix-warning.patch - ]; - nativeBuildInputs = [ appstream desktop-file-utils diff --git a/pkgs/desktops/pantheon/apps/elementary-mail/revert-fix-warning.patch b/pkgs/desktops/pantheon/apps/elementary-mail/revert-fix-warning.patch deleted file mode 100644 index 85534aaf4c60..000000000000 --- a/pkgs/desktops/pantheon/apps/elementary-mail/revert-fix-warning.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 9e61e9493e78b83b9599886561ee596c096030ed Mon Sep 17 00:00:00 2001 -From: Bobby Rong -Date: Thu, 29 Jul 2021 13:57:21 +0800 -Subject: [PATCH] Partly revert "Fix Warnings in Vala Code (#600)" - -This partly reverts commit 9477c24201d3c9c3c7bcc650e0290daa0ee1ab21. ---- - src/MessageList/MessageListItem.vala | 27 ++++++++++++++++++++++++++- - 1 file changed, 26 insertions(+), 1 deletion(-) - -diff --git a/src/MessageList/MessageListItem.vala b/src/MessageList/MessageListItem.vala -index 96b61027..a7ef8f9e 100644 ---- a/src/MessageList/MessageListItem.vala -+++ b/src/MessageList/MessageListItem.vala -@@ -290,7 +290,7 @@ public class Mail.MessageListItem : Gtk.ListBoxRow { - expanded = false; - show_all (); - -- avatar.set_loadable_icon (new GravatarIcon (parsed_address, get_style_context ().get_scale ())); -+ download_gravatar.begin (parsed_address, avatar.size); - - /* Override default handler to stop event propagation. Otherwise clicking the menu will - expand or collapse the MessageListItem. */ -@@ -348,6 +348,31 @@ public class Mail.MessageListItem : Gtk.ListBoxRow { - }); - } - -+ private async void download_gravatar (string address, int size) { -+ if (avatars[address] == null) { -+ var uri = "https://secure.gravatar.com/avatar/%s?d=404&s=%d".printf ( -+ Checksum.compute_for_string (ChecksumType.MD5, address.strip ().down ()), -+ size * get_style_context ().get_scale () -+ ); -+ -+ var server_file = File.new_for_uri (uri); -+ var path = Path.build_filename (Environment.get_tmp_dir (), server_file.get_basename ()); -+ var local_file = File.new_for_path (path); -+ -+ try { -+ yield server_file.copy_async (local_file, FileCopyFlags.OVERWRITE, Priority.DEFAULT, null); -+ avatars[address] = new Gdk.Pixbuf.from_file_at_scale (path, size, size, true); -+ } catch (Error e) { -+ debug ("Unable to fetch gravatar: %s", e.message); -+ return; -+ } -+ } -+ -+ avatar.set_image_load_func (() => { -+ return avatars[address]; -+ }); -+ } -+ - private void add_inline_composer (ComposerWidget.Type composer_type) { - var message_list_box = (MessageListBox) get_parent (); - message_list_box.add_inline_composer.begin (composer_type, this);