[evolution/wip/webkit-composer: 552/966] Change the node-traversal helper functions



commit eccc166f507a4ee7a5f291a8eec47f04271bac0f
Author: Dan Vrátil <dvratil redhat com>
Date:   Tue Aug 14 22:15:53 2012 +0200

    Change the node-traversal helper functions
    
    Rename e_editor_dom_node_get_parent_element() to
    e_editor_dom_node_find_parent_element() and change both functions
    to search not by GType of the object returned by WebKit, but by
    the actual tag name. Search by GType was broken, because WebKit
    often returns objects wich are of different type then the actual
    DOM element they wrap. Usually individual HTML elements, like
    WebKitDOMHTMLTableElement, are returned as instances of
    WebKitDOMHTMLElement and thus the GType check fails.

 e-util/e-editor-hrule-dialog.c |  143 +--------------------------
 e-util/e-editor-image-dialog.c |  217 +---------------------------------------
 e-util/e-editor-link-dialog.c  |   16 +--
 e-util/e-editor-selection.c    |    3 +-
 e-util/e-editor-table-dialog.c |  198 ------------------------------------
 e-util/e-editor-utils.c        |   44 +++++++--
 e-util/e-editor-utils.h        |   27 +-----
 e-util/e-editor.c              |   12 +-
 8 files changed, 55 insertions(+), 605 deletions(-)
---
diff --git a/e-util/e-editor-hrule-dialog.c b/e-util/e-editor-hrule-dialog.c
index 5880c2e..0528c12 100644
--- a/e-util/e-editor-hrule-dialog.c
+++ b/e-util/e-editor-hrule-dialog.c
@@ -1,11 +1,6 @@
 /*
  * e-editor-hrule-dialog.h
  *
-<<<<<<< HEAD
- * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
- *
-=======
->>>>>>> Make horizontal rule dialog work
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -27,25 +22,15 @@
 
 #include "e-editor-hrule-dialog.h"
 #include "e-editor-utils.h"
-<<<<<<< HEAD
-#include "e-editor-widget.h"
-=======
->>>>>>> Make horizontal rule dialog work
 
 #include <glib/gi18n-lib.h>
 #include <webkit/webkitdom.h>
 #include <stdlib.h>
 
-<<<<<<< HEAD
-#define E_EDITOR_HRULE_DIALOG_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), E_TYPE_EDITOR_HRULE_DIALOG, EEditorHRuleDialogPrivate))
-=======
 G_DEFINE_TYPE (
        EEditorHRuleDialog,
        e_editor_hrule_dialog,
        E_TYPE_EDITOR_DIALOG);
->>>>>>> Make horizontal rule dialog work
 
 struct _EEditorHRuleDialogPrivate {
        GtkWidget *width_edit;
@@ -55,22 +40,11 @@ struct _EEditorHRuleDialogPrivate {
        GtkWidget *alignment_combo;
        GtkWidget *shaded_check;
 
-<<<<<<< HEAD
-       WebKitDOMHTMLHRElement *hr_element;
-};
-
-G_DEFINE_TYPE (
-       EEditorHRuleDialog,
-       e_editor_hrule_dialog,
-       E_TYPE_EDITOR_DIALOG);
-
-=======
        GtkWidget *close_button;
 
        WebKitDOMHTMLHRElement *hr_element;
 };
 
->>>>>>> Make horizontal rule dialog work
 static void
 editor_hrule_dialog_set_alignment (EEditorHRuleDialog *dialog)
 {
@@ -78,13 +52,8 @@ editor_hrule_dialog_set_alignment (EEditorHRuleDialog *dialog)
 
        g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
 
-<<<<<<< HEAD
-       alignment = gtk_combo_box_get_active_id (
-                       GTK_COMBO_BOX (dialog->priv->alignment_combo));
-=======
        alignment = gtk_combo_box_text_get_active_text (
                        GTK_COMBO_BOX_TEXT (dialog->priv->alignment_combo));
->>>>>>> Make horizontal rule dialog work
 
        webkit_dom_htmlhr_element_set_align (dialog->priv->hr_element, alignment);
 }
@@ -146,36 +115,19 @@ editor_hrule_dialog_get_size (EEditorHRuleDialog *dialog)
 static void
 editor_hrule_dialog_set_width (EEditorHRuleDialog *dialog)
 {
-<<<<<<< HEAD
-       gchar *width, *units;
-
-       g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
-
-       units = gtk_combo_box_text_get_active_text (
-                       GTK_COMBO_BOX_TEXT (dialog->priv->unit_combo));
-=======
        gchar *width;
 
        g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
 
->>>>>>> Make horizontal rule dialog work
        width = g_strdup_printf (
                "%d%s",
                (gint) gtk_spin_button_get_value (
                        GTK_SPIN_BUTTON (dialog->priv->width_edit)),
-<<<<<<< HEAD
-               units);
-
-       webkit_dom_htmlhr_element_set_width (dialog->priv->hr_element, width);
-
-       g_free (units);
-=======
                gtk_combo_box_text_get_active_text (
                        GTK_COMBO_BOX_TEXT (dialog->priv->unit_combo)));
 
        webkit_dom_htmlhr_element_set_width (dialog->priv->hr_element, width);
 
->>>>>>> Make horizontal rule dialog work
        g_free (width);
 }
 
@@ -236,23 +188,11 @@ editor_hrule_dialog_get_shading (EEditorHRuleDialog *dialog)
 }
 
 static void
-<<<<<<< HEAD
-editor_hrule_dialog_hide (GtkWidget *widget)
-{
-       EEditorHRuleDialogPrivate *priv;
-
-       priv = E_EDITOR_HRULE_DIALOG_GET_PRIVATE (widget);
-
-       priv->hr_element = NULL;
-
-       GTK_WIDGET_CLASS (e_editor_hrule_dialog_parent_class)->hide (widget);
-=======
 editor_hrule_dialog_close (EEditorHRuleDialog *dialog)
 {
        gtk_widget_hide (GTK_WIDGET (dialog));
 
        dialog->priv->hr_element = NULL;
->>>>>>> Make horizontal rule dialog work
 }
 
 static void
@@ -283,7 +223,6 @@ editor_hrule_dialog_show (GtkWidget *widget)
 
        range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
 
-<<<<<<< HEAD
        rule = e_editor_dom_node_find_parent_element (
                webkit_dom_range_get_start_container (range, NULL), "HR");
        if (!rule) {
@@ -292,29 +231,11 @@ editor_hrule_dialog_show (GtkWidget *widget)
        }
 
        if (!rule) {
-               e_editor_widget_exec_command (
-                       editor_widget, E_EDITOR_WIDGET_COMMAND_INSERT_HORIZONTAL_RULE, NULL);
-
-               rule = e_editor_dom_node_find_child_element (
-                       webkit_dom_range_get_start_container (range, NULL), "HR");
-=======
-       rule = e_editor_dom_node_get_parent_element (
-               webkit_dom_range_get_start_container (range, NULL),
-               WEBKIT_TYPE_DOM_HTMLHR_ELEMENT);
-       if (!rule) {
-               rule = e_editor_dom_node_find_child_element (
-                       webkit_dom_range_get_start_container (range, NULL),
-                       WEBKIT_TYPE_DOM_HTMLHR_ELEMENT);
-       }
-
-       if (!rule) {
                webkit_dom_document_exec_command (
                        document, "insertHorizontalRule", FALSE, "");
 
                rule = e_editor_dom_node_find_child_element (
-                       webkit_dom_range_get_start_container (range, NULL),
-                       WEBKIT_TYPE_DOM_HTMLHR_ELEMENT);
->>>>>>> Make horizontal rule dialog work
+                       webkit_dom_range_get_start_container (range, NULL), "HR");
 
                dialog->priv->hr_element = WEBKIT_DOM_HTMLHR_ELEMENT (rule);
 
@@ -348,17 +269,6 @@ editor_hrule_dialog_show (GtkWidget *widget)
 }
 
 static void
-<<<<<<< HEAD
-e_editor_hrule_dialog_class_init (EEditorHRuleDialogClass *class)
-{
-       GtkWidgetClass *widget_class;
-
-       g_type_class_add_private (class, sizeof (EEditorHRuleDialogPrivate));
-
-       widget_class = GTK_WIDGET_CLASS (class);
-       widget_class->show = editor_hrule_dialog_show;
-       widget_class->hide = editor_hrule_dialog_hide;
-=======
 e_editor_hrule_dialog_class_init (EEditorHRuleDialogClass *klass)
 {
        GtkWidgetClass *widget_class;
@@ -368,20 +278,11 @@ e_editor_hrule_dialog_class_init (EEditorHRuleDialogClass *klass)
 
        widget_class = GTK_WIDGET_CLASS (klass);
        widget_class->show = editor_hrule_dialog_show;
->>>>>>> Make horizontal rule dialog work
 }
 
 static void
 e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
 {
-<<<<<<< HEAD
-       GtkGrid *main_layout, *grid;
-       GtkWidget *widget;
-
-       dialog->priv = E_EDITOR_HRULE_DIALOG_GET_PRIVATE (dialog);
-
-       main_layout = e_editor_dialog_get_container (E_EDITOR_DIALOG (dialog));
-=======
        GtkBox *main_layout;
        GtkGrid *grid;
        GtkWidget *widget;
@@ -393,27 +294,18 @@ e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
        gtk_container_add (GTK_CONTAINER (dialog), GTK_WIDGET (main_layout));
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 10);
 
->>>>>>> Make horizontal rule dialog work
 
        /* == Size == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Size</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 0, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
->>>>>>> Make horizontal rule dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_column_spacing (grid, 5);
        gtk_grid_set_row_spacing (grid, 5);
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 1, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 5);
->>>>>>> Make horizontal rule dialog work
 
        /* Width */
        widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
