[geary/wip/765516-gtk-widget-conversation-viewer: 71/78] Remove some unused web view font code.



commit b50635ad60ceb31749e4fa715832d5608466db87
Author: Michael James Gratton <mike vee net>
Date:   Fri Jul 8 11:10:43 2016 +1000

    Remove some unused web view font code.
    
    * src/client/conversation-viewer/conversation-web-view.vala
      (ConversationWebView): Don't bother listening to document_font_changed
      since that is handled by StylishWebView.
    
    * src/client/components/stylish-webview.vala: Remove unused signals and
      the interface font property - no longer used.

 src/client/components/stylish-webview.vala         |   29 ++++---------------
 .../conversation-viewer/conversation-web-view.vala |   30 +------------------
 2 files changed, 8 insertions(+), 51 deletions(-)
---
diff --git a/src/client/components/stylish-webview.vala b/src/client/components/stylish-webview.vala
index e68830c..914dbc4 100644
--- a/src/client/components/stylish-webview.vala
+++ b/src/client/components/stylish-webview.vala
@@ -1,11 +1,12 @@
-/* Copyright 2016 Software Freedom Conservancy Inc.
+/*
+ * Copyright 2016 Software Freedom Conservancy Inc.
  *
  * This software is licensed under the GNU Lesser General Public License
- * (version 2.1 or later).  See the COPYING file in this distribution.
+ * (version 2.1 or later). See the COPYING file in this distribution.
  */
 
 public class StylishWebView : WebKit.WebView {
-    
+
     private string _document_font;
     public string document_font {
         get {
@@ -18,10 +19,9 @@ public class StylishWebView : WebKit.WebView {
             config.default_font_family = font.get_family();
             config.default_font_size = font.get_size() / Pango.SCALE;
             settings = config;
-            document_font_changed();
         }
     }
-    
+
     private string _monospace_font;
     public string monospace_font {
         get {
@@ -34,30 +34,13 @@ public class StylishWebView : WebKit.WebView {
             config.monospace_font_family = font.get_family();
             config.default_monospace_font_size = font.get_size() / Pango.SCALE;
             settings = config;
-            monospace_font_changed();
-        }
-    }
-    
-    private string _interface_font;
-    public string interface_font {
-        get {
-            return _interface_font;
-        }
-        set {
-            _interface_font = value;
-            interface_font_changed();
         }
     }
-    
-    public signal void document_font_changed();
-    public signal void monospace_font_changed();
-    public signal void interface_font_changed();
-    
+
     public StylishWebView() {
         Settings system_settings = GearyApplication.instance.config.gnome_interface;
         system_settings.bind("document-font-name", this, "document-font", SettingsBindFlags.DEFAULT);
         system_settings.bind("monospace-font-name", this, "monospace-font", SettingsBindFlags.DEFAULT);
-        system_settings.bind("font-name", this, "interface-font", SettingsBindFlags.DEFAULT);
     }
 }
 
diff --git a/src/client/conversation-viewer/conversation-web-view.vala 
b/src/client/conversation-viewer/conversation-web-view.vala
index 6e4d9e5..3f7ce2e 100644
--- a/src/client/conversation-viewer/conversation-web-view.vala
+++ b/src/client/conversation-viewer/conversation-web-view.vala
@@ -40,7 +40,6 @@ public class ConversationWebView : StylishWebView {
         navigation_policy_decision_requested.connect(on_navigation_policy_decision_requested);
         new_window_policy_decision_requested.connect(on_navigation_policy_decision_requested);
         web_inspector.inspect_web_view.connect(activate_inspector);
-        document_font_changed.connect(on_document_font_changed);
         scroll_event.connect(on_scroll_event);
     }
     
@@ -136,35 +135,10 @@ public class ConversationWebView : StylishWebView {
         } catch (Error error) {
             debug("Error loading conversation-web-view.css: %s", error.message);
         }
-        
-        on_document_font_changed();
+
         load_user_style();
     }
-    
-    private void on_document_font_changed() {
-        string document_css = "";
-        if (document_font != null) {
-            string font_family = Pango.FontDescription.from_string(document_font).get_family();
-            document_css = @".email .body { font-family: $font_family; font-size: medium; }\n";
-        }
-        
-        WebKit.DOM.Document document = get_dom_document();
-        WebKit.DOM.Element style_element = document.get_element_by_id("default_fonts");
-        if (style_element == null)  // Not yet loaded
-            return;
-        
-        ulong n = style_element.child_nodes.length;
-        try {
-            for (int i = 0; i < n; i++)
-                style_element.remove_child(style_element.first_child);
-            
-            WebKit.DOM.Text text_node = document.create_text_node(document_css);
-            style_element.append_child(text_node);
-        } catch (Error error) {
-            debug("Error updating default font style: %s", error.message);
-        }
-    }
-    
+
     private bool on_scroll_event(Gdk.EventScroll event) {
         if ((event.state & Gdk.ModifierType.CONTROL_MASK) != 0) {
             double dir = 0;


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