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



commit 7048a59b125146b58f6d9eda315d1fbd020b2125
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 7eabadc..e0b2e76 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -2399,6 +2399,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);
@@ -2494,6 +2499,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);
@@ -2814,6 +2824,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);
@@ -2894,11 +2909,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);
 
@@ -2962,11 +2988,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);
 
@@ -3045,6 +3082,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]