@@ -425,12 +317,7 @@ e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
        dialog->priv->width_edit = widget;
        gtk_grid_attach (grid, widget, 1, 0, 1, 1);
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Width:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Width:"));
->>>>>>> Make horizontal rule dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->size_edit);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
 
@@ -454,38 +341,22 @@ e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
        dialog->priv->size_edit = widget;
        gtk_grid_attach (grid, widget, 1, 1, 1, 1);
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Size:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-       gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->size_edit);
-       gtk_grid_attach (grid, widget, 0, 1, 1, 1);
-
-=======
        widget = gtk_label_new_with_mnemonic (_("Size:"));
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->size_edit);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
 
 
->>>>>>> Make horizontal rule dialog work
        /* == Style == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Style</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 2, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
->>>>>>> Make horizontal rule dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_column_spacing (grid, 5);
        gtk_grid_set_row_spacing (grid, 5);
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 3, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 5);
->>>>>>> Make horizontal rule dialog work
 
        /* Alignment */
        widget = gtk_combo_box_text_new ();
@@ -502,29 +373,18 @@ e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
        dialog->priv->alignment_combo = widget;
        gtk_grid_attach (grid, widget, 1, 0, 2, 1);
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Alignment:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Alignment:"));
->>>>>>> Make horizontal rule dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), widget);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
 
        /* Shaded */
-<<<<<<< HEAD
-       widget = gtk_check_button_new_with_mnemonic (_("S_haded"));
-=======
        widget = gtk_check_button_new_with_mnemonic (_("Shaded"));
->>>>>>> Make horizontal rule dialog work
        g_signal_connect_swapped (
                widget, "toggled",
                G_CALLBACK (editor_hrule_dialog_set_shading), dialog);
        dialog->priv->shaded_check = widget;
        gtk_grid_attach (grid, widget, 0, 1, 2, 1);
 
-<<<<<<< HEAD
-=======
 
        /* == Button box == */
        widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
@@ -538,7 +398,6 @@ e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
        gtk_box_pack_start (GTK_BOX (widget), dialog->priv->close_button, FALSE, FALSE, 5);
 
->>>>>>> Make horizontal rule dialog work
        gtk_widget_show_all (GTK_WIDGET (main_layout));
 }
 
