pantheon.elementary-mail: drop downstream patch

This commit is contained in:
Bobby Rong 2021-10-28 23:05:16 +08:00
parent 829e92098e
commit 758d85fed3
No known key found for this signature in database
GPG Key ID: ED07364437C91161
2 changed files with 0 additions and 62 deletions

View File

@ -1,6 +1,5 @@
{ lib, stdenv { lib, stdenv
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, nix-update-script , nix-update-script
, pantheon , pantheon
, pkg-config , 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 = [ nativeBuildInputs = [
appstream appstream
desktop-file-utils desktop-file-utils

View File

@ -1,55 +0,0 @@
From 9e61e9493e78b83b9599886561ee596c096030ed Mon Sep 17 00:00:00 2001
From: Bobby Rong <rjl931189261@126.com>
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);