[evolution/wip/tpopela/freeze-fixes] EHTMLEditorSelection - Recalculate just plain text properties when selection changes in plain text m



commit eb29cbcc90bee6c52075dceb4050f6294cf36e15
Author: Tomas Popela <tpopela redhat com>
Date:   Thu Mar 19 13:27:58 2015 +0100

    EHTMLEditorSelection - Recalculate just plain text properties when selection changes in plain text mode
    
    We don't need to recalculate the HTML properties as they are not used
    in plain text mode.

 e-util/e-html-editor-selection.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index 3fbbe89..f55e5c4 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -234,27 +234,37 @@ get_font_property (EHTMLEditorSelection *selection,
 }
 
 static void
-html_editor_selection_selection_changed_cb (WebKitWebView *webview,
+html_editor_selection_selection_changed_cb (WebKitWebView *web_view,
                                             EHTMLEditorSelection *selection)
 {
+       EHTMLEditorView *view;
+
+       view = e_html_editor_selection_ref_html_editor_view (selection);
+
        g_object_freeze_notify (G_OBJECT (selection));
 
        g_object_notify (G_OBJECT (selection), "alignment");
+       g_object_notify (G_OBJECT (selection), "block-format");
+       g_object_notify (G_OBJECT (selection), "indented");
+       g_object_notify (G_OBJECT (selection), "text");
+
+       if (!e_html_editor_view_get_html_mode (view))
+               goto out;
+
        g_object_notify (G_OBJECT (selection), "background-color");
        g_object_notify (G_OBJECT (selection), "bold");
        g_object_notify (G_OBJECT (selection), "font-name");
        g_object_notify (G_OBJECT (selection), "font-size");
        g_object_notify (G_OBJECT (selection), "font-color");
-       g_object_notify (G_OBJECT (selection), "block-format");
-       g_object_notify (G_OBJECT (selection), "indented");
        g_object_notify (G_OBJECT (selection), "italic");
        g_object_notify (G_OBJECT (selection), "monospaced");
        g_object_notify (G_OBJECT (selection), "strikethrough");
        g_object_notify (G_OBJECT (selection), "subscript");
        g_object_notify (G_OBJECT (selection), "superscript");
-       g_object_notify (G_OBJECT (selection), "text");
        g_object_notify (G_OBJECT (selection), "underline");
 
+ out:
+       g_object_unref (view);
        g_object_thaw_notify (G_OBJECT (selection));
 }
 


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