diff --git a/e-util/e-editor-image-dialog.c b/e-util/e-editor-image-dialog.c
index 39edaad..40686e0 100644
--- a/e-util/e-editor-image-dialog.c
+++ b/e-util/e-editor-image-dialog.c
@@ -1,11 +1,6 @@
 /*
  * e-editor-image-dialog.h
  *
-<<<<<<< HEAD
- * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
- *
-=======
->>>>>>> Make 'Image Properties' dialog work
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -33,16 +28,10 @@
 #include "e-editor-utils.h"
 #include "e-image-chooser-dialog.h"
 
-<<<<<<< HEAD
-#define E_EDITOR_IMAGE_DIALOG_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), E_TYPE_EDITOR_IMAGE_DIALOG, EEditorImageDialogPrivate))
-=======
 G_DEFINE_TYPE (
        EEditorImageDialog,
        e_editor_image_dialog,
        E_TYPE_EDITOR_DIALOG);
->>>>>>> Make 'Image Properties' dialog work
 
 struct _EEditorImageDialogPrivate {
        GtkWidget *file_chooser;
@@ -61,22 +50,11 @@ struct _EEditorImageDialogPrivate {
        GtkWidget *url_edit;
        GtkWidget *test_url_button;
 
-<<<<<<< HEAD
-       WebKitDOMHTMLImageElement *image;
-};
-
-G_DEFINE_TYPE (
-       EEditorImageDialog,
-       e_editor_image_dialog,
-       E_TYPE_EDITOR_DIALOG);
-
-=======
        GtkWidget *close_button;
 
        WebKitDOMHTMLImageElement *image;
 };
 
->>>>>>> Make 'Image Properties' dialog work
 static void
 editor_image_dialog_set_src (EEditorImageDialog *dialog)
 {
@@ -138,10 +116,7 @@ editor_image_dialog_set_width_units (EEditorImageDialog *dialog)
        requested = gtk_spin_button_get_value_as_int (
                        GTK_SPIN_BUTTON (dialog->priv->width_edit));
 
-<<<<<<< HEAD
-=======
 
->>>>>>> Make 'Image Properties' dialog work
        switch (gtk_combo_box_get_active (
                GTK_COMBO_BOX (dialog->priv->width_units))) {
 
@@ -218,10 +193,7 @@ editor_image_dialog_set_height_units (EEditorImageDialog *dialog)
        requested = gtk_spin_button_get_value_as_int (
                        GTK_SPIN_BUTTON (dialog->priv->height_edit));
 
-<<<<<<< HEAD
-=======
 
->>>>>>> Make 'Image Properties' dialog work
        switch (gtk_combo_box_get_active (
                GTK_COMBO_BOX (dialog->priv->height_units))) {
 
@@ -302,31 +274,13 @@ editor_image_dialog_set_url (EEditorImageDialog *dialog)
        const gchar *url;
 
        url = gtk_entry_get_text (GTK_ENTRY (dialog->priv->url_edit));
-<<<<<<< HEAD
        link = e_editor_dom_node_find_parent_element (
-               WEBKIT_DOM_NODE (dialog->priv->image), "A");
-=======
-       link = e_editor_dom_node_get_parent_element (
-               (WebKitDOMNode *) dialog->priv->image,
-               WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
->>>>>>> Make 'Image Properties' dialog work
+               (WebKitDOMNode *) dialog->priv->image, "A");
 
        if (link) {
                if (!url || !*url) {
                        webkit_dom_node_insert_before (
                                webkit_dom_node_get_parent_node (
-<<<<<<< HEAD
-                                       WEBKIT_DOM_NODE (link)),
-                               WEBKIT_DOM_NODE (dialog->priv->image),
-                               WEBKIT_DOM_NODE (link), NULL);
-                       webkit_dom_node_remove_child (
-                               webkit_dom_node_get_parent_node (
-                                       WEBKIT_DOM_NODE (link)),
-                               WEBKIT_DOM_NODE (link), NULL);
-               } else {
-                       webkit_dom_html_anchor_element_set_href (
-                               WEBKIT_DOM_HTML_ANCHOR_ELEMENT (link), url);
-=======
                                        (WebKitDOMNode *) link),
                                (WebKitDOMNode *) dialog->priv->image,
                                (WebKitDOMNode *) link, NULL);
@@ -337,35 +291,17 @@ editor_image_dialog_set_url (EEditorImageDialog *dialog)
                } else {
                        webkit_dom_html_anchor_element_set_href (
                                (WebKitDOMHTMLAnchorElement *) link, url);
->>>>>>> Make 'Image Properties' dialog work
                }
        } else {
                if (url && *url) {
                        WebKitDOMDocument *document;
 
                        document = webkit_dom_node_get_owner_document (
-<<<<<<< HEAD
-                                       WEBKIT_DOM_NODE (dialog->priv->image));
-=======
                                        (WebKitDOMNode *) dialog->priv->image);
->>>>>>> Make 'Image Properties' dialog work
                        link = webkit_dom_document_create_element (
                                        document, "A", NULL);
 
                        webkit_dom_html_anchor_element_set_href (
-<<<<<<< HEAD
-                               WEBKIT_DOM_HTML_ANCHOR_ELEMENT (link), url);
-
-                       webkit_dom_node_insert_before (
-                               webkit_dom_node_get_parent_node (
-                                       WEBKIT_DOM_NODE (dialog->priv->image)),
-                               WEBKIT_DOM_NODE (link),
-                               WEBKIT_DOM_NODE (dialog->priv->image), NULL);
-
-                       webkit_dom_node_append_child (
-                               WEBKIT_DOM_NODE (link),
-                               WEBKIT_DOM_NODE (dialog->priv->image), NULL);
-=======
                                (WebKitDOMHTMLAnchorElement *) link, url);
 
                        webkit_dom_node_insert_before (
@@ -377,7 +313,6 @@ editor_image_dialog_set_url (EEditorImageDialog *dialog)
                        webkit_dom_node_append_child (
                                (WebKitDOMNode *) link,
                                (WebKitDOMNode *) dialog->priv->image, NULL);
->>>>>>> Make 'Image Properties' dialog work
                }
        }
 }
@@ -393,22 +328,14 @@ editor_image_dialog_test_url (EEditorImageDialog *dialog)
 }
 
 static void
-<<<<<<< HEAD
-editor_image_dialog_show (GtkWidget *widget)
-=======
 editor_image_dialog_show (GtkWidget *gtk_widget)
->>>>>>> Make 'Image Properties' dialog work
 {
        EEditorImageDialog *dialog;
        WebKitDOMElement *link;
        gchar *tmp;
        glong val;
 
-<<<<<<< HEAD
-       dialog = E_EDITOR_IMAGE_DIALOG (widget);
-=======
        dialog = E_EDITOR_IMAGE_DIALOG (gtk_widget);
->>>>>>> Make 'Image Properties' dialog work
 
        if (!dialog->priv->image) {
                return;
@@ -449,52 +376,17 @@ editor_image_dialog_show (GtkWidget *gtk_widget)
        gtk_spin_button_set_value (
                GTK_SPIN_BUTTON (dialog->priv->y_padding_edit), val);
 
-<<<<<<< HEAD
+
        link = e_editor_dom_node_find_parent_element (
                        WEBKIT_DOM_NODE (dialog->priv->image), "A");
        if (link) {
                tmp = webkit_dom_html_anchor_element_get_href (
-                               WEBKIT_DOM_HTML_ANCHOR_ELEMENT (link));
-=======
-
-       link = e_editor_dom_node_get_parent_element (
-               WEBKIT_DOM_NODE (dialog->priv->image), WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
-       if (link) {
-               tmp = webkit_dom_html_anchor_element_get_href (
                                (WebKitDOMHTMLAnchorElement *) link);
->>>>>>> Make 'Image Properties' dialog work
                gtk_entry_set_text (GTK_ENTRY (dialog->priv->url_edit), tmp);
                g_free (tmp);
        }
 
        /* Chain up to parent implementation */
