pantheon.elementary-mail: 6.0.0 -> 6.1.1

main
Bobby Rong 3 years ago
parent de73ad2567
commit 5523634193
No known key found for this signature in database
GPG Key ID: ED07364437C91161
  1. 11
      pkgs/desktops/pantheon/apps/elementary-mail/default.nix
  2. 55
      pkgs/desktops/pantheon/apps/elementary-mail/revert-fix-warning.patch

@ -1,5 +1,6 @@
{ lib, stdenv
, fetchFromGitHub
, fetchpatch
, nix-update-script
, pantheon
, pkg-config
@ -25,7 +26,7 @@
stdenv.mkDerivation rec {
pname = "elementary-mail";
version = "6.0.0";
version = "6.1.1";
repoName = "mail";
@ -33,7 +34,7 @@ stdenv.mkDerivation rec {
owner = "elementary";
repo = repoName;
rev = version;
sha256 = "07iiipl0nsp63g5bn1y2hg6bmgj6i9cxqcfpd7q3vmldnkijvaxs";
sha256 = "15ai0x9236pjx76m0756nyc1by78v0lg1dgdiifk868krdvipzzx";
};
passthru = {
@ -42,6 +43,12 @@ 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

@ -0,0 +1,55 @@
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);
Loading…
Cancel
Save