[evolution/wip/webkit-composer: 94/372] Make horizontal rule dialog work
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit-composer: 94/372] Make horizontal rule dialog work
- Date: Thu, 6 Feb 2014 11:31:24 +0000 (UTC)
commit 034706adc422ac5676050e863e4dd1ffc07b9990
Author: Dan Vrátil <dvratil redhat com>
Date: Tue Aug 7 16:38:51 2012 +0200
Make horizontal rule dialog work
The dialog is represented by EEditorHRuleDialog class which
implements all the functionality.
e-util/Makefile.am | 2 +
e-util/e-editor-actions.c | 20 +-
e-util/e-editor-actions.h | 8 -
e-util/e-editor-builder.ui | 418 ----------------------------------------
e-util/e-editor-hrule-dialog.c | 416 +++++++++++++++++++++++++++++++++++++++
e-util/e-editor-hrule-dialog.h | 69 +++++++
e-util/e-editor-link-dialog.c | 59 ++----
e-util/e-editor-private.h | 2 +
e-util/e-editor-utils.c | 24 +++
e-util/e-editor-utils.h | 4 +
e-util/e-editor-widgets.h | 24 ---
e-util/e-util.h | 1 +
12 files changed, 545 insertions(+), 502 deletions(-)
---
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index b0e9c57..d851a2e 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -180,6 +180,7 @@ evolution_util_include_HEADERS = \
e-editor-actions.h \
e-editor-dialog.h \
e-editor-find-dialog.h \
+ e-editor-hrule-dialog.h \
e-editor-link-dialog.h \
e-editor-replace-dialog.h \
e-editor-selection.h \
@@ -443,6 +444,7 @@ libevolution_util_la_SOURCES = \
e-editor-actions.c \
e-editor-dialog.c \
e-editor-find-dialog.c \
+ e-editor-hrule-dialog.c \
e-editor-link-dialog.c \
e-editor-private.h \
e-editor-replace-dialog.c \
diff --git a/e-util/e-editor-actions.c b/e-util/e-editor-actions.c
index adb40e2..b6f6c2f 100644
--- a/e-util/e-editor-actions.c
+++ b/e-util/e-editor-actions.c
@@ -685,15 +685,12 @@ static void
action_insert_rule_cb (GtkAction *action,
EEditor *editor)
{
- WebKitDOMDocument *document;
-
- document = webkit_web_view_get_dom_document (
- WEBKIT_WEB_VIEW (e_editor_get_editor_widget (editor)));
- webkit_dom_document_exec_command (
- document, "insertHorizontalRule", FALSE, "");
+ if (editor->priv->hrule_dialog == NULL) {
+ editor->priv->hrule_dialog =
+ e_editor_hrule_dialog_new (editor);
+ }
- /* FIXME WEBKIT - does the action work? */
- gtk_action_activate (ACTION (PROPERTIES_RULE));
+ gtk_window_present (GTK_WINDOW (editor->priv->hrule_dialog));
}
static void
@@ -995,7 +992,12 @@ static void
action_properties_rule_cb (GtkAction *action,
EEditor *editor)
{
- gtk_window_present (GTK_WINDOW (WIDGET (RULE_PROPERTIES_WINDOW)));
+ if (editor->priv->hrule_dialog == NULL) {
+ editor->priv->hrule_dialog =
+ e_editor_hrule_dialog_new (editor);
+ }
+
+ gtk_window_present (GTK_WINDOW (editor->priv->hrule_dialog));
}
static void
diff --git a/e-util/e-editor-actions.h b/e-util/e-editor-actions.h
index 60c92f5..e88a6a2 100644
--- a/e-util/e-editor-actions.h
+++ b/e-util/e-editor-actions.h
@@ -26,14 +26,6 @@
#define E_EDITOR_ACTION_BOLD(editor) \
E_EDITOR_ACTION ((editor), "bold")
-#define E_EDITOR_ACTION_CONFIRM_REPLACE(editor) \
- E_EDITOR_ACTION ((editor), "confirm-replace")
-#define E_EDITOR_ACTION_CONFIRM_REPLACE_ALL(editor) \
- E_EDITOR_ACTION ((editor), "confirm-replace-all")
-#define E_EDITOR_ACTION_CONFIRM_REPLACE_CANCEL(editor) \
- E_EDITOR_ACTION ((editor), "confirm-replace-cancel")
-#define E_EDITOR_ACTION_CONFIRM_REPLACE_NEXT(editor) \
- E_EDITOR_ACTION ((editor), "confirm-replace-next")
#define E_EDITOR_ACTION_CONTEXT_DELETE_CELL(editor) \
E_EDITOR_ACTION ((editor), "context-delete-cell")
#define E_EDITOR_ACTION_CONTEXT_DELETE_COLUMN(editor) \
diff --git a/e-util/e-editor-builder.ui b/e-util/e-editor-builder.ui
index 5414238..c81bdde 100644
--- a/e-util/e-editor-builder.ui
+++ b/e-util/e-editor-builder.ui
@@ -129,19 +129,6 @@
<property name="page_size">0</property>
<property name="value">0</property>
</object>
- <object class="GtkListStore" id="model1">
- <columns>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">px</col>
- </row>
- <row>
- <col id="0" translatable="yes">%</col>
- </row>
- </data>
- </object>
<object class="GtkListStore" id="model10">
<columns>
<column type="gchararray"/>
@@ -174,22 +161,6 @@
</row>
</data>
</object>
- <object class="GtkListStore" id="model2">
- <columns>
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes">Left</col>
- </row>
- <row>
- <col id="0" translatable="yes">Center</col>
- </row>
- <row>
- <col id="0" translatable="yes">Right</col>
- </row>
- </data>
- </object>
<object class="GtkListStore" id="model3">
<columns>
<column type="gchararray"/>
@@ -760,395 +731,6 @@
</object>
</child>
</object>
- <object class="GtkWindow" id="link-properties-window">
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
- <property name="title" translatable="yes">Link Properties</property>
- <property name="modal">True</property>
- <property name="window_position">GTK_WIN_POS_CENTER</property>
- <property name="destroy_with_parent">True</property>
- <signal handler="gtkhtml_editor_link_properties_show_window_cb" name="show"/>
- <signal handler="gtk_widget_hide_on_delete" name="delete_event"/>
- <child>
- <object class="GtkVBox" id="link-properties-vbox">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="border_width">12</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkTable" id="link-properties-table">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="link-properties-url-label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_URL:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">link-properties-url-entry</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="link-properties-description-label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">_Description:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">link-properties-description-entry</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="link-properties-url-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal handler="gtkhtml_editor_link_properties_url_changed_cb" name="changed"
object="link-properties-window"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="link-properties-description-entry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal handler="gtkhtml_editor_link_properties_description_changed_cb" name="changed"
object="link-properties-window"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="link-properties-test-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- </object>
- </child>
- <child>
- <object class="GtkHButtonBox" id="link-properties-button-box">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">6</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <object class="GtkButton" id="link-properties-close-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <signal handler="gtk_widget_hide" name="clicked" object="link-properties-window"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <object class="GtkWindow" id="rule-properties-window">
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
- <property name="border_width">12</property>
- <property name="title" translatable="yes" comments="Translators: Caption of a window. 'Rule' here means
a horizontal line in an HTML text.">Rule Properties</property>
- <property name="resizable">False</property>
- <property name="modal">True</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="destroy_with_parent">True</property>
- <signal handler="gtkhtml_editor_rule_properties_show_window_cb" name="show"/>
- <signal handler="gtk_widget_hide_on_delete" name="delete_event"/>
- <child>
- <object class="GtkVBox" id="rule-properties-vbox">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkVBox" id="rule-properties-size-vbox">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="rule-properties-size-header">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Size</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkAlignment" id="rule-properties-size-alignment">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkTable" id="rule-properties-size-table">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <placeholder/>
- </child>
- <child>
- <object class="GtkLabel" id="rule-properties-width-label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Width:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="rule-properties-width-spin-button">
- <property name="width_request">100</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">adjustment1</property>
- <signal handler="gtkhtml_editor_rule_properties_width_changed_cb"
name="value_changed" object="rule-properties-window"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="rule-properties-size-label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Size:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkSpinButton" id="rule-properties-size-spin-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="adjustment">adjustment2</property>
- <signal handler="gtkhtml_editor_rule_properties_size_changed_cb"
name="value_changed" object="rule-properties-window"/>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="rule-properties-width-combo-box">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal handler="gtkhtml_editor_rule_properties_width_changed_cb" name="changed"
object="rule-properties-window"/>
- <property name="model">model1</property>
- <child>
- <object class="GtkCellRendererText" id="renderer1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkVBox" id="rule-properties-style-vbox">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkLabel" id="rule-properties-style-header">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Style</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- <child>
- <object class="GtkAlignment" id="rule-properties-style-alignment">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkTable" id="rule-properties-style-table">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="rule-properties-alignment-label">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Alignment:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="x_options"/>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="rule-properties-alignment-combo-box">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal handler="gtkhtml_editor_rule_properties_alignment_changed_cb" name="changed"
object="rule-properties-window"/>
- <property name="model">model2</property>
- <child>
- <object class="GtkCellRendererText" id="renderer2"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="rule-properties-shaded-check-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label" translatable="yes">S_haded</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- <signal handler="gtkhtml_editor_rule_properties_shaded_toggled_cb" name="toggled"
object="rule-properties-window"/>
- </object>
- <packing>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"/>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkHButtonBox" id="rule-properties-button-box">
- <property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="spacing">12</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <child>
- <object class="GtkButton" id="rule-properties-close-button">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">True</property>
- <signal handler="gtk_widget_hide" name="clicked" object="rule-properties-window"/>
- </object>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">GTK_PACK_END</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
<object class="GtkWindow" id="table-properties-window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">12</property>
diff --git a/e-util/e-editor-hrule-dialog.c b/e-util/e-editor-hrule-dialog.c
new file mode 100644
index 0000000..4c2e5a7
--- /dev/null
+++ b/e-util/e-editor-hrule-dialog.c
@@ -0,0 +1,416 @@
+/*
+ * e-editor-hrule-dialog.h
+ *
+ * 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
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "e-editor-hrule-dialog.h"
+#include "e-editor-utils.h"
+
+#include <glib/gi18n-lib.h>
+#include <webkit/webkitdom.h>
+#include <stdlib.h>
+
+G_DEFINE_TYPE (
+ EEditorHRuleDialog,
+ e_editor_hrule_dialog,
+ E_TYPE_EDITOR_DIALOG);
+
+struct _EEditorHRuleDialogPrivate {
+ GtkWidget *width_edit;
+ GtkWidget *size_edit;
+ GtkWidget *unit_combo;
+
+ GtkWidget *alignment_combo;
+ GtkWidget *shaded_check;
+
+ GtkWidget *close_button;
+
+ WebKitDOMHTMLHRElement *hr_element;
+};
+
+static void
+editor_hrule_dialog_set_alignment (EEditorHRuleDialog *dialog)
+{
+ const gchar *alignment;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ alignment = gtk_combo_box_text_get_active_text (
+ GTK_COMBO_BOX_TEXT (dialog->priv->alignment_combo));
+
+ webkit_dom_htmlhr_element_set_align (dialog->priv->hr_element, alignment);
+}
+
+static void
+editor_hrule_dialog_get_alignment (EEditorHRuleDialog *dialog)
+{
+ gchar *alignment;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ alignment = webkit_dom_htmlhr_element_get_align (dialog->priv->hr_element);
+
+ gtk_combo_box_set_active_id (
+ GTK_COMBO_BOX (dialog->priv->alignment_combo), alignment);
+ g_free (alignment);
+}
+
+static void
+editor_hrule_dialog_set_size (EEditorHRuleDialog *dialog)
+{
+ gchar *size;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ size = g_strdup_printf (
+ "%d",
+ (gint) gtk_spin_button_get_value (
+ GTK_SPIN_BUTTON (dialog->priv->size_edit)));
+
+ webkit_dom_htmlhr_element_set_size (dialog->priv->hr_element, size);
+
+ g_free (size);
+}
+
+static void
+editor_hrule_dialog_get_size (EEditorHRuleDialog *dialog)
+{
+ gchar *size;
+ gint size_int = 0;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ size = webkit_dom_htmlhr_element_get_size (dialog->priv->hr_element);
+ if (size && *size) {
+ size_int = atoi (size);
+ }
+
+ if (size_int == 0) {
+ size_int = 2;
+ }
+
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (dialog->priv->size_edit), (gdouble) size_int);
+
+ g_free (size);
+}
+
+static void
+editor_hrule_dialog_set_width (EEditorHRuleDialog *dialog)
+{
+ gchar *width;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ width = g_strdup_printf (
+ "%d%s",
+ (gint) gtk_spin_button_get_value (
+ GTK_SPIN_BUTTON (dialog->priv->width_edit)),
+ 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);
+
+ g_free (width);
+}
+
+static void
+editor_hrule_dialog_get_width (EEditorHRuleDialog *dialog)
+{
+ gchar *width;
+ const gchar *units;
+ gint width_int = 0;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ width = webkit_dom_htmlhr_element_get_width (dialog->priv->hr_element);
+ if (width && *width) {
+ width_int = atoi (width);
+
+ if (strstr (width, "%") != NULL) {
+ units = "units-percent";
+ } else {
+ units = "units-px";
+ }
+ }
+
+ if (width_int == 0) {
+ width_int = 100;
+ units = "units-percent";
+ }
+
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (dialog->priv->width_edit), (gdouble) width_int);
+ gtk_combo_box_set_active_id (
+ GTK_COMBO_BOX (dialog->priv->unit_combo), units);
+
+ g_free (width);
+}
+
+static void
+editor_hrule_dialog_set_shading (EEditorHRuleDialog *dialog)
+{
+ gboolean no_shade;
+
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ no_shade = !gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (dialog->priv->shaded_check));
+
+ webkit_dom_htmlhr_element_set_no_shade (dialog->priv->hr_element, no_shade);
+}
+
+static void
+editor_hrule_dialog_get_shading (EEditorHRuleDialog *dialog)
+{
+ g_return_if_fail (WEBKIT_DOM_IS_HTMLHR_ELEMENT (dialog->priv->hr_element));
+
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dialog->priv->shaded_check),
+ !webkit_dom_htmlhr_element_get_no_shade (dialog->priv->hr_element));
+}
+
+static void
+editor_hrule_dialog_close (EEditorHRuleDialog *dialog)
+{
+ gtk_widget_hide (GTK_WIDGET (dialog));
+
+ dialog->priv->hr_element = NULL;
+}
+
+static void
+editor_hrule_dialog_show (GtkWidget *widget)
+{
+ EEditorHRuleDialog *dialog;
+ EEditor *editor;
+ EEditorWidget *editor_widget;
+
+ WebKitDOMDocument *document;
+ WebKitDOMDOMWindow *window;
+ WebKitDOMDOMSelection *selection;
+ WebKitDOMRange *range;
+ WebKitDOMElement *rule;
+
+ dialog = E_EDITOR_HRULE_DIALOG (widget);
+ editor = e_editor_dialog_get_editor (E_EDITOR_DIALOG (dialog));
+ editor_widget = e_editor_get_editor_widget (editor);
+
+ document = webkit_web_view_get_dom_document (
+ WEBKIT_WEB_VIEW (editor_widget));
+ window = webkit_dom_document_get_default_view (document);
+ selection = webkit_dom_dom_window_get_selection (window);
+ if (webkit_dom_dom_selection_get_range_count (selection) < 1) {
+ GTK_WIDGET_CLASS (e_editor_hrule_dialog_parent_class)->show (widget);
+ return;
+ }
+
+ range = webkit_dom_dom_selection_get_range_at (selection, 0, NULL);
+
+ 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);
+
+ dialog->priv->hr_element = WEBKIT_DOM_HTMLHR_ELEMENT (rule);
+
+ /* For new rule reset the values to default */
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (dialog->priv->width_edit), 100.0);
+ gtk_combo_box_set_active_id (
+ GTK_COMBO_BOX (dialog->priv->unit_combo), "units-percent");
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (dialog->priv->size_edit), 2.0);
+ gtk_combo_box_set_active_id (
+ GTK_COMBO_BOX (dialog->priv->alignment_combo), "left");
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dialog->priv->shaded_check), FALSE);
+ editor_hrule_dialog_set_alignment (dialog);
+ editor_hrule_dialog_set_size (dialog);
+ editor_hrule_dialog_set_alignment (dialog);
+ editor_hrule_dialog_set_shading (dialog);
+
+ } else {
+ dialog->priv->hr_element = WEBKIT_DOM_HTMLHR_ELEMENT (rule);
+
+ editor_hrule_dialog_get_alignment (dialog);
+ editor_hrule_dialog_get_size (dialog);
+ editor_hrule_dialog_get_width (dialog);
+ editor_hrule_dialog_get_shading (dialog);
+ }
+
+ /* Chain up to parent implementation */
+ GTK_WIDGET_CLASS (e_editor_hrule_dialog_parent_class)->show (widget);
+}
+
+static void
+e_editor_hrule_dialog_class_init (EEditorHRuleDialogClass *klass)
+{
+ GtkWidgetClass *widget_class;
+
+ g_type_class_peek_parent (klass);
+ g_type_class_add_private (klass, sizeof (EEditorHRuleDialogPrivate));
+
+ widget_class = GTK_WIDGET_CLASS (klass);
+ widget_class->show = editor_hrule_dialog_show;
+}
+
+static void
+e_editor_hrule_dialog_init (EEditorHRuleDialog *dialog)
+{
+ GtkBox *main_layout;
+ GtkGrid *grid;
+ GtkWidget *widget;
+
+ dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (
+ dialog, E_TYPE_EDITOR_HRULE_DIALOG, EEditorHRuleDialogPrivate);
+
+ 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);
+
+
+ /* == 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);
+ gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
+
+ 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);
+ gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 5);
+
+ /* Width */
+ widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (widget), 0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 100);
+ g_signal_connect_swapped (
+ widget, "value-changed",
+ G_CALLBACK (editor_hrule_dialog_set_width), dialog);
+ dialog->priv->width_edit = widget;
+ gtk_grid_attach (grid, widget, 1, 0, 1, 1);
+
+ widget = gtk_label_new_with_mnemonic (_("Width:"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->size_edit);
+ gtk_grid_attach (grid, widget, 0, 0, 1, 1);
+
+ widget = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-px", "px");
+ gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (widget), "units-percent", "%");
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), "units-percent");
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (editor_hrule_dialog_set_width), dialog);
+ dialog->priv->unit_combo = widget;
+ gtk_grid_attach (grid, widget, 2, 0, 1, 1);
+
+ /* Size */
+ widget = gtk_spin_button_new_with_range (0.0, 100.0, 1.0);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON (widget), 0);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), 2);
+ g_signal_connect_swapped (
+ widget, "value-changed",
+ G_CALLBACK (editor_hrule_dialog_set_size), dialog);
+ dialog->priv->size_edit = widget;
+ gtk_grid_attach (grid, widget, 1, 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);
+
+
+ /* == 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);
+ gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
+
+ 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);
+ gtk_box_pack_start (main_layout, GTK_WIDGET (grid), TRUE, TRUE, 5);
+
+ /* Alignment */
+ widget = gtk_combo_box_text_new ();
+ gtk_combo_box_text_append (
+ GTK_COMBO_BOX_TEXT (widget), "left", _("Left"));
+ gtk_combo_box_text_append (
+ GTK_COMBO_BOX_TEXT (widget), "center", _("Center"));
+ gtk_combo_box_text_append (
+ GTK_COMBO_BOX_TEXT (widget), "right", _("Right"));
+ gtk_combo_box_set_active_id (GTK_COMBO_BOX (widget), "left");
+ g_signal_connect_swapped (
+ widget, "changed",
+ G_CALLBACK (editor_hrule_dialog_set_alignment), dialog);
+ dialog->priv->alignment_combo = widget;
+ gtk_grid_attach (grid, widget, 1, 0, 2, 1);
+
+ widget = gtk_label_new_with_mnemonic (_("Alignment:"));
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), widget);
+ gtk_grid_attach (grid, widget, 0, 0, 1, 1);
+
+ /* Shaded */
+ widget = gtk_check_button_new_with_mnemonic (_("Shaded"));
+ 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);
+
+
+ /* == Button box == */
+ widget = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ g_signal_connect_swapped (
+ widget, "clicked",
+ G_CALLBACK (editor_hrule_dialog_close), dialog);
+ dialog->priv->close_button = widget;
+
+ widget = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
+ gtk_button_box_set_layout (GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_END);
+ gtk_box_pack_start (main_layout, widget, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (widget), dialog->priv->close_button, FALSE, FALSE, 5);
+
+ gtk_widget_show_all (GTK_WIDGET (main_layout));
+}
+
+GtkWidget *
+e_editor_hrule_dialog_new (EEditor *editor)
+{
+ return GTK_WIDGET (
+ g_object_new (
+ E_TYPE_EDITOR_HRULE_DIALOG,
+ "editor", editor,
+ "title", _("Rule properties"),
+ NULL));
+}
diff --git a/e-util/e-editor-hrule-dialog.h b/e-util/e-editor-hrule-dialog.h
new file mode 100644
index 0000000..d36b589
--- /dev/null
+++ b/e-util/e-editor-hrule-dialog.h
@@ -0,0 +1,69 @@
+/*
+ * e-editor-hrule-dialog.h
+ *
+ * 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
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
+#error "Only <e-util/e-util.h> should be included directly."
+#endif
+
+#ifndef E_EDITOR_HRULE_DIALOG_H
+#define E_EDITOR_HRULE_DIALOG_H
+
+#include <e-util/e-editor-dialog.h>
+
+/* Standard GObject macros */
+#define E_TYPE_EDITOR_HRULE_DIALOG \
+ (e_editor_hrule_dialog_get_type ())
+#define E_EDITOR_HRULE_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_EDITOR_HRULE_DIALOG, EEditorHRuleDialog))
+#define E_EDITOR_HRULE_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_EDITOR_HRULE_DIALOG, EEditorHRuleDialogClass))
+#define E_IS_EDITOR_HRULE_DIALOG(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_EDITOR_HRULE_DIALOG))
+#define E_IS_EDITOR_HRULE_DIALOG_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_EDITOR_HRULE_DIALOG))
+#define E_EDITOR_HRULE_DIALOG_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_EDITOR_HRULE_DIALOG, EEditorHRuleDialogClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EEditorHRuleDialog EEditorHRuleDialog;
+typedef struct _EEditorHRuleDialogClass EEditorHRuleDialogClass;
+typedef struct _EEditorHRuleDialogPrivate EEditorHRuleDialogPrivate;
+
+struct _EEditorHRuleDialog {
+ EEditorDialog parent;
+
+ EEditorHRuleDialogPrivate *priv;
+};
+
+struct _EEditorHRuleDialogClass {
+ EEditorDialogClass parent_class;
+};
+
+GType e_editor_hrule_dialog_get_type (void);
+
+GtkWidget* e_editor_hrule_dialog_new (EEditor *editor);
+
+G_END_DECLS
+
+#endif /* E_EDITOR_HRULE_DIALOG_H */
diff --git a/e-util/e-editor-link-dialog.c b/e-util/e-editor-link-dialog.c
index 1db2790..15aa9ee 100644
--- a/e-util/e-editor-link-dialog.c
+++ b/e-util/e-editor-link-dialog.c
@@ -41,47 +41,6 @@ struct _EEditorLinkDialogPrivate {
GtkWidget *ok_button;
};
-static WebKitDOMElement *
-find_anchor_element (WebKitDOMRange *range)
-{
- WebKitDOMElement *link;
- WebKitDOMNode *node;
-
- node = webkit_dom_range_get_start_container (range, NULL);
-
- /* Try to find if the selection is within a link */
- link = NULL;
- link = e_editor_dom_node_get_parent_element (
- node, WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
-
- /* ...or if there is a link within selection */
- if (!link) {
- WebKitDOMNode *start_node = node;
- gboolean found = FALSE;
- do {
- if (WEBKIT_DOM_IS_HTML_ANCHOR_ELEMENT (node)) {
- found = TRUE;
- break;
- }
-
- if (webkit_dom_node_has_child_nodes (node)) {
- node = webkit_dom_node_get_first_child (node);
- } else if (webkit_dom_node_get_next_sibling (node)) {
- node = webkit_dom_node_get_next_sibling (node);
- } else {
- node = webkit_dom_node_get_parent_node (node);
- }
- } while (!webkit_dom_node_is_same_node (node, start_node));
-
- if (found) {
- link = WEBKIT_DOM_ELEMENT (node);
- }
- }
-
- return link;
-}
-
-
static void
editor_link_dialog_test_link (EEditorLinkDialog *dialog)
{
@@ -139,7 +98,14 @@ editor_link_dialog_ok (EEditorLinkDialog *dialog)
}
range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
- link = find_anchor_element (range);
+ link = e_editor_dom_node_get_parent_element (
+ webkit_dom_range_get_start_container (range, NULL),
+ WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+ if (!link) {
+ link = e_editor_dom_node_find_child_element (
+ webkit_dom_range_get_start_container (range, NULL),
+ WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+ }
if (link) {
webkit_dom_html_anchor_element_set_href (
@@ -210,7 +176,14 @@ editor_link_dialog_show (GtkWidget *widget)
}
range = webkit_dom_dom_selection_get_range_at (dom_selection, 0, NULL);
- link = find_anchor_element (range);
+ link = e_editor_dom_node_get_parent_element (
+ webkit_dom_range_get_start_container (range, NULL),
+ WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+ if (!link) {
+ link = e_editor_dom_node_find_child_element (
+ webkit_dom_range_get_start_container (range, NULL),
+ WEBKIT_TYPE_DOM_HTML_ANCHOR_ELEMENT);
+ }
if (link) {
gchar *href, *text;
diff --git a/e-util/e-editor-private.h b/e-util/e-editor-private.h
index 5872a8a..0eabc08 100644
--- a/e-util/e-editor-private.h
+++ b/e-util/e-editor-private.h
@@ -27,6 +27,7 @@
#include <e-editor-find-dialog.h>
#include <e-editor-replace-dialog.h>
#include <e-editor-link-dialog.h>
+#include <e-editor-hrule-dialog.h>
#ifdef HAVE_XFREE
#include <X11/XF86keysym.h>
@@ -58,6 +59,7 @@ struct _EEditorPrivate {
GtkWidget *find_dialog;
GtkWidget *replace_dialog;
GtkWidget *link_dialog;
+ GtkWidget *hrule_dialog;
GtkWidget *color_combo_box;
GtkWidget *mode_combo_box;
diff --git a/e-util/e-editor-utils.c b/e-util/e-editor-utils.c
index 8509e03..efac42b 100644
--- a/e-util/e-editor-utils.c
+++ b/e-util/e-editor-utils.c
@@ -37,3 +37,27 @@ e_editor_dom_node_get_parent_element (WebKitDOMNode *node,
return NULL;
}
+
+WebKitDOMElement *
+e_editor_dom_node_find_child_element (WebKitDOMNode *node,
+ GType child_type)
+{
+ WebKitDOMElement *link;
+ WebKitDOMNode *start_node = node;
+
+ do {
+ if (G_TYPE_CHECK_INSTANCE_TYPE (node, child_type)) {
+ return WEBKIT_DOM_ELEMENT (node);
+ }
+
+ if (webkit_dom_node_has_child_nodes (node)) {
+ node = webkit_dom_node_get_first_child (node);
+ } else if (webkit_dom_node_get_next_sibling (node)) {
+ node = webkit_dom_node_get_next_sibling (node);
+ } else {
+ node = webkit_dom_node_get_parent_node (node);
+ }
+ } while (!webkit_dom_node_is_same_node (node, start_node));
+
+ return NULL;
+}
diff --git a/e-util/e-editor-utils.h b/e-util/e-editor-utils.h
index 5405244..6786628 100644
--- a/e-util/e-editor-utils.h
+++ b/e-util/e-editor-utils.h
@@ -29,4 +29,8 @@ WebKitDOMElement * e_editor_dom_node_get_parent_element
(WebKitDOMNode *node,
GType parent_type);
+WebKitDOMElement * e_editor_dom_node_find_child_element
+ (WebKitDOMNode *node,
+ GType child_type);
+
#endif /* E_EDITOR_UTILS_H */
diff --git a/e-util/e-editor-widgets.h b/e-util/e-editor-widgets.h
index 6c697cf..5901c4e 100644
--- a/e-util/e-editor-widgets.h
+++ b/e-util/e-editor-widgets.h
@@ -87,16 +87,6 @@
#define E_EDITOR_WIDGETS_IMAGE_PROPERTIES_Y_PADDING_SPIN_BUTTON(editor) \
E_EDITOR_WIDGETS ((editor), "image-properties-y-padding-spin-button")
-/* Link Properties Window */
-#define E_EDITOR_WIDGETS_LINK_PROPERTIES_DESCRIPTION_ENTRY(editor) \
- E_EDITOR_WIDGETS ((editor), "link-properties-description-entry")
-#define E_EDITOR_WIDGETS_LINK_PROPERTIES_TEST_BUTTON(editor) \
- E_EDITOR_WIDGETS ((editor), "link-properties-test-button")
-#define E_EDITOR_WIDGETS_LINK_PROPERTIES_URL_ENTRY(editor) \
- E_EDITOR_WIDGETS ((editor), "link-properties-url-entry")
-#define E_EDITOR_WIDGETS_LINK_PROPERTIES_WINDOW(editor) \
- E_EDITOR_WIDGETS ((editor), "link-properties-window")
-
/* Page Properties Window */
#define E_EDITOR_WIDGETS_PAGE_PROPERTIES_BACKGROUND_COLOR_COMBO(editor) \
E_EDITOR_WIDGETS ((editor), "page-properties-background-color-combo")
@@ -123,20 +113,6 @@
#define E_EDITOR_WIDGETS_PARAGRAPH_PROPERTIES_WINDOW(editor) \
E_EDITOR_WIDGETS ((editor), "paragraph-properties-window")
-/* Rule Properties Window */
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_ALIGNMENT_COMBO_BOX(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-alignment-combo-box")
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_SHADED_CHECK_BUTTON(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-shaded-check-button")
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_SIZE_SPIN_BUTTON(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-size-spin-button")
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WIDTH_COMBO_BOX(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-width-combo-box")
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WIDTH_SPIN_BUTTON(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-width-spin-button")
-#define E_EDITOR_WIDGETS_RULE_PROPERTIES_WINDOW(editor) \
- E_EDITOR_WIDGETS ((editor), "rule-properties-window")
-
/* Spell Check Window */
#define E_EDITOR_WIDGETS_SPELL_WINDOW(editor) \
E_EDITOR_WIDGETS ((editor), "spell-window")
diff --git a/e-util/e-util.h b/e-util/e-util.h
index 586ab48..8d84781 100644
--- a/e-util/e-util.h
+++ b/e-util/e-util.h
@@ -94,6 +94,7 @@
#include <e-util/e-editor-actions.h>
#include <e-util/e-editor-dialog.h>
#include <e-util/e-editor-find-dialog.h>
+#include <e-util/e-editor-hrule-dialog.h>
#include <e-util/e-editor-link-dialog.h>
#include <e-util/e-editor-replace-dialog.h>
#include <e-util/e-editor-selection.h>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]