-<<<<<<< HEAD
-       GTK_WIDGET_CLASS (e_editor_image_dialog_parent_class)->show (widget);
-}
-
-static void
-editor_image_dialog_hide (GtkWidget *widget)
-{
-       EEditorImageDialogPrivate *priv;
-
-       priv = E_EDITOR_IMAGE_DIALOG_GET_PRIVATE (widget);
-
-       priv->image = NULL;
-
-       GTK_WIDGET_CLASS (e_editor_image_dialog_parent_class)->hide (widget);
-}
-
-static void
-e_editor_image_dialog_class_init (EEditorImageDialogClass *class)
-{
-       GtkWidgetClass *widget_class;
-
-       g_type_class_add_private (class, sizeof (EEditorImageDialogPrivate));
-
-       widget_class = GTK_WIDGET_CLASS (class);
-       widget_class->show = editor_image_dialog_show;
-       widget_class->hide = editor_image_dialog_hide;
-=======
        GTK_WIDGET_CLASS (e_editor_image_dialog_parent_class)->show (gtk_widget);
 }
 
@@ -516,21 +408,11 @@ e_editor_image_dialog_class_init (EEditorImageDialogClass *klass)
 
        widget_class = GTK_WIDGET_CLASS (klass);
        widget_class->show = editor_image_dialog_show;
->>>>>>> Make 'Image Properties' dialog work
 }
 
 static void
 e_editor_image_dialog_init (EEditorImageDialog *dialog)
 {
-<<<<<<< HEAD
-       GtkGrid *main_layout, *grid;
-       GtkWidget *widget;
-       GtkFileFilter *file_filter;
-
-       dialog->priv = E_EDITOR_IMAGE_DIALOG_GET_PRIVATE (dialog);
-
-       main_layout = e_editor_dialog_get_container (E_EDITOR_DIALOG (dialog));
-=======
        GtkBox *main_layout;
        GtkGrid *grid;
        GtkWidget *widget;
@@ -542,26 +424,17 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
        main_layout = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 5));
        gtk_container_add (GTK_CONTAINER (dialog), GTK_WIDGET (main_layout));
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 10);
->>>>>>> Make 'Image Properties' dialog work
 
        /* == General == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>General</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 0, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make 'Image Properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 1, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
->>>>>>> Make 'Image Properties' dialog work
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        /* Source */
@@ -583,12 +456,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_src), dialog);
        dialog->priv->file_chooser = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Source:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Source:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->file_chooser);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
 
@@ -601,37 +469,21 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_alt), dialog);
        dialog->priv->description_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Description:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-       gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->description_edit);
-       gtk_grid_attach (grid, widget, 0, 1, 1, 1);
-
-=======
        widget = gtk_label_new_with_mnemonic (_("Description:"));
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->description_edit);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
 
 
->>>>>>> Make 'Image Properties' dialog work
        /* == Layout == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Layout</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 2, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make 'Image Properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 3, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
->>>>>>> Make 'Image Properties' dialog work
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        /* Width */
@@ -642,12 +494,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_width), dialog);
        dialog->priv->width_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Width:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Width:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->width_edit);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
 
@@ -670,12 +517,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_height), dialog);
        dialog->priv->height_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Height:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Height:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->height_edit);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
 
@@ -702,12 +544,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_alignment), dialog);
        dialog->priv->alignment = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Alignment"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Alignment"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->alignment);
        gtk_grid_attach (grid, widget, 0, 2, 1, 1);
 
@@ -719,12 +556,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_x_padding), dialog);
        dialog->priv->x_padding_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_X-Padding:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("X-Padding:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->x_padding_edit);
        gtk_grid_attach (grid, widget, 4, 0, 1, 1);
 
@@ -739,12 +571,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_y_padding), dialog);
        dialog->priv->y_padding_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Y-Padding:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Y-Padding:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->y_padding_edit);
        gtk_grid_attach (grid, widget, 4, 1, 1, 1);
 
@@ -759,12 +586,7 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_border), dialog);
        dialog->priv->border_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_Border:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
        widget = gtk_label_new_with_mnemonic (_("Border:"));
->>>>>>> Make 'Image Properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->border_edit);
        gtk_grid_attach (grid, widget, 4, 2, 1, 1);
 
@@ -775,20 +597,12 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Link</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 4, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make 'Image Properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 5, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
->>>>>>> Make 'Image Properties' dialog work
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        widget = gtk_entry_new ();
@@ -799,28 +613,17 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
                G_CALLBACK (editor_image_dialog_set_url), dialog);
        dialog->priv->url_edit = widget;
 
-<<<<<<< HEAD
-       widget = gtk_label_new_with_mnemonic (_("_URL:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-       gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->url_edit);
-       gtk_grid_attach (grid, widget, 0, 0, 1, 1);
-
-       widget = gtk_button_new_with_mnemonic (_("_Test URL..."));
-=======
        widget = gtk_label_new_with_mnemonic (_("URL:"));
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->url_edit);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
 
        widget = gtk_button_new_with_label (_("Test URL..."));
->>>>>>> Make 'Image Properties' dialog work
        gtk_grid_attach (grid, widget, 2, 0, 1, 1);
        g_signal_connect_swapped (
                widget, "clicked",
                G_CALLBACK (editor_image_dialog_test_url), dialog);
        dialog->priv->test_url_button = widget;
 
-<<<<<<< HEAD
-=======
        widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
        g_signal_connect_swapped (
                widget, "clicked",
@@ -832,7 +635,6 @@ e_editor_image_dialog_init (EEditorImageDialog *dialog)
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
        gtk_box_pack_start (GTK_BOX (widget), dialog->priv->close_button, FALSE, FALSE, 5);
 
->>>>>>> Make 'Image Properties' dialog work
        gtk_widget_show_all (GTK_WIDGET (main_layout));
 }
 
@@ -849,33 +651,18 @@ e_editor_image_dialog_new (EEditor *editor)
 
 void
 e_editor_image_dialog_show (EEditorImageDialog *dialog,
-<<<<<<< HEAD
-                            WebKitDOMNode *image)
-{
-       EEditorImageDialogClass *class;
-=======
                            WebKitDOMNode *image)
 {
        EEditorImageDialogClass *klass;
->>>>>>> Make 'Image Properties' dialog work
 
        g_return_if_fail (E_IS_EDITOR_IMAGE_DIALOG (dialog));
 
        if (image) {
-<<<<<<< HEAD
-               dialog->priv->image = WEBKIT_DOM_HTML_IMAGE_ELEMENT (image);
-=======
                dialog->priv->image = (WebKitDOMHTMLImageElement *) image;
->>>>>>> Make 'Image Properties' dialog work
        } else {
                dialog->priv->image = NULL;
        }
 
-<<<<<<< HEAD
-       class = E_EDITOR_IMAGE_DIALOG_GET_CLASS (dialog);
-       GTK_WIDGET_CLASS (class)->show (GTK_WIDGET (dialog));
-=======
        klass = E_EDITOR_IMAGE_DIALOG_GET_CLASS (dialog);
        GTK_WIDGET_CLASS (klass)->show (GTK_WIDGET (dialog));
->>>>>>> Make 'Image Properties' dialog work
 }
diff --git a/e-util/e-editor-link-dialog.c b/e-util/e-editor-link-dialog.c
index ce68c03..ae7707f 100644
--- a/e-util/e-editor-link-dialog.c
+++ b/e-util/e-editor-link-dialog.c
@@ -99,9 +99,8 @@ editor_link_dialog_ok (EEditorLinkDialog *dialog)
        }
 
        range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
