[evolution] Don't save the history for various HTML formatting dialogs if the formatting didn't changed



commit 63e37591a74a2cdeb5f84547071b81eaa6acba87
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Jun 10 09:04:27 2015 +0200

    Don't save the history for various HTML formatting dialogs if the formatting didn't changed

 e-util/e-html-editor-cell-dialog.c  |   12 +++++++++---
 e-util/e-html-editor-hrule-dialog.c |   16 +++++++++++-----
 e-util/e-html-editor-page-dialog.c  |   12 +++++++++---
 e-util/e-html-editor-table-dialog.c |   12 +++++++++---
 4 files changed, 38 insertions(+), 14 deletions(-)
---
diff --git a/e-util/e-html-editor-cell-dialog.c b/e-util/e-html-editor-cell-dialog.c
index 5ac970a..0ee0da2 100644
--- a/e-util/e-html-editor-cell-dialog.c
+++ b/e-util/e-html-editor-cell-dialog.c
@@ -652,9 +652,15 @@ html_editor_cell_dialog_hide (GtkWidget *widget)
                ev->data.dom.to = webkit_dom_node_clone_node (
                        WEBKIT_DOM_NODE (table), TRUE);
 
-               e_html_editor_selection_get_selection_coordinates (
-                       selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
-               e_html_editor_view_insert_new_history_event (view, ev);
+               if (!webkit_dom_node_is_equal_node (ev->data.dom.from, ev->data.dom.to)) {
+                       e_html_editor_selection_get_selection_coordinates (
+                               selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
+                       e_html_editor_view_insert_new_history_event (view, ev);
+               } else {
+                       g_object_unref (ev->data.dom.from);
+                       g_object_unref (ev->data.dom.to);
+                       g_free (ev);
+               }
        }
 
        g_object_unref (priv->cell);
diff --git a/e-util/e-html-editor-hrule-dialog.c b/e-util/e-html-editor-hrule-dialog.c
index 5e58f4e..bb92276 100644
--- a/e-util/e-html-editor-hrule-dialog.c
+++ b/e-util/e-html-editor-hrule-dialog.c
@@ -219,12 +219,18 @@ html_editor_hrule_dialog_hide (GtkWidget *widget)
                ev->data.dom.to = webkit_dom_node_clone_node (
                        WEBKIT_DOM_NODE (priv->hr_element), FALSE);
 
-               e_html_editor_selection_get_selection_coordinates (
-                       selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
-               e_html_editor_view_insert_new_history_event (view, ev);
+               if (!webkit_dom_node_is_equal_node (ev->data.dom.from, ev->data.dom.to)) {
+                       e_html_editor_selection_get_selection_coordinates (
+                               selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
+                       e_html_editor_view_insert_new_history_event (view, ev);
 
-               if (!ev->data.dom.from)
-                       g_object_unref (priv->hr_element);
+                       if (!ev->data.dom.from)
+                               g_object_unref (priv->hr_element);
+               } else {
+                       g_object_unref (ev->data.dom.from);
+                       g_object_unref (ev->data.dom.to);
+                       g_free (ev);
+               }
        }
 
        priv->hr_element = NULL;
diff --git a/e-util/e-html-editor-page-dialog.c b/e-util/e-html-editor-page-dialog.c
index e27a5db..9033ff3 100644
--- a/e-util/e-html-editor-page-dialog.c
+++ b/e-util/e-html-editor-page-dialog.c
@@ -499,9 +499,15 @@ html_editor_page_dialog_hide (GtkWidget *widget)
                        webkit_dom_element_set_attribute (
                                WEBKIT_DOM_ELEMENT (body), "data-user-colors", "", NULL);
 
-               e_html_editor_selection_get_selection_coordinates (
-                       selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
-               e_html_editor_view_insert_new_history_event (view, ev);
+               if (!webkit_dom_node_is_equal_node (ev->data.dom.from, ev->data.dom.to)) {
+                       e_html_editor_selection_get_selection_coordinates (
+                               selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
+                       e_html_editor_view_insert_new_history_event (view, ev);
+               } else {
+                       g_object_unref (ev->data.dom.from);
+                       g_object_unref (ev->data.dom.to);
+                       g_free (ev);
+               }
        }
 
        e_html_editor_view_unblock_style_updated_callbacks (view);
diff --git a/e-util/e-html-editor-table-dialog.c b/e-util/e-html-editor-table-dialog.c
index 1a9e83a..f7155d6 100644
--- a/e-util/e-html-editor-table-dialog.c
+++ b/e-util/e-html-editor-table-dialog.c
@@ -720,9 +720,15 @@ html_editor_table_dialog_hide (GtkWidget *widget)
                ev->data.dom.to = webkit_dom_node_clone_node (
                        WEBKIT_DOM_NODE (priv->table_element), TRUE);
 
-               e_html_editor_selection_get_selection_coordinates (
-                       selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
-               e_html_editor_view_insert_new_history_event (view, ev);
+               if (!webkit_dom_node_is_equal_node (ev->data.dom.from, ev->data.dom.to)) {
+                       e_html_editor_selection_get_selection_coordinates (
+                               selection, &ev->after.start.x, &ev->after.start.y, &ev->after.end.x, 
&ev->after.end.y);
+                       e_html_editor_view_insert_new_history_event (view, ev);
+               } else {
+                       g_object_unref (ev->data.dom.from);
+                       g_object_unref (ev->data.dom.to);
+                       g_free (ev);
+               }
        }
 
        g_object_unref (priv->table_element);


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