[evolution/wip/webkit-composer: 881/966] EEditorSelection: Try to get the font format just in HTML mode



commit 9c0eeca6ff79fc77ff7d554daa8c52630531b069
Author: Tomas Popela <tpopela redhat com>
Date:   Mon Mar 10 16:04:00 2014 +0100

    EEditorSelection: Try to get the font format just in HTML mode

 e-util/e-editor-selection.c |   42 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index ac22f47..e8c771b 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -2395,6 +2395,11 @@ e_editor_selection_is_bold (EEditorSelection *selection)
        editor_widget = e_editor_selection_ref_editor_widget (selection);
        g_return_val_if_fail (editor_widget != NULL, FALSE);
 
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
        g_object_unref (editor_widget);
        window = webkit_dom_document_get_default_view (document);
@@ -2490,6 +2495,11 @@ e_editor_selection_is_italic (EEditorSelection *selection)
        editor_widget = e_editor_selection_ref_editor_widget (selection);
        g_return_val_if_fail (editor_widget != NULL, FALSE);
 
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
        g_object_unref (editor_widget);
        window = webkit_dom_document_get_default_view (document);
@@ -2810,6 +2820,11 @@ e_editor_selection_is_strike_through (EEditorSelection *selection)
        editor_widget = e_editor_selection_ref_editor_widget (selection);
        g_return_val_if_fail (editor_widget != NULL, FALSE);
 
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
        g_object_unref (editor_widget);
        window = webkit_dom_document_get_default_view (document);
@@ -2890,11 +2905,22 @@ e_editor_selection_set_strike_through (EEditorSelection *selection,
 gboolean
 e_editor_selection_is_subscript (EEditorSelection *selection)
 {
+       EEditorWidget *editor_widget;
        WebKitDOMNode *node;
        WebKitDOMRange *range;
 
        g_return_val_if_fail (E_IS_EDITOR_SELECTION (selection), FALSE);
 
+       editor_widget = e_editor_selection_ref_editor_widget (selection);
+       g_return_val_if_fail (editor_widget != NULL, FALSE);
+
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
+       g_object_unref (editor_widget);
+
        range = editor_selection_get_current_range (selection);
        node = webkit_dom_range_get_common_ancestor_container (range, NULL);
 
@@ -2958,11 +2984,22 @@ e_editor_selection_set_subscript (EEditorSelection *selection,
 gboolean
 e_editor_selection_is_superscript (EEditorSelection *selection)
 {
+       EEditorWidget *editor_widget;
        WebKitDOMNode *node;
        WebKitDOMRange *range;
 
        g_return_val_if_fail (E_IS_EDITOR_SELECTION (selection), FALSE);
 
+       editor_widget = e_editor_selection_ref_editor_widget (selection);
+       g_return_val_if_fail (editor_widget != NULL, FALSE);
+
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
+       g_object_unref (editor_widget);
+
        range = editor_selection_get_current_range (selection);
        node = webkit_dom_range_get_common_ancestor_container (range, NULL);
 
@@ -3041,6 +3078,11 @@ e_editor_selection_is_underline (EEditorSelection *selection)
        editor_widget = e_editor_selection_ref_editor_widget (selection);
        g_return_val_if_fail (editor_widget != NULL, FALSE);
 
+       if (!e_editor_widget_get_html_mode (editor_widget)) {
+               g_object_unref (editor_widget);
+               return FALSE;
+       }
+
        document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (editor_widget));
        g_object_unref (editor_widget);
        window = webkit_dom_document_get_default_view (document);


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