-       link = e_editor_dom_node_get_parent_element (
-               webkit_dom_range_get_start_container (range, NULL),
-               WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+       link = e_editor_dom_node_find_parent_element (
+                       webkit_dom_range_get_start_container (range, NULL), "A");
        if (!link) {
                if ((webkit_dom_range_get_start_container (range, NULL) !=
                        webkit_dom_range_get_end_container (range, NULL)) ||
@@ -111,8 +110,7 @@ editor_link_dialog_ok (EEditorLinkDialog *dialog)
                        WebKitDOMDocumentFragment *fragment;
                        fragment = webkit_dom_range_extract_contents (range, NULL);
                        link = e_editor_dom_node_find_child_element (
-                               WEBKIT_DOM_NODE (fragment),
-                               WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+                               WEBKIT_DOM_NODE (fragment), "A");
                        webkit_dom_range_insert_node (
                                range, WEBKIT_DOM_NODE (fragment), NULL);
 
@@ -195,9 +193,8 @@ editor_link_dialog_show (GtkWidget *widget)
        }
 
        range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
-       link = e_editor_dom_node_get_parent_element (
-               webkit_dom_range_get_start_container (range, NULL),
-               WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+       link = e_editor_dom_node_find_parent_element (
+               webkit_dom_range_get_start_container (range, NULL), "A");
        if (!link) {
                if ((webkit_dom_range_get_start_container (range, NULL) !=
                        webkit_dom_range_get_end_container (range, NULL)) ||
@@ -207,8 +204,7 @@ editor_link_dialog_show (GtkWidget *widget)
                        WebKitDOMDocumentFragment *fragment;
                        fragment = webkit_dom_range_clone_contents (range, NULL);
                        link = e_editor_dom_node_find_child_element (
-                               WEBKIT_DOM_NODE (fragment),
-                               WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+                                       WEBKIT_DOM_NODE (fragment), "A");
                }
        }
 
diff --git a/e-util/e-editor-selection.c b/e-util/e-editor-selection.c
index fd41431..b10d56d 100644
--- a/e-util/e-editor-selection.c
+++ b/e-util/e-editor-selection.c
@@ -169,8 +169,7 @@ get_font_property (EEditorSelection *selection,
        }
 
        node = webkit_dom_range_get_common_ancestor_container (range, NULL);
-       element = e_editor_dom_node_get_parent_element (
-                       node, WEBKIT_TYPE_DOM_HTML_FONT_ELEMENT);
+       element = e_editor_dom_node_find_parent_element (node, "FONT");
        if (!element) {
                return NULL;
        }
diff --git a/e-util/e-editor-table-dialog.c b/e-util/e-editor-table-dialog.c
index 06e4a80..20fde99 100644
--- a/e-util/e-editor-table-dialog.c
+++ b/e-util/e-editor-table-dialog.c
@@ -1,11 +1,6 @@
 /*
  * e-editor-table-dialog.h
  *
-<<<<<<< HEAD
- * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
- *
-=======
->>>>>>> Make the 'Table properties' dialog work
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -34,16 +29,10 @@
 #include "e-image-chooser-dialog.h"
 #include "e-misc-utils.h"
 
-<<<<<<< HEAD
-#define E_EDITOR_TABLE_DIALOG_GET_PRIVATE(obj) \
-       (G_TYPE_INSTANCE_GET_PRIVATE \
-       ((obj), E_TYPE_EDITOR_TABLE_DIALOG, EEditorTableDialogPrivate))
-=======
 G_DEFINE_TYPE (
        EEditorTableDialog,
        e_editor_table_dialog,
        E_TYPE_EDITOR_DIALOG);
->>>>>>> Make the 'Table properties' dialog work
 
 struct _EEditorTableDialogPrivate {
        GtkWidget *rows_edit;
@@ -63,24 +52,13 @@ struct _EEditorTableDialogPrivate {
        GtkWidget *background_image_button;
        GtkWidget *image_chooser_dialog;
 
-<<<<<<< HEAD
-=======
        GtkWidget *close_button;
 
->>>>>>> Make the 'Table properties' dialog work
        WebKitDOMHTMLTableElement *table_element;
 };
 
 static GdkRGBA white = { 1, 1, 1, 1 };
 
-<<<<<<< HEAD
-G_DEFINE_TYPE (
-       EEditorTableDialog,
-       e_editor_table_dialog,
-       E_TYPE_EDITOR_DIALOG);
-
-=======
->>>>>>> Make the 'Table properties' dialog work
 static WebKitDOMElement *
 editor_table_dialog_create_table (EEditorTableDialog *dialog)
 {
@@ -106,19 +84,11 @@ editor_table_dialog_create_table (EEditorTableDialog *dialog)
                gint j;
 
                row = webkit_dom_html_table_element_insert_row (
-<<<<<<< HEAD
-                       WEBKIT_DOM_HTML_TABLE_ELEMENT (table), -1, NULL);
-
-               for (j = 0; j < 3; j++) {
-                       webkit_dom_html_table_row_element_insert_cell (
-                               WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), -1, NULL);
-=======
                        (WebKitDOMHTMLTableElement *) table, -1, NULL);
 
                for (j = 0; j < 3; j++) {
                        webkit_dom_html_table_row_element_insert_cell (
                                (WebKitDOMHTMLTableRowElement *) row, -1, NULL);
->>>>>>> Make the 'Table properties' dialog work
                }
        }
 
@@ -185,11 +155,7 @@ editor_table_dialog_set_column_count (EEditorTableDialog *dialog)
                WebKitDOMHTMLCollection *cells;
                gulong jj, current_columns;
 
-<<<<<<< HEAD
-               row = WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (
-=======
                row = (WebKitDOMHTMLTableRowElement *) (
->>>>>>> Make the 'Table properties' dialog work
                        webkit_dom_html_collection_item (rows, ii));
 
                cells = webkit_dom_html_table_row_element_get_cells (row);
@@ -221,11 +187,7 @@ editor_table_dialog_get_column_count (EEditorTableDialog *dialog)
        row = webkit_dom_html_collection_item (rows, 0);
 
        columns = webkit_dom_html_table_row_element_get_cells (
-<<<<<<< HEAD
-                               WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row));
-=======
                                (WebKitDOMHTMLTableRowElement *) row);
->>>>>>> Make the 'Table properties' dialog work
 
        gtk_spin_button_set_value (
                GTK_SPIN_BUTTON (dialog->priv->columns_edit),
@@ -241,25 +203,13 @@ editor_table_dialog_set_width (EEditorTableDialog *dialog)
 
        if (gtk_toggle_button_get_active (
                        GTK_TOGGLE_BUTTON (dialog->priv->width_check))) {
-<<<<<<< HEAD
-               gchar *units;
-
-               units = gtk_combo_box_text_get_active_text (
-                               GTK_COMBO_BOX_TEXT (dialog->priv->width_units));
-=======
 
->>>>>>> Make the 'Table properties' dialog work
                width = g_strdup_printf (
                        "%d%s",
                        gtk_spin_button_get_value_as_int (
                                GTK_SPIN_BUTTON (dialog->priv->width_edit)),
-<<<<<<< HEAD
-                       units);
-               g_free (units);
-=======
                        gtk_combo_box_text_get_active_text (
                                GTK_COMBO_BOX_TEXT (dialog->priv->width_units)));
->>>>>>> Make the 'Table properties' dialog work
 
                gtk_widget_set_sensitive (dialog->priv->width_edit, TRUE);
                gtk_widget_set_sensitive (dialog->priv->width_units, TRUE);
@@ -300,10 +250,6 @@ editor_table_dialog_get_width (EEditorTableDialog *dialog)
                        ((strstr (width, "%") == NULL) ?
                                "units-px" : "units-percent"));
        }
-<<<<<<< HEAD
-       g_free (width);
-=======
->>>>>>> Make the 'Table properties' dialog work
 }
 
 static void
@@ -340,12 +286,7 @@ editor_table_dialog_set_padding (EEditorTableDialog *dialog)
 
        g_return_if_fail (dialog->priv->table_element);
 
-<<<<<<< HEAD
-       padding = g_strdup_printf (
-               "%d",
-=======
        padding = g_strdup_printf ("%d",
->>>>>>> Make the 'Table properties' dialog work
                        gtk_spin_button_get_value_as_int (
                                GTK_SPIN_BUTTON (dialog->priv->padding_edit)));
 
@@ -384,12 +325,7 @@ editor_table_dialog_set_spacing (EEditorTableDialog *dialog)
 
        g_return_if_fail (dialog->priv->table_element);
 
-<<<<<<< HEAD
-       spacing = g_strdup_printf (
-               "%d",
-=======
        spacing = g_strdup_printf ("%d",
->>>>>>> Make the 'Table properties' dialog work
                        gtk_spin_button_get_value_as_int (
                                GTK_SPIN_BUTTON (dialog->priv->spacing_edit)));
 
@@ -428,12 +364,7 @@ editor_table_dialog_set_border (EEditorTableDialog *dialog)
 
        g_return_if_fail (dialog->priv->table_element);
 
-<<<<<<< HEAD
-       border = g_strdup_printf (
-               "%d",
-=======
        border = g_strdup_printf ("%d",
->>>>>>> Make the 'Table properties' dialog work
                        gtk_spin_button_get_value_as_int (
                                GTK_SPIN_BUTTON (dialog->priv->border_edit)));
 
@@ -532,11 +463,7 @@ editor_table_dialog_get_background_image (EEditorTableDialog *dialog)
        if (!webkit_dom_element_has_attribute (
                WEBKIT_DOM_ELEMENT (dialog->priv->table_element), "background")) {
 
-<<<<<<< HEAD
-               gtk_file_chooser_unselect_all (
-=======
                gtk_file_chooser_unselect_all(
->>>>>>> Make the 'Table properties' dialog work
                        GTK_FILE_CHOOSER (dialog->priv->background_image_button));
                return;
        } else {
@@ -554,8 +481,6 @@ editor_table_dialog_get_background_image (EEditorTableDialog *dialog)
 }
 
 static void
-<<<<<<< HEAD
-=======
 editor_table_dialog_close (EEditorTableDialog *dialog)
 {
        gtk_widget_hide (GTK_WIDGET (dialog));
@@ -564,7 +489,6 @@ editor_table_dialog_close (EEditorTableDialog *dialog)
 }
 
 static void
->>>>>>> Make the 'Table properties' dialog work
 editor_table_dialog_get_values (EEditorTableDialog *dialog)
 {
        editor_table_dialog_get_row_count (dialog);
@@ -618,10 +542,7 @@ editor_table_dialog_reset_values (EEditorTableDialog *dialog)
        editor_table_dialog_set_background_image (dialog);
 }
 
-<<<<<<< HEAD
-=======
 
->>>>>>> Make the 'Table properties' dialog work
 static void
 editor_table_dialog_show (GtkWidget *widget)
 {
@@ -644,30 +565,16 @@ editor_table_dialog_show (GtkWidget *widget)
                WebKitDOMRange *range;
 
                range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
-<<<<<<< HEAD
                table = e_editor_dom_node_find_parent_element (
                        webkit_dom_range_get_start_container (range, NULL), "TABLE");
 
                if (!table) {
-                       dialog->priv->table_element = WEBKIT_DOM_HTML_TABLE_ELEMENT (
-                               editor_table_dialog_create_table (dialog));
-                       editor_table_dialog_reset_values (dialog);
-               } else {
-                       dialog->priv->table_element =
-                               WEBKIT_DOM_HTML_TABLE_ELEMENT (table);
-=======
-               table = e_editor_dom_node_get_parent_element (
-                       webkit_dom_range_get_start_container (range, NULL),
-                       WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT);
-
-               if (!table) {
                        dialog->priv->table_element = (WebKitDOMHTMLTableElement *)
                                editor_table_dialog_create_table (dialog);
                        editor_table_dialog_reset_values (dialog);
                } else {
                        dialog->priv->table_element =
                                (WebKitDOMHTMLTableElement *) table;
->>>>>>> Make the 'Table properties' dialog work
                        editor_table_dialog_get_values (dialog);
                }
        }
@@ -677,29 +584,6 @@ editor_table_dialog_show (GtkWidget *widget)
 }
 
 static void
-<<<<<<< HEAD
-editor_table_dialog_hide (GtkWidget *widget)
-{
-       EEditorTableDialogPrivate *priv;
-
-       priv = E_EDITOR_TABLE_DIALOG_GET_PRIVATE (widget);
-
-       priv->table_element = NULL;
-
-       GTK_WIDGET_CLASS (e_editor_table_dialog_parent_class)->hide (widget);
-}
-
-static void
-e_editor_table_dialog_class_init (EEditorTableDialogClass *class)
-{
-       GtkWidgetClass *widget_class;
-
-       g_type_class_add_private (class, sizeof (EEditorTableDialogPrivate));
-
-       widget_class = GTK_WIDGET_CLASS (class);
-       widget_class->show = editor_table_dialog_show;
-       widget_class->hide = editor_table_dialog_hide;
-=======
 e_editor_table_dialog_class_init (EEditorTableDialogClass *klass)
 {
        GtkWidgetClass *widget_class;
@@ -709,21 +593,11 @@ e_editor_table_dialog_class_init (EEditorTableDialogClass *klass)
 
        widget_class = GTK_WIDGET_CLASS (klass);
        widget_class->show = editor_table_dialog_show;
->>>>>>> Make the 'Table properties' dialog work
 }
 
 static void
 e_editor_table_dialog_init (EEditorTableDialog *dialog)
 {
-<<<<<<< HEAD
-       GtkGrid *main_layout, *grid;
-       GtkWidget *widget;
-       GtkFileFilter *file_filter;
-
-       dialog->priv = E_EDITOR_TABLE_DIALOG_GET_PRIVATE (dialog);
-
-       main_layout = e_editor_dialog_get_container (E_EDITOR_DIALOG (dialog));
-=======
        GtkBox *main_layout, *box;
        GtkGrid *grid;
        GtkWidget *widget;
@@ -735,26 +609,17 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        main_layout = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 5));
        gtk_container_add (GTK_CONTAINER (dialog), GTK_WIDGET (main_layout));
        gtk_container_set_border_width (GTK_CONTAINER (dialog), 10);
->>>>>>> Make the 'Table properties' dialog work
 
        /* == General == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>General</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 0, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make the 'Table properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 1, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
->>>>>>> Make the 'Table properties' dialog work
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        /* Rows */
@@ -770,10 +635,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->rows_edit = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Rows:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->rows_edit);
        gtk_grid_attach (grid, widget, 1, 0, 1, 1);
 
@@ -790,43 +651,24 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->columns_edit = widget;
 
        widget = gtk_label_new_with_mnemonic (_("C_olumns:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-       gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->columns_edit);
-       gtk_grid_attach (grid, widget, 4, 0, 1, 1);
-
-=======
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->columns_edit);
        gtk_grid_attach (grid, widget, 4, 0, 1, 1);
 
 
->>>>>>> Make the 'Table properties' dialog work
        /* == Layout == */
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Layout</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 2, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make the 'Table properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 3, 1, 1);
-       gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
-
-       /* Width */
-       widget = gtk_check_button_new_with_mnemonic (_("_Width:"));
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        /* Width */
        widget = gtk_check_button_new_with_mnemonic (_("Width:"));
->>>>>>> Make the 'Table properties' dialog work
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
        g_signal_connect_swapped (
                widget, "toggled",
@@ -860,10 +702,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->spacing_edit = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Spacing:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->spacing_edit);
        gtk_grid_attach (grid, widget, 4, 0, 1, 1);
 
@@ -880,10 +718,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->padding_edit = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Padding:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->padding_edit);
        gtk_grid_attach (grid, widget, 4, 1, 1, 1);
 
@@ -900,10 +734,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->border_edit = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Border:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->border_edit);
        gtk_grid_attach (grid, widget, 4, 2, 1, 1);
 
@@ -922,10 +752,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->alignment_combo = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Alignment:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->alignment_combo);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
 
