[geary/mjog/989-flatpak-font-workaround] FormattedConversationData: Fix font settings being ignored under Flatpak




commit ded58e7eefced57aeca641a515bace07e72b7172
Author: Michael Gratton <mike vee net>
Date:   Mon Sep 28 22:26:23 2020 +1000

    FormattedConversationData: Fix font settings being ignored under Flatpak
    
    Get the interface font from Gtk.Settings instead of GLib.Settings since
    the latter can't actually access desktop settings under Flatpak.
    
    Partial fix for #986
    
    See also GNOME/glib#2213

 .../conversation-list/formatted-conversation-data.vala   | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/client/conversation-list/formatted-conversation-data.vala 
b/src/client/conversation-list/formatted-conversation-data.vala
index f2b635f8b..b21a931fc 100644
--- a/src/client/conversation-list/formatted-conversation-data.vala
+++ b/src/client/conversation-list/formatted-conversation-data.vala
@@ -100,6 +100,8 @@ public class FormattedConversationData : Geary.BaseObject {
     public Geary.Email? preview { get; private set; default = null; }
 
     private Application.Configuration config;
+
+    private Gtk.Settings? gtk;
     private Pango.FontDescription font;
 
     private Geary.App.Conversation? conversation = null;
@@ -115,13 +117,13 @@ public class FormattedConversationData : Geary.BaseObject {
                                      Geary.Email preview,
                                      Gee.List<Geary.RFC822.MailboxAddress> account_owner_emails) {
         this.config = config;
+        this.gtk = Gtk.Settings.get_default();
         this.conversation = conversation;
         this.account_owner_emails = account_owner_emails;
         this.use_to = conversation.base_folder.used_as.is_outgoing();
 
-        this.font = Pango.FontDescription.from_string(
-            this.config.gnome_interface.get_string("font-name")
-        );
+        this.gtk.notify["gtk-font-name"].connect(this.update_font);
+        update_font();
 
         // Load preview-related data.
         update_date_string();
@@ -472,4 +474,12 @@ public class FormattedConversationData : Geary.BaseObject {
         return ink_rect;
     }
 
+    private void update_font() {
+        var name = "Cantarell 11";
+        if (this.gtk != null) {
+            name = this.gtk.gtk_font_name;
+        }
+        this.font = Pango.FontDescription.from_string(name);
+    }
+
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]