@@ -933,20 +759,12 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        widget = gtk_label_new ("");
        gtk_label_set_markup (GTK_LABEL (widget), _("<b>Background</b>"));
        gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, widget, 0, 4, 1, 1);
-=======
        gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 5);
->>>>>>> Make the 'Table properties' dialog work
 
        grid = GTK_GRID (gtk_grid_new ());
        gtk_grid_set_row_spacing (grid, 5);
        gtk_grid_set_column_spacing (grid, 5);
-<<<<<<< HEAD
-       gtk_grid_attach (main_layout, GTK_WIDGET (grid), 0, 5, 1, 1);
-=======
        gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 0);
->>>>>>> Make the 'Table properties' dialog work
        gtk_widget_set_margin_left (GTK_WIDGET (grid), 10);
 
        /* Color */
@@ -960,10 +778,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
        dialog->priv->background_color_button = widget;
 
        widget = gtk_label_new_with_mnemonic (_("_Color:"));
-<<<<<<< HEAD
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (
                GTK_LABEL (widget), dialog->priv->background_color_button);
        gtk_grid_attach (grid, widget, 0, 0, 1, 1);
@@ -988,19 +802,12 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
                G_CALLBACK (editor_table_dialog_set_background_image), dialog);
        dialog->priv->background_image_button = widget;
 
-<<<<<<< HEAD
-       widget =gtk_label_new_with_mnemonic (_("Image:"));
-       gtk_label_set_justify (GTK_LABEL (widget), GTK_JUSTIFY_RIGHT);
-=======
 
        widget =gtk_label_new_with_mnemonic (_("Image:"));
->>>>>>> Make the 'Table properties' dialog work
        gtk_label_set_mnemonic_widget (
                GTK_LABEL (widget), dialog->priv->background_image_button);
        gtk_grid_attach (grid, widget, 0, 1, 1, 1);
 
-<<<<<<< HEAD
-=======
        /* == Button box == */
        box = GTK_BOX (gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL));
        gtk_button_box_set_layout (GTK_BUTTON_BOX (box), GTK_BUTTONBOX_END);
@@ -1013,7 +820,6 @@ e_editor_table_dialog_init (EEditorTableDialog *dialog)
                G_CALLBACK (editor_table_dialog_close), dialog);
        dialog->priv->close_button = widget;
 
->>>>>>> Make the 'Table properties' dialog work
        gtk_widget_show_all (GTK_WIDGET (main_layout));
 }
 
@@ -1025,10 +831,6 @@ e_editor_table_dialog_new (EEditor *editor)
                        E_TYPE_EDITOR_TABLE_DIALOG,
                        "editor", editor,
                        "title", N_("Table Properties"),
-<<<<<<< HEAD
-                       NULL));
-=======
                        NULL)); 
->>>>>>> Make the 'Table properties' dialog work
 }
 
diff --git a/e-util/e-editor-utils.c b/e-util/e-editor-utils.c
index 29ca04c..5daabff 100644
--- a/e-util/e-editor-utils.c
+++ b/e-util/e-editor-utils.c
@@ -21,16 +21,31 @@
 #endif
 
 #include "e-editor-utils.h"
-
+#include <string.h>
 
 WebKitDOMElement *
-e_editor_dom_node_get_parent_element (WebKitDOMNode *node,
-                                     GType parent_type)
+e_editor_dom_node_find_parent_element (WebKitDOMNode *node,
+                                      const gchar *tagname)
 {
+       gint taglen = strlen (tagname);
+
        while (node) {
 
-               if (G_TYPE_CHECK_INSTANCE_TYPE (node, parent_type))
-                       return (WebKitDOMElement *) node;
+               if (WEBKIT_DOM_IS_ELEMENT (node)) {
+                       gchar *node_tagname;
+
+                       node_tagname = webkit_dom_element_get_tag_name (
+                                               WEBKIT_DOM_ELEMENT (node));
+
+                       if (node_tagname &&
+                           (strlen (node_tagname) == taglen) &&
+                           (g_ascii_strncasecmp (node_tagname, tagname, taglen) == 0)) {
+                               g_free (node_tagname);
+                               return (WebKitDOMElement *) node;
+                       }
+
+                       g_free (node_tagname);
+               }
 
                node = (WebKitDOMNode *) webkit_dom_node_get_parent_element (node);
        }
@@ -40,13 +55,26 @@ e_editor_dom_node_get_parent_element (WebKitDOMNode *node,
 
 WebKitDOMElement *
 e_editor_dom_node_find_child_element (WebKitDOMNode *node,
-                                     GType child_type)
+                                     const gchar *tagname)
 {
        WebKitDOMNode *start_node = node;
+       gint taglen = strlen (tagname);
 
        do {
-               if (G_TYPE_CHECK_INSTANCE_TYPE (node, child_type)) {
-                       return WEBKIT_DOM_ELEMENT (node);
+               if (WEBKIT_DOM_IS_ELEMENT (node)) {
+                       gchar *node_tagname;
+
+                       node_tagname = webkit_dom_element_get_tag_name (
+                                       WEBKIT_DOM_ELEMENT (node));
+
+                       if (node_tagname &&
+                           (strlen (node_tagname) == taglen) &&
+                           (g_ascii_strncasecmp (node_tagname, tagname, taglen) == 0)) {
+                               g_free (node_tagname);
+                               return (WebKitDOMElement *) node;
+                       }
+
+                       g_free (node_tagname);
                }
 
                if (webkit_dom_node_has_child_nodes (node)) {
diff --git a/e-util/e-editor-utils.h b/e-util/e-editor-utils.h
index 143f8c2..5e370c7 100644
--- a/e-util/e-editor-utils.h
+++ b/e-util/e-editor-utils.h
@@ -1,11 +1,6 @@
 /*
  * e-editor-utils.h
  *
-<<<<<<< HEAD
- * Copyright (C) 2012 Dan Vrátil <dvratil redhat com>
- *
-=======
->>>>>>> Make the URL editor work
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -30,28 +25,12 @@
 
 #include <webkit/webkitdom.h>
 
-<<<<<<< HEAD
-G_BEGIN_DECLS
-
-WebKitDOMElement *
-               e_editor_dom_node_find_parent_element
-                                               (WebKitDOMNode *node,
-                                                const gchar *tagname);
-
-WebKitDOMElement *
-               e_editor_dom_node_find_child_element
-                                               (WebKitDOMNode *node,
-                                                const gchar *tagname);
-
-G_END_DECLS
-=======
-WebKitDOMElement *     e_editor_dom_node_get_parent_element
+WebKitDOMElement *     e_editor_dom_node_find_parent_element
                                                        (WebKitDOMNode *node,
-                                                        GType parent_type);
->>>>>>> Make the URL editor work
+                                                        const gchar *tagname);
 
 WebKitDOMElement *     e_editor_dom_node_find_child_element
                                                        (WebKitDOMNode *node,
-                                                        GType child_type);
+                                                        const gchar *tagname);
 
 #endif /* E_EDITOR_UTILS_H */
diff --git a/e-util/e-editor.c b/e-util/e-editor.c
index 7bf3484..bf433d8 100644
--- a/e-util/e-editor.c
+++ b/e-util/e-editor.c
@@ -96,13 +96,13 @@ editor_update_actions (EEditor *editor,
         *   - Cursor is on a link.
         *   - Cursor is on an image that has a URL or target.
         */
-       visible = (e_editor_dom_node_get_parent_element (
-                       node, WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT) != NULL);
+       visible = (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (node) ||
+                  (e_editor_dom_node_find_parent_element (node, "A") != NULL));
        gtk_action_set_visible (ACTION (CONTEXT_REMOVE_LINK), visible);
 
 
-       visible = (e_editor_dom_node_get_parent_element (
-                       node, WEBKIT_TYPE_DOM_HTML_TABLE_CELL_ELEMENT) != NULL);
+       visible = (WEBKIT_DOM_IS_HTML_TABLE_CELL_ELEMENT (node) ||
+                  (e_editor_dom_node_find_parent_element (node, "TD") != NULL));
        gtk_action_set_visible (ACTION (CONTEXT_DELETE_CELL), visible);
        gtk_action_set_visible (ACTION (CONTEXT_DELETE_COLUMN), visible);
        gtk_action_set_visible (ACTION (CONTEXT_DELETE_ROW), visible);
@@ -115,8 +115,8 @@ editor_update_actions (EEditor *editor,
        gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_CELL), visible);
 
        /* Note the |= (cursor must be in a table cell). */
-       visible |= (e_editor_dom_node_get_parent_element (
-                       node, WEBKIT_TYPE_DOM_HTML_TABLE_ELEMENT) != NULL);
+       visible |= (WEBKIT_DOM_IS_HTML_TABLE_ELEMENT (node) ||
+                   (e_editor_dom_node_find_parent_element (node, "TABLE") != NULL));
        gtk_action_set_visible (ACTION (CONTEXT_PROPERTIES_TABLE), visible);
 
        /********************** Spell Check Suggestions **********************/


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