[evolution/wip/webkit2] Make the composer usable a little bit
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/webkit2] Make the composer usable a little bit
- Date: Thu, 5 Nov 2015 10:19:26 +0000 (UTC)
commit e0a0c7d893b5272c52a25ae270d81394a0176bfb
Author: Tomas Popela <tpopela redhat com>
Date: Thu Nov 5 11:15:40 2015 +0100
Make the composer usable a little bit
* Move the composer web extension sources under the composer directory and install
them separately so the composer web extension is launched only when composer is
launched.
* Make the composer UI react to the content
* Fix a lot of bugs and crashes
composer/e-composer-private.c | 8 +-
composer/e-msg-composer.c | 24 +-
configure.ac | 5 +-
e-util/Makefile.am | 1 +
e-util/e-emoticon.c | 6 +
e-util/e-emoticon.h | 1 +
e-util/e-html-editor-actions.c | 55 +-
e-util/e-html-editor-find-dialog.c | 69 +-
e-util/e-html-editor-hrule-dialog.c | 4 +-
e-util/e-html-editor-manager.ui | 2 -
e-util/e-html-editor-private.h | 1 +
e-util/e-html-editor-replace-dialog.c | 117 ++--
e-util/e-html-editor-selection.c | 401 ++++------
e-util/e-html-editor-selection.h | 2 +
e-util/e-html-editor-spell-check-dialog.c | 10 +-
e-util/e-html-editor-view.c | 409 +++++----
e-util/e-html-editor-view.h | 6 +
e-util/e-html-editor.c | 14 +-
e-util/e-web-view.c | 88 ++-
e-util/e-web-view.h | 8 +-
e-util/test-html-editor.c | 2 +-
mail/e-mail-display.c | 3 -
mail/e-mail-reader-utils.c | 3 +-
.../module-itip-formatter-dom-utils.c | 20 +-
.../module-itip-formatter-web-extension.c | 14 +-
.../mail/web-extension/module-mail-web-extension.c | 8 +-
.../mail/web-extension/module-mail-web-extension.h | 6 +-
.../module-prefer-plain-web-extension.c | 5 +-
.../module-prefer-plain-web-extension.h | 6 +-
.../module-text-highlight-web-extension.c | 5 +-
.../module-text-highlight-web-extension.h | 6 +-
plugins/external-editor/external-editor.c | 7 +-
web-extensions/Makefile.am | 58 +--
web-extensions/composer/Makefile.am | 53 ++
.../e-composer-private-dom-functions.c | 1 +
.../e-composer-private-dom-functions.h | 0
.../e-html-editor-actions-dom-functions.c | 3 +-
.../e-html-editor-actions-dom-functions.h | 0
.../e-html-editor-cell-dialog-dom-functions.c | 3 +-
.../e-html-editor-cell-dialog-dom-functions.h | 0
.../{ => composer}/e-html-editor-history-event.h | 0
.../e-html-editor-hrule-dialog-dom-functions.c | 3 +-
.../e-html-editor-hrule-dialog-dom-functions.h | 0
.../e-html-editor-image-dialog-dom-functions.c | 3 +-
.../e-html-editor-image-dialog-dom-functions.h | 0
.../e-html-editor-link-dialog-dom-functions.c | 6 +-
.../e-html-editor-link-dialog-dom-functions.h | 0
.../e-html-editor-page-dialog-dom-functions.c | 3 +-
.../e-html-editor-page-dialog-dom-functions.h | 0
.../e-html-editor-selection-dom-functions.c | 106 +--
.../e-html-editor-selection-dom-functions.h | 2 -
...-html-editor-spell-check-dialog-dom-functions.c | 2 +-
...-html-editor-spell-check-dialog-dom-functions.h | 0
.../e-html-editor-table-dialog-dom-functions.c | 3 +-
.../e-html-editor-table-dialog-dom-functions.h | 0
.../e-html-editor-undo-redo-manager.c | 7 +-
.../e-html-editor-undo-redo-manager.h | 0
.../e-html-editor-view-dom-functions.c | 60 +-
.../e-html-editor-view-dom-functions.h | 4 +
.../e-html-editor-web-extension-main.c | 0
.../e-html-editor-web-extension-names.h | 6 +-
.../{ => composer}/e-html-editor-web-extension.c | 883 +++++++++++++++-----
.../{ => composer}/e-html-editor-web-extension.h | 28 +-
.../{ => composer}/e-msg-composer-dom-functions.c | 0
.../{ => composer}/e-msg-composer-dom-functions.h | 0
web-extensions/e-dom-utils.c | 95 ++-
web-extensions/e-dom-utils.h | 2 +
web-extensions/e-web-extension-main.c | 1 +
web-extensions/e-web-extension.c | 42 +-
web-extensions/e-web-extension.h | 4 -
70 files changed, 1636 insertions(+), 1058 deletions(-)
---
diff --git a/composer/e-composer-private.c b/composer/e-composer-private.c
index 104954a..79118b4 100644
--- a/composer/e-composer-private.c
+++ b/composer/e-composer-private.c
@@ -92,7 +92,8 @@ e_composer_private_constructed (EMsgComposer *composer)
{
EMsgComposerPrivate *priv = composer->priv;
EFocusTracker *focus_tracker;
- EComposerHeader *header;
+/* FIXME WK2
+ EComposerHeader *header;*/
EShell *shell;
EClientCache *client_cache;
EHTMLEditor *editor;
@@ -209,13 +210,14 @@ e_composer_private_constructed (EMsgComposer *composer)
priv->header_table = g_object_ref (widget);
gtk_widget_show (widget);
+/* FIXME WK2
header = e_composer_header_table_get_header (
E_COMPOSER_HEADER_TABLE (widget),
E_COMPOSER_HEADER_SUBJECT);
e_binding_bind_property (
view, "spell-checker",
header->input_widget, "spell-checker",
- G_BINDING_SYNC_CREATE);
+ G_BINDING_SYNC_CREATE);*/
/* Construct the editing toolbars. We'll have to reparent
* the embedded EHTMLEditorView a little further down. */
@@ -968,7 +970,7 @@ insert:
web_extension,
"DOMInsertSignature",
g_variant_new (
- "(tsb)",
+ "(tsbb)",
webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
html_buffer->str,
top_signature,
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index decce0d..c7e76cd 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -1727,7 +1727,7 @@ msg_composer_paste_primary_clipboard_cb (EHTMLEditorView *view,
clipboard, (GtkClipboardTargetsReceivedFunc)
msg_composer_paste_clipboard_targets_cb, composer);
}
-
+/* FIXME WK2
static void
msg_composer_paste_clipboard_cb (EHTMLEditorView *view,
EMsgComposer *composer)
@@ -1742,7 +1742,7 @@ msg_composer_paste_clipboard_cb (EHTMLEditorView *view,
g_signal_stop_emission_by_name (view, "paste-clipboard");
}
-
+*/
static gboolean
msg_composer_drag_motion_cb (GtkWidget *widget,
GdkDragContext *context,
@@ -2212,7 +2212,7 @@ composer_notify_activity_cb (EActivityBar *activity_bar,
EHTMLEditor *editor;
EHTMLEditorView *view;
WebKitWebView *web_view;
- gboolean editable = TRUE;;
+ gboolean editable = TRUE;
gboolean busy;
busy = (e_activity_bar_get_activity (activity_bar) != NULL);
@@ -2230,14 +2230,12 @@ composer_notify_activity_cb (EActivityBar *activity_bar,
web_view = WEBKIT_WEB_VIEW (view);
if (busy) {
- /* FIXME WK2
- editable = webkit_web_view_get_editable (web_view);
- webkit_web_view_set_editable (web_view, FALSE);*/
+ editable = webkit_web_view_is_editable (web_view);
+ webkit_web_view_set_editable (web_view, FALSE);
composer->priv->saved_editable = editable;
} else {
editable = composer->priv->saved_editable;
- /* FIXME WK2
- webkit_web_view_set_editable (web_view, editable);*/
+ webkit_web_view_set_editable (web_view, editable);
}
g_object_notify (G_OBJECT (composer), "busy");
@@ -2321,11 +2319,11 @@ msg_composer_constructed (GObject *object)
g_object_unref (settings);
/* Clipboard Support */
-
+/* FIXME WK2
g_signal_connect (
view, "paste-clipboard",
G_CALLBACK (msg_composer_paste_clipboard_cb), composer);
-
+*/
g_signal_connect (
view, "paste-primary-clipboard",
G_CALLBACK (msg_composer_paste_primary_clipboard_cb), composer);
@@ -3793,8 +3791,7 @@ e_msg_composer_new_redirect (EShell *shell,
editor = e_msg_composer_get_editor (composer);
view = e_html_editor_get_view (editor);
- /* FIXME WK2
- webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), FALSE);*/
+ webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), FALSE);
return composer;
}
@@ -4577,8 +4574,7 @@ e_msg_composer_set_body (EMsgComposer *composer,
e_html_editor_view_set_html_mode (view, FALSE);
e_html_editor_view_set_remove_initial_input_line (view, TRUE);
- /* FIXME WK2
- webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), FALSE);*/
+ webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), FALSE);
g_free (priv->mime_body);
priv->mime_body = g_strdup (body);
diff --git a/configure.ac b/configure.ac
index 316bfb7..8860abd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,7 @@ m4_define([gcr_minimum_version], [3.4])
m4_define([enchant_minimum_version], [1.1.7])
m4_define([gnome_desktop_minimum_version], [2.91.3])
m4_define([gsettings_desktop_schemas_minimum_version], [2.91.92])
-m4_define([webkit2gtk_minimum_version], [2.5.3])
+m4_define([webkit2gtk_minimum_version], [2.10.3])
m4_define([libgdata_minimum_version], [0.10])
m4_define([libxml_minimum_version], [2.7.3])
m4_define([shared_mime_info_minimum_version], [0.22])
@@ -1261,7 +1261,9 @@ dnl **********************************
dnl WebKit2 Web Extensions
dnl **********************************
webextensionsdir="$privlibdir/web-extensions"
+webextensionscomposerdir="$privlibdir/web-extensions/composer"
AC_SUBST(webextensionsdir)
+AC_SUBST(webextensionscomposerdir)
PKG_CHECK_MODULES(WEB_EXTENSION, [webkit2gtk-4.0 >= webkit2gtk_minimum_version])
AC_SUBST(WEB_EXTENSIONS_CFLAGS)
@@ -1629,6 +1631,7 @@ plugins/publish-calendar/Makefile
plugins/save-calendar/Makefile
plugins/templates/Makefile
web-extensions/Makefile
+web-extensions/composer/Makefile
smime/Makefile
smime/lib/Makefile
smime/gui/Makefile
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 6c9de16..a3e84a3 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -97,6 +97,7 @@ libevolution_util_la_CPPFLAGS = \
-DEVOLUTION_UIDIR=\""$(uidir)"\" \
-DEVOLUTION_RULEDIR=\"$(ruledir)\" \
-DEVOLUTION_WEB_EXTENSIONS_DIR=\""$(webextensionsdir)"\" \
+ -DEVOLUTION_WEB_EXTENSIONS_COMPOSER_DIR=\""$(webextensionscomposerdir)"\" \
-DG_LOG_DOMAIN=\"evolution-util\" \
$(EVOLUTION_DATA_SERVER_CFLAGS) \
$(GNOME_PLATFORM_CFLAGS) \
diff --git a/e-util/e-emoticon.c b/e-util/e-emoticon.c
index cc2fd41..53a9f49 100644
--- a/e-util/e-emoticon.c
+++ b/e-util/e-emoticon.c
@@ -121,3 +121,9 @@ e_emoticon_get_uri (EEmoticon *emoticon)
return uri;
}
+
+const gchar *
+e_emoticon_get_name (EEmoticon *emoticon)
+{
+ return emoticon->icon_name;
+}
diff --git a/e-util/e-emoticon.h b/e-util/e-emoticon.h
index e77806f..3b9e8c0 100644
--- a/e-util/e-emoticon.h
+++ b/e-util/e-emoticon.h
@@ -48,6 +48,7 @@ gboolean e_emoticon_equal (EEmoticon *emoticon_a,
EEmoticon * e_emoticon_copy (EEmoticon *emoticon);
void e_emoticon_free (EEmoticon *emoticon);
gchar * e_emoticon_get_uri (EEmoticon *emoticon);
+const gchar * e_emoticon_get_name (EEmoticon *emoticon);
G_END_DECLS
diff --git a/e-util/e-html-editor-actions.c b/e-util/e-html-editor-actions.c
index ea62f54..d708e53 100644
--- a/e-util/e-html-editor-actions.c
+++ b/e-util/e-html-editor-actions.c
@@ -296,8 +296,7 @@ action_insert_emoticon_cb (GtkAction *action,
g_return_if_fail (emoticon != NULL);
view = e_html_editor_get_view (editor);
-/* FIXME WK2
- e_html_editor_view_insert_smiley (view, emoticon); */
+ e_html_editor_view_insert_smiley (view, emoticon);
}
static void
@@ -1366,13 +1365,6 @@ static GtkActionEntry context_entries[] = {
NULL,
NULL },
- { "context-input-methods-menu",
- NULL,
- N_("Input Methods"),
- NULL,
- NULL,
- NULL },
-
{ "context-insert-table-menu",
NULL,
/* Translators: Popup menu item caption, containing all the Insert options for a table */
@@ -1689,14 +1681,12 @@ editor_actions_init (EHTMLEditor *editor)
GtkActionGroup *action_group;
GtkUIManager *manager;
const gchar *domain;
- EHTMLEditorView *view;
GSettings *settings;
g_return_if_fail (E_IS_HTML_EDITOR (editor));
manager = e_html_editor_get_ui_manager (editor);
domain = GETTEXT_PACKAGE;
- view = e_html_editor_get_view (editor);
/* Core Actions */
action_group = editor->priv->core_actions;
@@ -1728,15 +1718,6 @@ editor_actions_init (EHTMLEditor *editor)
NULL, NULL);
gtk_ui_manager_insert_action_group (manager, action_group, 0);
- action = gtk_action_group_get_action (action_group, "mode-html");
- e_binding_bind_property (
- view, "html-mode",
- action, "current-value",
- G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
-
- /* Synchronize wiget mode with the buttons */
- e_html_editor_view_set_html_mode (view, TRUE);
-
/* Face Action */
action = e_emoticon_action_new (
"insert-emoticon", _("_Emoticon"),
@@ -1826,6 +1807,34 @@ editor_actions_init (EHTMLEditor *editor)
gtk_action_set_sensitive (ACTION (UNINDENT), FALSE);
gtk_action_set_sensitive (ACTION (FIND_AGAIN), FALSE);
+ settings = e_util_ref_settings ("org.gnome.evolution.mail");
+ gtk_action_set_visible (
+ ACTION (WEBKIT_INSPECTOR),
+ g_settings_get_boolean (settings, "composer-developer-mode"));
+ g_object_unref (settings);
+}
+
+void
+editor_actions_bind (EHTMLEditor *editor)
+{
+ GtkAction *action;
+ GtkActionGroup *action_group;
+ EHTMLEditorView *view;
+
+ g_return_if_fail (E_IS_HTML_EDITOR (editor));
+
+ view = e_html_editor_get_view (editor);
+
+ action_group = editor->priv->core_editor_actions;
+ action = gtk_action_group_get_action (action_group, "mode-html");
+ e_binding_bind_property (
+ view, "html-mode",
+ action, "current-value",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+
+ /* Synchronize widget mode with the buttons */
+ e_html_editor_view_set_html_mode (view, TRUE);
+
e_binding_bind_property (
view, "can-redo",
ACTION (REDO), "sensitive",
@@ -1903,10 +1912,4 @@ editor_actions_init (EHTMLEditor *editor)
view, "editable",
editor->priv->suggestion_actions, "sensitive",
G_BINDING_SYNC_CREATE);
-
- settings = e_util_ref_settings ("org.gnome.evolution.mail");
- gtk_action_set_visible (
- ACTION (WEBKIT_INSPECTOR),
- g_settings_get_boolean (settings, "composer-developer-mode"));
- g_object_unref (settings);
}
diff --git a/e-util/e-html-editor-find-dialog.c b/e-util/e-html-editor-find-dialog.c
index 70fe47c..12b7573 100644
--- a/e-util/e-html-editor-find-dialog.c
+++ b/e-util/e-html-editor-find-dialog.c
@@ -61,6 +61,17 @@ reset_dialog (EHTMLEditorFindDialog *dialog)
}
static void
+html_editor_find_dialog_hide (GtkWidget *widget)
+{
+ EHTMLEditorFindDialog *dialog = E_HTML_EDITOR_FIND_DIALOG (widget);
+
+ webkit_find_controller_search_finish (dialog->priv->find_controller);
+
+ /* Chain up to parent's implementation */
+ GTK_WIDGET_CLASS (e_html_editor_find_dialog_parent_class)->hide (widget);
+}
+
+static void
html_editor_find_dialog_show (GtkWidget *widget)
{
EHTMLEditorFindDialog *dialog = E_HTML_EDITOR_FIND_DIALOG (widget);
@@ -77,15 +88,8 @@ webkit_find_controller_found_text_cb (WebKitFindController *find_controller,
guint match_count,
EHTMLEditorFindDialog *dialog)
{
+ gtk_widget_hide (dialog->priv->result_label);
gtk_widget_set_sensitive (dialog->priv->find_button, TRUE);
-
- /* We give focus to WebKit so that the selection is highlited.
- * Without focus selection is not visible (at least with my default
- * color scheme). The focus in fact is not given to WebKit, because
- * this dialog is modal, but it satisfies it in a way that it paints
- * the selection :) */
- /* FIXME WK2 - still needed ?
- gtk_widget_grab_focus (GTK_WIDGET (view)); */
}
static void
@@ -161,6 +165,35 @@ html_editor_find_dialog_dispose (GObject *object)
}
static void
+html_editor_find_dialog_constructed (GObject *object)
+{
+ EHTMLEditor *editor;
+ EHTMLEditorFindDialog *dialog;
+ EHTMLEditorView *view;
+ WebKitFindController *find_controller;
+
+ dialog = E_HTML_EDITOR_FIND_DIALOG (object);
+ dialog->priv = E_HTML_EDITOR_FIND_DIALOG_GET_PRIVATE (dialog);
+
+ editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
+ view = e_html_editor_get_view (editor);
+ find_controller =
+ webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW (view));
+
+ dialog->priv->found_text_handler_id = g_signal_connect (
+ find_controller, "found-text",
+ G_CALLBACK (webkit_find_controller_found_text_cb), dialog);
+
+ dialog->priv->failed_to_find_text_handler_id = g_signal_connect (
+ find_controller, "failed-to-find-text",
+ G_CALLBACK (webkit_find_controller_failed_to_found_text_cb), dialog);
+
+ dialog->priv->find_controller = find_controller;
+
+ G_OBJECT_CLASS (e_html_editor_find_dialog_parent_class)->constructed (object);
+}
+
+static void
e_html_editor_find_dialog_class_init (EHTMLEditorFindDialogClass *class)
{
GObjectClass *object_class;
@@ -169,39 +202,23 @@ e_html_editor_find_dialog_class_init (EHTMLEditorFindDialogClass *class)
g_type_class_add_private (class, sizeof (EHTMLEditorFindDialogPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = html_editor_find_dialog_constructed;
object_class->dispose = html_editor_find_dialog_dispose;
widget_class = GTK_WIDGET_CLASS (class);
+ widget_class->hide = html_editor_find_dialog_hide;
widget_class->show = html_editor_find_dialog_show;
}
static void
e_html_editor_find_dialog_init (EHTMLEditorFindDialog *dialog)
{
- EHTMLEditor *editor;
- EHTMLEditorView *view;
GtkGrid *main_layout;
GtkBox *box;
GtkWidget *widget;
- WebKitFindController *find_controller;
dialog->priv = E_HTML_EDITOR_FIND_DIALOG_GET_PRIVATE (dialog);
- editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
- view = e_html_editor_get_view (editor);
- find_controller =
- webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW (view));
-
- dialog->priv->found_text_handler_id = g_signal_connect (
- find_controller, "found-text",
- G_CALLBACK (webkit_find_controller_found_text_cb), dialog);
-
- dialog->priv->failed_to_find_text_handler_id = g_signal_connect (
- find_controller, "failed-to-find-text",
- G_CALLBACK (webkit_find_controller_failed_to_found_text_cb), dialog);
-
- dialog->priv->find_controller = find_controller;
-
main_layout = e_html_editor_dialog_get_container (E_HTML_EDITOR_DIALOG (dialog));
widget = gtk_entry_new ();
diff --git a/e-util/e-html-editor-hrule-dialog.c b/e-util/e-html-editor-hrule-dialog.c
index e60bde8..8130eb3 100644
--- a/e-util/e-html-editor-hrule-dialog.c
+++ b/e-util/e-html-editor-hrule-dialog.c
@@ -222,7 +222,7 @@ html_editor_hrule_dialog_set_shading (EHTMLEditorHRuleDialog *dialog)
web_extension,
"HRElementSetNoShade",
g_variant_new (
- "(tss)",
+ "(tsb)",
webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
"-x-evo-current-hr",
!gtk_toggle_button_get_active (
@@ -263,7 +263,7 @@ html_editor_hrule_dialog_get_shading (EHTMLEditorHRuleDialog *dialog)
if (result) {
gboolean value;
- g_variant_get (result, "(&b)", &value);
+ g_variant_get (result, "(b)", &value);
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON (dialog->priv->shaded_check), !value);
g_variant_unref (result);
diff --git a/e-util/e-html-editor-manager.ui b/e-util/e-html-editor-manager.ui
index 97a4861..40b2591 100644
--- a/e-util/e-html-editor-manager.ui
+++ b/e-util/e-html-editor-manager.ui
@@ -178,7 +178,5 @@
<menuitem action='context-delete-column'/>
<menuitem action='context-delete-cell'/>
</menu>
- <separator/>
- <menu action='context-input-methods-menu'/>
</popup>
</ui>
diff --git a/e-util/e-html-editor-private.h b/e-util/e-html-editor-private.h
index 07f43dc..f0524d0 100644
--- a/e-util/e-html-editor-private.h
+++ b/e-util/e-html-editor-private.h
@@ -95,6 +95,7 @@ struct _EHTMLEditorPrivate {
};
void editor_actions_init (EHTMLEditor *editor);
+void editor_actions_bind (EHTMLEditor *editor);
G_END_DECLS
diff --git a/e-util/e-html-editor-replace-dialog.c b/e-util/e-html-editor-replace-dialog.c
index ea6870a..4e3a552 100644
--- a/e-util/e-html-editor-replace-dialog.c
+++ b/e-util/e-html-editor-replace-dialog.c
@@ -52,7 +52,7 @@ struct _EHTMLEditorReplaceDialogPrivate {
EHTMLEditor *editor;
- gboolean skip;
+ gboolean replace_all;
WebKitFindController *find_controller;
gulong found_text_handler_id;
@@ -70,29 +70,35 @@ webkit_find_controller_found_text_cb (WebKitFindController *find_controller,
guint match_count,
EHTMLEditorReplaceDialog *dialog)
{
- EHTMLEditorSelection *selection;
-
- selection = e_html_editor_view_get_selection (
- E_HTML_EDITOR_VIEW (webkit_find_controller_get_web_view (find_controller)));
-
gtk_widget_hide (dialog->priv->result_label);
+}
- if (!dialog->priv->skip) {
- e_html_editor_selection_replace (
- selection,
- gtk_entry_get_text (GTK_ENTRY (dialog->priv->replace_entry)));
+static void
+webkit_find_controller_failed_to_found_text_cb (WebKitFindController *find_controller,
+ EHTMLEditorReplaceDialog *dialog)
+{
+ if (!dialog->priv->replace_all) {
+ gtk_label_set_label (
+ GTK_LABEL (dialog->priv->result_label), N_("No match found"));
+ gtk_widget_show (dialog->priv->result_label);
}
- dialog->priv->skip = FALSE;
+ dialog->priv->replace_all = FALSE;
}
static void
-webkit_find_controller_failed_to_found_text_cb (WebKitFindController *find_controller,
- EHTMLEditorReplaceDialog *dialog)
+replace_occurance (EHTMLEditorReplaceDialog *dialog)
{
- gtk_label_set_label (
- GTK_LABEL (dialog->priv->result_label), N_("No match found"));
- gtk_widget_show (dialog->priv->result_label);
+ EHTMLEditorSelection *selection;
+
+ selection = e_html_editor_view_get_selection (E_HTML_EDITOR_VIEW (
+ webkit_find_controller_get_web_view (dialog->priv->find_controller)));
+
+ gtk_widget_hide (dialog->priv->result_label);
+
+ e_html_editor_selection_replace (
+ selection,
+ gtk_entry_get_text (GTK_ENTRY (dialog->priv->replace_entry)));
}
static void
@@ -104,21 +110,19 @@ webkit_find_controller_counted_matches_cb (WebKitFindController *find_controller
guint ii = 0;
for (ii = 0; ii < match_count; ii++) {
+ replace_occurance (dialog);
+
webkit_find_controller_search_next (dialog->priv->find_controller);
- /* Jump behind the word */
- /* FIXME WK2 is it needed ?
- e_html_editor_selection_move (
- selection, TRUE, E_HTML_EDITOR_SELECTION_GRANULARITY_WORD);*/
}
result = g_strdup_printf (ngettext("%d occurence replaced",
"%d occurences replaced",
match_count),
match_count);
+
gtk_label_set_label (GTK_LABEL (dialog->priv->result_label), result);
gtk_widget_show (dialog->priv->result_label);
g_free (result);
-
}
static void
@@ -145,14 +149,14 @@ search (EHTMLEditorReplaceDialog *dialog)
static void
html_editor_replace_dialog_skip_cb (EHTMLEditorReplaceDialog *dialog)
{
- dialog->priv->skip = TRUE;
webkit_find_controller_search_next (dialog->priv->find_controller);
}
static void
html_editor_replace_dialog_replace_cb (EHTMLEditorReplaceDialog *dialog)
{
- dialog->priv->skip = FALSE;
+ replace_occurance (dialog);
+
/* Jump to next matching word */
webkit_find_controller_search_next (dialog->priv->find_controller);
}
@@ -176,16 +180,16 @@ html_editor_replace_dialog_replace_all_cb (EHTMLEditorReplaceDialog *dialog)
gtk_entry_get_text (GTK_ENTRY (dialog->priv->search_entry)),
flags,
G_MAXUINT);
+
+ dialog->priv->replace_all = TRUE;
}
static void
html_editor_replace_dialog_entry_changed (EHTMLEditorReplaceDialog *dialog)
{
gboolean ready;
- ready = ((gtk_entry_get_text_length (
- GTK_ENTRY (dialog->priv->search_entry)) != 0) &&
- (gtk_entry_get_text_length (
- GTK_ENTRY (dialog->priv->replace_entry)) != 0));
+
+ ready = gtk_entry_get_text_length (GTK_ENTRY (dialog->priv->search_entry)) != 0;
gtk_widget_set_sensitive (dialog->priv->skip_button, ready);
gtk_widget_set_sensitive (dialog->priv->replace_button, ready);
@@ -219,6 +223,39 @@ html_editor_replace_dialog_hide (GtkWidget *widget)
}
static void
+html_editor_replace_dialog_constructed (GObject *object)
+{
+ EHTMLEditor *editor;
+ EHTMLEditorReplaceDialog *dialog;
+ EHTMLEditorView *view;
+ WebKitFindController *find_controller;
+
+ dialog = E_HTML_EDITOR_REPLACE_DIALOG (object);
+ dialog->priv = E_HTML_EDITOR_REPLACE_DIALOG_GET_PRIVATE (dialog);
+
+ editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
+ view = e_html_editor_get_view (editor);
+ find_controller =
+ webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW (view));
+
+ dialog->priv->found_text_handler_id = g_signal_connect (
+ find_controller, "found-text",
+ G_CALLBACK (webkit_find_controller_found_text_cb), dialog);
+
+ dialog->priv->failed_to_find_text_handler_id = g_signal_connect (
+ find_controller, "failed-to-find-text",
+ G_CALLBACK (webkit_find_controller_failed_to_found_text_cb), dialog);
+
+ dialog->priv->counted_matches_handler_id = g_signal_connect (
+ find_controller, "counted-matches",
+ G_CALLBACK (webkit_find_controller_counted_matches_cb), dialog);
+
+ dialog->priv->find_controller = find_controller;
+
+ G_OBJECT_CLASS (e_html_editor_replace_dialog_parent_class)->constructed (object);
+}
+
+static void
html_editor_replace_dialog_dispose (GObject *object)
{
EHTMLEditorReplaceDialogPrivate *priv;
@@ -259,6 +296,7 @@ e_html_editor_replace_dialog_class_init (EHTMLEditorReplaceDialogClass *class)
g_type_class_add_private (class, sizeof (EHTMLEditorReplaceDialogPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->constructed = html_editor_replace_dialog_constructed;
object_class->dispose = html_editor_replace_dialog_dispose;
widget_class = GTK_WIDGET_CLASS (class);
@@ -269,34 +307,12 @@ e_html_editor_replace_dialog_class_init (EHTMLEditorReplaceDialogClass *class)
static void
e_html_editor_replace_dialog_init (EHTMLEditorReplaceDialog *dialog)
{
- EHTMLEditor *editor;
- EHTMLEditorView *view;
GtkGrid *main_layout;
GtkWidget *widget, *layout;
GtkBox *button_box;
- WebKitFindController *find_controller;
dialog->priv = E_HTML_EDITOR_REPLACE_DIALOG_GET_PRIVATE (dialog);
- editor = e_html_editor_dialog_get_editor (E_HTML_EDITOR_DIALOG (dialog));
- view = e_html_editor_get_view (editor);
- find_controller =
- webkit_web_view_get_find_controller (WEBKIT_WEB_VIEW (view));
-
- dialog->priv->found_text_handler_id = g_signal_connect (
- find_controller, "found-text",
- G_CALLBACK (webkit_find_controller_found_text_cb), dialog);
-
- dialog->priv->failed_to_find_text_handler_id = g_signal_connect (
- find_controller, "failed-to-find-text",
- G_CALLBACK (webkit_find_controller_failed_to_found_text_cb), dialog);
-
- dialog->priv->counted_matches_handler_id = g_signal_connect (
- find_controller, "counted-matches",
- G_CALLBACK (webkit_find_controller_counted_matches_cb), dialog);
-
- dialog->priv->find_controller = find_controller;
-
main_layout = e_html_editor_dialog_get_container (E_HTML_EDITOR_DIALOG (dialog));
widget = gtk_entry_new ();
@@ -314,9 +330,6 @@ e_html_editor_replace_dialog_init (EHTMLEditorReplaceDialog *dialog)
widget = gtk_entry_new ();
gtk_grid_attach (main_layout, widget, 1, 1, 2, 1);
dialog->priv->replace_entry = widget;
- g_signal_connect_swapped (
- widget, "notify::text-length",
- G_CALLBACK (html_editor_replace_dialog_entry_changed), dialog);
widget = gtk_label_new_with_mnemonic (_("_With:"));
gtk_label_set_mnemonic_widget (GTK_LABEL (widget), dialog->priv->replace_entry);
diff --git a/e-util/e-html-editor-selection.c b/e-util/e-html-editor-selection.c
index e44136f..dcd7f91 100644
--- a/e-util/e-html-editor-selection.c
+++ b/e-util/e-html-editor-selection.c
@@ -26,6 +26,8 @@
#include "e-html-editor-view.h"
#include "e-html-editor.h"
+#include <web-extensions/composer/e-html-editor-web-extension-names.h>
+
#include <e-util/e-util.h>
#include <webkit2/webkit2.h>
@@ -48,7 +50,7 @@
struct _EHTMLEditorSelectionPrivate {
GWeakRef html_editor_view;
- gulong selection_changed_handler_id;
+ gulong g_properties_changed_handler_id;
gchar *text;
@@ -57,6 +59,9 @@ struct _EHTMLEditorSelectionPrivate {
gboolean is_underline;
gboolean is_monospaced;
gboolean is_strikethrough;
+ gboolean is_indented;
+ gboolean is_superscript;
+ gboolean is_subscript;
gchar *background_color;
gchar *font_color;
@@ -64,10 +69,10 @@ struct _EHTMLEditorSelectionPrivate {
gulong selection_offset;
- gint word_wrap_length;
guint font_size;
EHTMLEditorSelectionAlignment alignment;
+ EHTMLEditorSelectionBlockFormat block_format;
};
enum {
@@ -99,81 +104,116 @@ G_DEFINE_TYPE (
);
static void
-html_editor_selection_selection_changed_cb (WebKitWebView *web_view,
- EHTMLEditorSelection *selection)
+web_extension_properties_changed_cb (GDBusProxy *proxy,
+ GVariant *changed_properties,
+ GStrv invalidated_properties,
+ EHTMLEditorSelection *selection)
{
- EHTMLEditorView *view;
-
- view = e_html_editor_selection_ref_html_editor_view (selection);
-
+ printf ("%s\n", __FUNCTION__);
g_object_freeze_notify (G_OBJECT (selection));
- g_object_notify (G_OBJECT (selection), "alignment");
- g_object_notify (G_OBJECT (selection), "block-format");
- g_object_notify (G_OBJECT (selection), "indented");
- g_object_notify (G_OBJECT (selection), "text");
-
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
+ if (g_variant_n_children (changed_properties) > 0) {
+ GVariantIter *iter;
+ const gchar *key;
+ GVariant *value;
+
+ g_print (" *** Properties Changed:\n");
+ g_variant_get (changed_properties,
+ "a{sv}",
+ &iter);
+ while (g_variant_iter_loop (iter, "{&sv}", &key, &value)) {
+ gchar *value_str;
+ value_str = g_variant_print (value, TRUE);
+ if (g_strcmp0 (key, "Indented") == 0) {
+ selection->priv->is_indented = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "indented");
+ } else if (g_strcmp0 (key, "Alignment") == 0) {
+ selection->priv->alignment = g_variant_get_uint32 (value);
+ g_object_notify (G_OBJECT (selection), "alignment");
+ } else if (g_strcmp0 (key, "Bold") == 0) {
+ selection->priv->is_bold = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "bold");
+ } else if (g_strcmp0 (key, "BlockFormat") == 0) {
+ selection->priv->block_format = g_variant_get_uint32 (value);
+ g_object_notify (G_OBJECT (selection), "block-format");
+ } else if (g_strcmp0 (key, "FontColor") == 0) {
+ g_free (selection->priv->font_color);
+ selection->priv->font_color = g_variant_dup_string (value, NULL);
+ g_object_notify (G_OBJECT (selection), "font-color");
+ } else if (g_strcmp0 (key, "FontSize") == 0) {
+ selection->priv->font_size = g_variant_get_uint32 (value);
+ g_object_notify (G_OBJECT (selection), "font-size");
+ } else if (g_strcmp0 (key, "Italic") == 0) {
+ selection->priv->is_italic = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "italic");
+ } else if (g_strcmp0 (key, "Subscript") == 0) {
+ selection->priv->is_subscript = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "subscript");
+ } else if (g_strcmp0 (key, "Superscript") == 0) {
+ selection->priv->is_superscript = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "superscript");
+ } else if (g_strcmp0 (key, "Strikethrough") == 0) {
+ selection->priv->is_strikethrough = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "strikethrough");
+ } else if (g_strcmp0 (key, "Underline") == 0) {
+ selection->priv->is_underline = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "underline");
+ } else if (g_strcmp0 (key, "Monospaced") == 0) {
+ selection->priv->is_monospaced = g_variant_get_boolean (value);
+ g_object_notify (G_OBJECT (selection), "monospaced");
+ } else if (g_strcmp0 (key, "HTMLMode") != 0 &&
+ g_strcmp0 (key, "Changed") != 0)
+ g_warning ("UNKNOWN PROPERTY %s IN %s", key, __FUNCTION__);
+ g_print (" %s -> %s\n", key, value_str);
+ g_free (value_str);
+ }
+ g_variant_iter_free (iter);
+ }
- g_object_notify (G_OBJECT (selection), "background-color");
- g_object_notify (G_OBJECT (selection), "bold");
- g_object_notify (G_OBJECT (selection), "font-name");
- g_object_notify (G_OBJECT (selection), "font-size");
- g_object_notify (G_OBJECT (selection), "font-color");
- g_object_notify (G_OBJECT (selection), "italic");
- g_object_notify (G_OBJECT (selection), "monospaced");
- g_object_notify (G_OBJECT (selection), "strikethrough");
- g_object_notify (G_OBJECT (selection), "subscript");
- g_object_notify (G_OBJECT (selection), "superscript");
- g_object_notify (G_OBJECT (selection), "underline");
+ if (g_strv_length ((GStrv) invalidated_properties) > 0) {
+ guint n;
+ g_print (" *** Properties Invalidated:\n");
+ for (n = 0; invalidated_properties[n] != NULL; n++)
+ {
+ const gchar *key = invalidated_properties[n];
+ g_print (" %s\n", key);
+ }
+ }
- out:
- g_object_unref (view);
g_object_thaw_notify (G_OBJECT (selection));
}
-void
-e_html_editor_selection_block_selection_changed (EHTMLEditorSelection *selection)
+static void
+html_editor_selection_set_html_editor_view (EHTMLEditorSelection *selection,
+ EHTMLEditorView *view)
{
- EHTMLEditorView *view;
+ g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view));
- view = e_html_editor_selection_ref_html_editor_view (selection);
- g_signal_handlers_block_by_func (
- view, html_editor_selection_selection_changed_cb, selection);
- g_object_unref (view);
+ g_weak_ref_set (&selection->priv->html_editor_view, view);
}
void
-e_html_editor_selection_unblock_selection_changed (EHTMLEditorSelection *selection)
+e_html_editor_selection_activate_properties_changed (EHTMLEditorSelection *selection)
{
EHTMLEditorView *view;
+ GDBusProxy *web_extension;
- view = e_html_editor_selection_ref_html_editor_view (selection);
- g_signal_handlers_unblock_by_func (
- view, html_editor_selection_selection_changed_cb, selection);
-
- html_editor_selection_selection_changed_cb (WEBKIT_WEB_VIEW (view), selection);
-
- g_object_unref (view);
-}
+ g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
-static void
-html_editor_selection_set_html_editor_view (EHTMLEditorSelection *selection,
- EHTMLEditorView *view)
-{
- gulong handler_id = 0;
+ view = e_html_editor_selection_ref_html_editor_view (selection);
+ g_return_if_fail (view != NULL);
- g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view));
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension) {
+ g_object_unref (view);
+ return;
+ }
- g_weak_ref_set (&selection->priv->html_editor_view, view);
-/* FIXME WK2
- handler_id = g_signal_connect (
- view, "selection-changed",
- G_CALLBACK (html_editor_selection_selection_changed_cb),
- selection);*/
+ selection->priv->g_properties_changed_handler_id = g_signal_connect (
+ web_extension, "g-properties-changed",
+ G_CALLBACK (web_extension_properties_changed_cb), selection);
- selection->priv->selection_changed_handler_id = handler_id;
+ g_object_unref (view);
}
static void
@@ -405,9 +445,14 @@ html_editor_selection_dispose (GObject *object)
view = g_weak_ref_get (&priv->html_editor_view);
if (view != NULL) {
- g_signal_handler_disconnect (
- view, priv->selection_changed_handler_id);
- priv->selection_changed_handler_id = 0;
+ GDBusProxy *web_extension;
+
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (web_extension) {
+ g_signal_handler_disconnect (
+ web_extension, priv->g_properties_changed_handler_id);
+ priv->g_properties_changed_handler_id = 0;
+ }
g_object_unref (view);
}
@@ -718,14 +763,7 @@ e_html_editor_selection_class_init (EHTMLEditorSelectionClass *class)
static void
e_html_editor_selection_init (EHTMLEditorSelection *selection)
{
- GSettings *g_settings;
-
selection->priv = E_HTML_EDITOR_SELECTION_GET_PRIVATE (selection);
-
- g_settings = e_util_ref_settings ("org.gnome.evolution.mail");
- selection->priv->word_wrap_length =
- g_settings_get_int (g_settings, "composer-word-wrap-length");
- g_object_unref (g_settings);
}
/**
@@ -890,6 +928,7 @@ e_html_editor_selection_replace (EHTMLEditorSelection *selection,
EHTMLEditorView *view;
GDBusProxy *web_extension;
+ printf ("%s\n", __FUNCTION__);
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
view = e_html_editor_selection_ref_html_editor_view (selection);
@@ -899,7 +938,7 @@ e_html_editor_selection_replace (EHTMLEditorSelection *selection,
if (!web_extension)
goto out;
- g_dbus_proxy_call (
+ g_dbus_proxy_call_sync (
web_extension,
"DOMSelectionReplace",
g_variant_new ("(ts)",
@@ -908,7 +947,6 @@ e_html_editor_selection_replace (EHTMLEditorSelection *selection,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
- NULL,
NULL);
out:
@@ -932,8 +970,6 @@ html_editor_selection_get_format_string (EHTMLEditorSelection *selection,
if (!web_extension)
goto out;
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
/* FIXME WK2 get cached property format_name from extension */
out:
g_object_unref (view);
@@ -945,12 +981,12 @@ static void
html_editor_selection_set_format_string (EHTMLEditorSelection *selection,
const gchar *format_name,
const gchar *format_dom_function,
- const gchar *format_value,
- gchar **format_value_priv)
+ const gchar *format_value)
{
EHTMLEditorView *view;
GDBusProxy *web_extension;
+ printf ("%s - %s - %s\n", __FUNCTION__, format_dom_function, format_value);
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
view = e_html_editor_selection_ref_html_editor_view (selection);
@@ -976,62 +1012,22 @@ html_editor_selection_set_format_string (EHTMLEditorSelection *selection,
NULL,
NULL);
- if (format_value_priv) {
- g_free (&format_value_priv);
- *format_value_priv = g_strdup (format_value);
- }
-
g_object_notify (G_OBJECT (selection), format_name);
out:
g_object_unref (view);
}
-static gboolean
-html_editor_selection_get_format_boolean (EHTMLEditorSelection *selection,
- const gchar *format_name)
-{
- EHTMLEditorView *view;
- gboolean ret_val = FALSE;
- GDBusProxy *web_extension;
-
- g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
-
- view = e_html_editor_selection_ref_html_editor_view (selection);
- g_return_val_if_fail (view != NULL, FALSE);
-
- web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (!web_extension)
- goto out;
-
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
-/* FIXME WK2 get cached property format_name from extension */
- out:
- g_object_unref (view);
-
- return ret_val;
-}
-
static void
html_editor_selection_set_format_boolean (EHTMLEditorSelection *selection,
- const gchar *format_name,
const gchar *format_dom_function,
- gboolean format_value,
- gboolean *format_value_priv)
+ gboolean format_value)
{
EHTMLEditorView *view;
GDBusProxy *web_extension;
- if (format_value_priv && *format_value_priv == format_value)
- return;
-
view = e_html_editor_selection_ref_html_editor_view (selection);
g_return_if_fail (view != NULL);
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
-
- e_html_editor_view_set_changed (view, TRUE);
web_extension = e_html_editor_view_get_web_extension_proxy (view);
if (!web_extension)
goto out;
@@ -1048,71 +1044,21 @@ html_editor_selection_set_format_boolean (EHTMLEditorSelection *selection,
NULL,
NULL,
NULL);
-
- if (format_value_priv)
- *format_value_priv = format_value;
- g_object_notify (G_OBJECT (selection), format_name);
-
out:
g_object_unref (view);
}
-static guint
-html_editor_selection_get_format_uint (EHTMLEditorSelection *selection,
- const gchar *format_name)
-{
- EHTMLEditorView *view;
- guint ret_val = 0;
- GDBusProxy *web_extension;
-
- if (!E_IS_HTML_EDITOR_SELECTION (selection))
- goto return_default;
-
- view = e_html_editor_selection_ref_html_editor_view (selection);
- if (!view)
- goto return_default;
-
- web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (!web_extension)
- goto out;
-
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
-/* FIXME WK2 get cached property format_name from extension */
- out:
- g_object_unref (view);
-
- return ret_val;
-
- return_default:
- if (g_strcmp0 (format_name, "font-size") == 0)
- return E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL;
- else if (g_strcmp0 (format_name, "alignment") == 0)
- return E_HTML_EDITOR_SELECTION_ALIGNMENT_LEFT;
- else
- return E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH;
-}
-
static void
-html_editor_selection_set_format_uint (EHTMLEditorSelection *selection,
- const gchar *format_name,
- const gchar *format_dom_function,
- guint format_value,
- guint *format_value_priv)
+html_editor_selection_set_format_unsigned (EHTMLEditorSelection *selection,
+ const gchar *format_dom_function,
+ guint format_value)
{
EHTMLEditorView *view;
GDBusProxy *web_extension;
- if (format_value_priv && *format_value_priv == format_value)
- return;
-
view = e_html_editor_selection_ref_html_editor_view (selection);
g_return_if_fail (view != NULL);
- if (!e_html_editor_view_get_html_mode (view))
- goto out;
-
- e_html_editor_view_set_changed (view, TRUE);
web_extension = e_html_editor_view_get_web_extension_proxy (view);
if (!web_extension)
goto out;
@@ -1121,7 +1067,7 @@ html_editor_selection_set_format_uint (EHTMLEditorSelection *selection,
web_extension,
format_dom_function,
g_variant_new (
- "(tb)",
+ "(tu)",
webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
format_value),
G_DBUS_CALL_FLAGS_NONE,
@@ -1130,10 +1076,6 @@ html_editor_selection_set_format_uint (EHTMLEditorSelection *selection,
NULL,
NULL);
- if (format_value_priv)
- *format_value_priv = format_value;
- g_object_notify (G_OBJECT (selection), format_name);
-
out:
g_object_unref (view);
}
@@ -1153,7 +1095,7 @@ e_html_editor_selection_get_alignment (EHTMLEditorSelection *selection)
E_IS_HTML_EDITOR_SELECTION (selection),
E_HTML_EDITOR_SELECTION_ALIGNMENT_LEFT);
- return html_editor_selection_get_format_uint (selection, "alignment");
+ return selection->priv->alignment;
}
/**
@@ -1169,8 +1111,8 @@ e_html_editor_selection_set_alignment (EHTMLEditorSelection *selection,
{
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
- html_editor_selection_set_format_uint (
- selection, "alignment", "DOMSelectionSetAlignment", alignment, NULL);
+ html_editor_selection_set_format_unsigned (
+ selection, "DOMSelectionSetAlignment", alignment);
}
@@ -1189,7 +1131,7 @@ e_html_editor_selection_get_block_format (EHTMLEditorSelection *selection)
E_IS_HTML_EDITOR_SELECTION (selection),
E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_PARAGRAPH);
- return html_editor_selection_get_format_uint (selection, "block-format");
+ return selection->priv->block_format;
}
/**
@@ -1205,16 +1147,8 @@ e_html_editor_selection_set_block_format (EHTMLEditorSelection *selection,
{
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
- html_editor_selection_set_format_uint (
- selection, "block-format", "DOMSelectionSetBlockFormat", format, NULL);
-
- /* H1 - H6 have bold font by default */
- if (format >= E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_H1 &&
- format <= E_HTML_EDITOR_SELECTION_BLOCK_FORMAT_H6)
- selection->priv->is_bold = TRUE;
-
- /* When changing the format we need to re-set the alignment */
- e_html_editor_selection_set_alignment (selection, selection->priv->alignment);
+ html_editor_selection_set_format_unsigned (
+ selection, "DOMSelectionSetBlockFormat", format);
}
/**
@@ -1285,8 +1219,7 @@ e_html_editor_selection_set_background_color (EHTMLEditorSelection *selection,
selection,
"background-color",
"DOMSelectionSetBackgroundColor",
- color,
- NULL);
+ color);
}
/**
@@ -1325,7 +1258,7 @@ e_html_editor_selection_set_font_name (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_string (
- selection, "font-name", "DOMSelectionSetFontName", font_name, NULL);
+ selection, "font-name", "DOMSelectionSetFontName", font_name);
}
/**
@@ -1340,30 +1273,25 @@ void
e_html_editor_selection_get_font_color (EHTMLEditorSelection *selection,
GdkRGBA *rgba)
{
+ EHTMLEditorView *view;
+ gchar *color;
+
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
-/* FIXME WK2
- gchar *color;
+ view = e_html_editor_selection_ref_html_editor_view (selection);
+ g_return_if_fail (view != NULL);
- if (!html_mode) {
+ if (!e_html_editor_view_get_html_mode (view)) {
+ printf ("%s\n", __FUNCTION__);
*rgba = black;
+ g_object_unref (view);
return;
}
- if (e_html_editor_selection_is_collapsed (selection)) {
- color = g_strdup (selection->priv->font_color);
- } else {
- color = get_font_property (selection, "color");
- if (!color) {
- *rgba = black;
- return;
- }
- }
-
+ color = g_strdup (selection->priv->font_color);
gdk_rgba_parse (rgba, color);
g_free (color);
-*/
- *rgba = black;
+ g_object_unref (view);
}
/**
@@ -1391,8 +1319,7 @@ e_html_editor_selection_set_font_color (EHTMLEditorSelection *selection,
selection,
"font-color",
"DOMSelectionSetFontColor",
- color,
- &selection->priv->font_color);
+ color);
g_free (color);
}
@@ -1410,7 +1337,7 @@ e_html_editor_selection_get_font_size (EHTMLEditorSelection *selection)
E_IS_HTML_EDITOR_SELECTION (selection),
E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL);
- return html_editor_selection_get_format_uint (selection, "font-size");
+ return selection->priv->font_size;
}
/**
@@ -1427,12 +1354,8 @@ e_html_editor_selection_set_font_size (EHTMLEditorSelection *selection,
{
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
- html_editor_selection_set_format_uint (
- selection,
- "font-size",
- "DOMSelectionSetFontSize",
- font_size,
- &selection->priv->font_size);
+ html_editor_selection_set_format_unsigned (
+ selection, "DOMSelectionSetFontSize", font_size);
}
/**
@@ -1495,7 +1418,7 @@ e_html_editor_selection_is_indented (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "indented");
+ return selection->priv->is_indented;
}
void
@@ -1537,9 +1460,9 @@ e_html_editor_selection_unindent (EHTMLEditorSelection *selection)
gboolean
e_html_editor_selection_is_bold (EHTMLEditorSelection *selection)
{
- g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
+ g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
- return html_editor_selection_get_format_boolean (selection, "bold");
+ return selection->priv->is_bold;
}
/**
@@ -1557,11 +1480,7 @@ e_html_editor_selection_set_bold (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection,
- "bold",
- "DOMSelectionSetBold",
- bold,
- &selection->priv->is_bold);
+ selection, "DOMSelectionSetBold", bold);
}
/**
@@ -1578,7 +1497,7 @@ e_html_editor_selection_is_italic (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "italic");
+ return selection->priv->is_italic;
}
/**
@@ -1596,11 +1515,7 @@ e_html_editor_selection_set_italic (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection,
- "italic",
- "DOMSelectionSetItalic",
- italic,
- &selection->priv->is_italic);
+ selection, "DOMSelectionSetItalic", italic);
}
/**
@@ -1617,7 +1532,7 @@ e_html_editor_selection_is_monospaced (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "monospaced");
+ return selection->priv->is_monospaced;
}
/**
@@ -1635,11 +1550,7 @@ e_html_editor_selection_set_monospaced (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection,
- "monospaced",
- "DOMSelectionSetMonospaced",
- monospaced,
- &selection->priv->is_monospaced);
+ selection, "DOMSelectionSetMonospaced", monospaced);
}
/**
@@ -1656,7 +1567,7 @@ e_html_editor_selection_is_strikethrough (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "strikethrough");
+ return selection->priv->is_strikethrough;
}
/**
@@ -1674,11 +1585,7 @@ e_html_editor_selection_set_strikethrough (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection,
- "strikethrough",
- "DOMSelectionSetStrikethrough",
- strikethrough,
- &selection->priv->is_strikethrough);
+ selection, "DOMSelectionSetStrikethrough", strikethrough);
}
/**
@@ -1695,7 +1602,7 @@ e_html_editor_selection_is_subscript (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "subscript");
+ return selection->priv->is_subscript;
}
/**
@@ -1713,7 +1620,7 @@ e_html_editor_selection_set_subscript (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection, "subscript", "DOMSelectionSetSubscript", subscript, NULL);
+ selection, "DOMSelectionSetSubscript", subscript);
}
/**
@@ -1730,7 +1637,7 @@ e_html_editor_selection_is_superscript (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "superscript");
+ return selection->priv->is_superscript;
}
/**
@@ -1748,7 +1655,7 @@ e_html_editor_selection_set_superscript (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection, "superscript", "DOMSSelectionetSuperscript", superscript, NULL);
+ selection, "DOMSSelectionetSuperscript", superscript);
}
/**
@@ -1765,7 +1672,7 @@ e_html_editor_selection_is_underline (EHTMLEditorSelection *selection)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_SELECTION (selection), FALSE);
- return html_editor_selection_get_format_boolean (selection, "underline");
+ return selection->priv->is_underline;
}
void
@@ -1775,11 +1682,7 @@ e_html_editor_selection_set_underline (EHTMLEditorSelection *selection,
g_return_if_fail (E_IS_HTML_EDITOR_SELECTION (selection));
html_editor_selection_set_format_boolean (
- selection,
- "underline",
- "DOMSelectionSetUnderline",
- underline,
- &selection->priv->is_underline);
+ selection, "DOMSelectionSetUnderline", underline);
}
static void
diff --git a/e-util/e-html-editor-selection.h b/e-util/e-html-editor-selection.h
index c204ae8..9470d52 100644
--- a/e-util/e-html-editor-selection.h
+++ b/e-util/e-html-editor-selection.h
@@ -70,6 +70,8 @@ GType e_html_editor_selection_get_type
struct _EHTMLEditorView *
e_html_editor_selection_ref_html_editor_view
(EHTMLEditorSelection *selection);
+void e_html_editor_selection_activate_properties_changed
+ (EHTMLEditorSelection *selection);
void e_html_editor_selection_block_selection_changed
(EHTMLEditorSelection *selection);
void e_html_editor_selection_unblock_selection_changed
diff --git a/e-util/e-html-editor-spell-check-dialog.c b/e-util/e-html-editor-spell-check-dialog.c
index 0304c2c..b652c9a 100644
--- a/e-util/e-html-editor-spell-check-dialog.c
+++ b/e-util/e-html-editor-spell-check-dialog.c
@@ -164,12 +164,14 @@ move_to_another_word (EHTMLEditorSpellCheckDialog *dialog,
const gchar *next_word;
gsize length;
- next_word = g_variant_get_string (result, &length);
- if (length > 0)
+ g_variant_get (result, "(&s)", &next_word);
+ if (next_word && *next_word) {
html_editor_spell_check_dialog_set_word (dialog, next_word);
- g_variant_unref (result);
- if (length > 0)
+ g_variant_unref (result);
return TRUE;
+ }
+
+ g_variant_unref (result);
}
/* Close the dialog */
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 0f55502..c009956 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -27,7 +27,7 @@
#include "e-emoticon-chooser.h"
#include "e-misc-utils.h"
-#include <web-extensions/e-html-editor-web-extension-names.h>
+#include <web-extensions/composer/e-html-editor-web-extension-names.h>
#include <e-util/e-util.h>
#include <e-util/e-marshal.h>
@@ -63,6 +63,10 @@ struct _EHTMLEditorViewPrivate {
EHTMLEditorSelection *selection;
+ gchar *current_user_stylesheet;
+
+ WebKitLoadEvent webkit_load_event;
+
GSettings *mail_settings;
GSettings *font_settings;
GSettings *aliasing_settings;
@@ -205,12 +209,6 @@ e_html_editor_view_redo (EHTMLEditorView *view)
}
static void
-html_editor_view_user_changed_contents_cb (EHTMLEditorView *view)
-{
- e_html_editor_view_set_changed (view, TRUE);
-}
-
-static void
html_editor_view_can_copy_cb (WebKitWebView *webkit_web_view,
GAsyncResult *result,
EHTMLEditorView *view)
@@ -283,16 +281,6 @@ html_editor_view_selection_changed_cb (EHTMLEditorView *view)
web_view = WEBKIT_WEB_VIEW (view);
- /* When the webview is being (re)loaded, the document is in an
- * inconsistant state and there is no selection, so don't propagate
- * the signal further to EHTMLEditorSelection and others and wait until
- * the load is finished. */
- if (view->priv->reload_in_progress) {
- /* FIXME WK2
- g_signal_stop_emission_by_name (view, "selection-changed"); */
- return;
- }
-
webkit_web_view_can_execute_editing_command (
WEBKIT_WEB_VIEW (web_view),
WEBKIT_EDITING_COMMAND_COPY,
@@ -544,6 +532,11 @@ html_editor_view_dispose (GObject *object)
priv->web_extension_watch_name_id = 0;
}
+ if (priv->current_user_stylesheet != NULL) {
+ g_free (priv->current_user_stylesheet);
+ priv->current_user_stylesheet = NULL;
+ }
+
g_clear_object (&priv->selection);
g_clear_object (&priv->web_extension);
@@ -577,18 +570,20 @@ html_editor_view_finalize (GObject *object)
static void
html_editor_view_constructed (GObject *object)
{
- WebKitSettings *web_settings;
-
e_extensible_load_extensions (E_EXTENSIBLE (object));
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_html_editor_view_parent_class)->constructed (object);
- web_settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (object));
+ webkit_web_view_set_editable (WEBKIT_WEB_VIEW (object), TRUE);
e_html_editor_view_update_fonts (E_HTML_EDITOR_VIEW (object));
/* FIXME WK2
+ WebKitSettings *web_settings;
+
+ web_settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (object));
+
g_object_set (
G_OBJECT (web_settings),
"enable-dom-paste", TRUE,
@@ -614,7 +609,7 @@ e_html_editor_view_move_selection_on_point (EHTMLEditorView *view,
g_return_if_fail (y >= 0);
web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (web_extension)
+ if (!web_extension)
return;
g_dbus_proxy_call_sync (
@@ -697,12 +692,19 @@ editor_view_mouse_target_changed_cb (EHTMLEditorView *view,
}
static gboolean
+is_return_key (guint key_val)
+{
+ return (
+ (key_val == GDK_KEY_Return) ||
+ (key_val == GDK_KEY_Linefeed) ||
+ (key_val == GDK_KEY_KP_Enter));
+}
+
+static gboolean
html_editor_view_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
EHTMLEditorView *view = E_HTML_EDITOR_VIEW (widget);
- GDBusProxy *web_extension;
- GVariant *result;
if (event->keyval == GDK_KEY_Menu) {
gboolean event_handled;
@@ -715,32 +717,42 @@ html_editor_view_key_press_event (GtkWidget *widget,
return event_handled;
}
- web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (web_extension)
- return FALSE;
-
- result = g_dbus_proxy_call_sync (
- web_extension,
- "DOMProcessOnKeyPress",
- g_variant_new (
- "(tu)",
- webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
- event->keyval),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- NULL);
+ if (event->keyval == GDK_KEY_Tab ||
+ event->keyval == GDK_KEY_ISO_Left_Tab ||
+ event->keyval == GDK_KEY_BackSpace ||
+ event->keyval == GDK_KEY_Delete ||
+ is_return_key (event->keyval)) {
+ GDBusProxy *web_extension;
+ GVariant *result;
+
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension)
+ goto out;
+
+ result = g_dbus_proxy_call_sync (
+ web_extension,
+ "DOMProcessOnKeyPress",
+ g_variant_new (
+ "(tu)",
+ webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
+ event->keyval),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL);
- if (result) {
- gboolean ret_val = FALSE;
+ if (result) {
+ gboolean ret_val = FALSE;
- ret_val = g_variant_get_boolean (result);
- g_variant_unref (result);
+ g_variant_get (result, "(b)", &ret_val);
+ g_variant_unref (result);
- if (ret_val)
- return ret_val;
+ if (ret_val)
+ return ret_val;
+ }
}
+ out:
/* Chain up to parent's key_press_event() method. */
return GTK_WIDGET_CLASS (e_html_editor_view_parent_class)->key_press_event (widget, event);
}
@@ -776,6 +788,36 @@ html_editor_view_paste_clipboard_quoted (EHTMLEditorView *view)
}
static void
+set_web_extension_boolean_property (EHTMLEditorView *view,
+ const gchar *property_name,
+ gboolean value)
+{
+ GDBusProxy *web_extension;
+
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension)
+ return;
+
+ g_dbus_connection_call (
+ g_dbus_proxy_get_connection (web_extension),
+ E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
+ E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ g_variant_new (
+ "(ssv)",
+ E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
+ property_name,
+ g_variant_new_boolean (value)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+}
+
+static void
web_extension_proxy_created_cb (GDBusProxy *proxy,
GAsyncResult *result,
EHTMLEditorView *view)
@@ -786,7 +828,15 @@ web_extension_proxy_created_cb (GDBusProxy *proxy,
if (!view->priv->web_extension) {
g_warning ("Error creating web extension proxy: %s\n", error->message);
g_error_free (error);
+
+ return;
}
+
+ e_html_editor_selection_activate_properties_changed (view->priv->selection);
+
+ set_web_extension_boolean_property (view, "MagicSmileys", view->priv->magic_smileys);
+ set_web_extension_boolean_property (view, "MagicLinks", view->priv->magic_smileys);
+ set_web_extension_boolean_property (view, "InlineSpelling", view->priv->magic_smileys);
}
static void
@@ -986,6 +1036,20 @@ html_editor_view_constructor (GType type,
param_spec = g_object_class_find_property(object_class, "user-content-manager");
if ((param = find_property (n_construct_properties, construct_properties, param_spec)))
g_value_take_object (param->value, webkit_user_content_manager_new ());
+ param_spec = g_object_class_find_property(object_class, "web-context");
+ if ((param = find_property (n_construct_properties, construct_properties, param_spec))) {
+ WebKitWebContext *web_context;
+
+ web_context = webkit_web_context_new ();
+
+ webkit_web_context_set_cache_model (
+ web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
+
+ webkit_web_context_set_web_extensions_directory (
+ web_context, EVOLUTION_WEB_EXTENSIONS_COMPOSER_DIR);
+
+ g_value_take_object (param->value, web_context);
+ }
}
g_type_class_unref (object_class);
@@ -994,15 +1058,6 @@ html_editor_view_constructor (GType type,
}
static void
-html_editor_view_initialize_web_context (void)
-{
- WebKitWebContext *web_context = webkit_web_context_get_default ();
-
- webkit_web_context_set_cache_model (
- web_context, WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER);
-}
-
-static void
e_html_editor_view_class_init (EHTMLEditorViewClass *class)
{
GObjectClass *object_class;
@@ -1010,8 +1065,6 @@ e_html_editor_view_class_init (EHTMLEditorViewClass *class)
g_type_class_add_private (class, sizeof (EHTMLEditorViewPrivate));
- html_editor_view_initialize_web_context ();
-
object_class = G_OBJECT_CLASS (class);
object_class->constructor = html_editor_view_constructor;
object_class->get_property = html_editor_view_get_property;
@@ -1261,14 +1314,6 @@ e_html_editor_view_class_init (EHTMLEditorViewClass *class)
}
static void
-initialize_web_extensions_cb (WebKitWebContext *web_context)
-{
- /* Set the web extensions dir before the process is launched */
- webkit_web_context_set_web_extensions_directory (
- web_context, EVOLUTION_WEB_EXTENSIONS_DIR);
-}
-
-static void
e_html_editor_settings_changed_cb (GSettings *settings,
const gchar *key,
EHTMLEditorView *view)
@@ -1322,6 +1367,50 @@ e_html_editor_view_get_selection (EHTMLEditorView *view)
return view->priv->selection;
}
+guint32
+e_html_editor_view_get_web_extension_unsigned_property (EHTMLEditorView *view,
+ const gchar *property_name)
+{
+ guint32 value = 0;
+ GVariant *result;
+ GDBusProxy *web_extension;
+
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension)
+ return FALSE;
+
+ result = g_dbus_proxy_get_cached_property (web_extension, property_name);
+ if (!result)
+ return FALSE;
+
+ value = g_variant_get_uint32 (result);
+ g_variant_unref (result);
+
+ return value;
+}
+
+gboolean
+e_html_editor_view_get_web_extension_boolean_property (EHTMLEditorView *view,
+ const gchar *property_name)
+{
+ gboolean value = FALSE;
+ GVariant *result;
+ GDBusProxy *web_extension;
+
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension)
+ return FALSE;
+
+ result = g_dbus_proxy_get_cached_property (web_extension, property_name);
+ if (!result)
+ return FALSE;
+
+ value = g_variant_get_boolean (result);
+ g_variant_unref (result);
+
+ return value;
+}
+
/**
* e_html_editor_view_get_changed:
* @view: an #EHTMLEditorView
@@ -1335,7 +1424,7 @@ e_html_editor_view_get_changed (EHTMLEditorView *view)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_VIEW (view), FALSE);
- return view->priv->changed;
+ return e_html_editor_view_get_web_extension_boolean_property (view, "Changed");
}
/**
@@ -1408,6 +1497,8 @@ static void
html_editor_view_load_changed_cb (EHTMLEditorView *view,
WebKitLoadEvent load_event)
{
+ view->priv->webkit_load_event = load_event;
+
if (load_event != WEBKIT_LOAD_FINISHED)
return;
@@ -1435,43 +1526,6 @@ html_editor_view_load_changed_cb (EHTMLEditorView *view,
}
-static void
-set_cached_boolean_property (EHTMLEditorView *view,
- const gchar *property_name,
- gboolean value)
-{
- GDBusProxy *web_extension;
-
- web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (!web_extension)
- return;
-
- g_dbus_proxy_set_cached_property (
- web_extension, property_name, g_variant_new_boolean (value));
-}
-
-static gboolean
-get_cached_boolean_property (EHTMLEditorView *view,
- const gchar *property_name)
-{
- gboolean value = FALSE;
- GVariant *result;
- GDBusProxy *web_extension;
-
- web_extension = e_html_editor_view_get_web_extension_proxy (view);
- if (!web_extension)
- return FALSE;
-
- result = g_dbus_proxy_get_cached_property (web_extension, property_name);
- if (!result)
- return FALSE;
-
- value = g_variant_get_boolean (result);
- g_variant_unref (result);
-
- return value;
-}
-
/**
* e_html_editor_view_set_html_mode:
* @view: an #EHTMLEditorView
@@ -1508,7 +1562,7 @@ e_html_editor_view_set_html_mode (EHTMLEditorView *view,
NULL);
if (result) {
- convert = g_variant_get_boolean (result);
+ g_variant_get (result, "(b)", &convert);
g_variant_unref (result);
}
@@ -1518,7 +1572,7 @@ e_html_editor_view_set_html_mode (EHTMLEditorView *view,
return;
view->priv->html_mode = html_mode;
- set_cached_boolean_property (view, "HTMLMode", html_mode);
+ set_web_extension_boolean_property (view, "HTMLMode", html_mode);
e_html_editor_view_call_simple_extension_function (
view, "ConvertWhenChangingComposerMode");
@@ -1533,6 +1587,7 @@ e_html_editor_view_set_html_mode (EHTMLEditorView *view,
return;
view->priv->html_mode = html_mode;
+ set_web_extension_boolean_property (view, "HTMLMode", html_mode);
e_html_editor_view_call_simple_extension_function_sync (
view, "DOMProcessContentAfterModeChange");
@@ -1550,7 +1605,7 @@ html_editor_view_drag_end_cb (EHTMLEditorView *view,
{
e_html_editor_view_call_simple_extension_function (view, "DOMDragAndDropEnd");
}
-
+/* FIXME WK2
static void
im_context_preedit_start_cb (GtkIMContext *context,
EHTMLEditorView *view)
@@ -1566,7 +1621,7 @@ im_context_preedit_end_cb (GtkIMContext *context,
e_html_editor_view_call_simple_extension_function_sync (
view, "DOMIMContextPreEditEnd");
}
-
+*/
static void
e_html_editor_view_init (EHTMLEditorView *view)
{
@@ -1575,13 +1630,11 @@ e_html_editor_view_init (EHTMLEditorView *view)
GSettingsSchema *settings_schema;
/* FIXME WK2
GtkIMContext *im_context;
- ESpellChecker *checker;*/
+ ESpellChecker *checker;
gchar **languages;
gchar *comma_separated;
-
+*/
view->priv = E_HTML_EDITOR_VIEW_GET_PRIVATE (view);
-/* FIXME WK2
- webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), TRUE); */
settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view));
view->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)
g_variant_unref);
@@ -1593,14 +1646,8 @@ e_html_editor_view_init (EHTMLEditorView *view)
g_object_unref (checker);
g_signal_connect (
- view, "user-changed-contents",
- G_CALLBACK (html_editor_view_user_changed_contents_cb), NULL);
- g_signal_connect (
view, "selection-changed",
- G_CALLBACK (html_editor_view_selection_changed_cb), NULL);
- g_signal_connect (
- view, "should-show-delete-interface-for-element",
- G_CALLBACK (html_editor_view_should_show_delete_interface_for_element), NULL);*/
+ G_CALLBACK (html_editor_view_selection_changed_cb), NULL);*/
g_signal_connect (
view, "drag-end",
G_CALLBACK (html_editor_view_drag_end_cb), NULL);
@@ -1611,10 +1658,6 @@ e_html_editor_view_init (EHTMLEditorView *view)
view, "mouse-target-changed",
G_CALLBACK (editor_view_mouse_target_changed_cb), NULL);
- g_signal_connect (
- webkit_web_context_get_default (), "initialize-web-extensions",
- G_CALLBACK (initialize_web_extensions_cb), NULL);
-
view->priv->selection = g_object_new (
E_TYPE_HTML_EDITOR_SELECTION,
"html-editor-view", view,
@@ -1666,6 +1709,7 @@ e_html_editor_view_init (EHTMLEditorView *view)
view->priv->remove_initial_input_line = FALSE;
view->priv->convert_in_situ = FALSE;
+ view->priv->current_user_stylesheet = NULL;
/* FIXME WK2
g_object_get (WEBKIT_WEB_VIEW (view), "im-context", &im_context, NULL);
g_signal_connect (
@@ -1724,6 +1768,7 @@ e_html_editor_view_set_inline_spelling (EHTMLEditorView *view,
view->priv->inline_spelling = inline_spelling;
+ set_web_extension_boolean_property (view, "InlineSpelling", view->priv->inline_spelling);
/* FIXME WK2
if (inline_spelling)
e_html_editor_view_force_spell_check (view);
@@ -1768,9 +1813,39 @@ e_html_editor_view_set_magic_links (EHTMLEditorView *view,
view->priv->magic_links = magic_links;
+ set_web_extension_boolean_property (view, "MagicLinks", view->priv->magic_links);
+
g_object_notify (G_OBJECT (view), "magic-links");
}
+void
+e_html_editor_view_insert_smiley (EHTMLEditorView *view,
+ EEmoticon *emoticon)
+{
+ GDBusProxy *web_extension;
+
+ g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view));
+ g_return_if_fail (emoticon != NULL);
+
+ printf ("%s\n", __FUNCTION__);
+ web_extension = e_html_editor_view_get_web_extension_proxy (view);
+ if (!web_extension)
+ return;
+
+ g_dbus_proxy_call (
+ web_extension,
+ "DOMInsertSmiley",
+ g_variant_new (
+ "(ts)",
+ webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
+ e_emoticon_get_name (emoticon)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+}
+
/**
* e_html_editor_view_get_magic_smileys:
* @view: an #EHTMLEditorView
@@ -1802,11 +1877,14 @@ e_html_editor_view_set_magic_smileys (EHTMLEditorView *view,
{
g_return_if_fail (E_IS_HTML_EDITOR_VIEW (view));
+ printf ("%s - %d\n", __FUNCTION__, magic_smileys);
if (view->priv->magic_smileys == magic_smileys)
return;
view->priv->magic_smileys = magic_smileys;
+ set_web_extension_boolean_property (view, "MagicSmileys", view->priv->magic_smileys);
+
g_object_notify (G_OBJECT (view), "magic-smileys");
}
@@ -1893,9 +1971,8 @@ process_document (EHTMLEditorView *view,
if (result) {
gchar *value;
- gsize length = 0;
- value = g_variant_dup_string (result, &length);
+ g_variant_get (result, "(s)", &value);
g_variant_unref (result);
return value;
@@ -2043,9 +2120,8 @@ e_html_editor_view_get_text_html (EHTMLEditorView *view,
if (result) {
gchar *value;
- gsize length = 0;
- value = g_variant_dup_string (result, &length);
+ g_variant_get (result, "(s)", &value);
g_variant_unref (result);
return value;
@@ -2158,15 +2234,11 @@ void
e_html_editor_view_set_text_html (EHTMLEditorView *view,
const gchar *text)
{
-#if 0 /* FIXME WK2 */
- WebKitLoadStatus status;
-
/* It can happen that the view is not ready yet (it is in the middle of
* another load operation) so we have to queue the current operation and
* redo it again when the view is ready. This was happening when loading
* the stuff in EMailSignatureEditor. */
- status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));
- if (status != WEBKIT_LOAD_FINISHED) {
+ if (view->priv->webkit_load_event != WEBKIT_LOAD_FINISHED) {
html_editor_view_queue_post_reload_operation (
view,
(PostReloadOperationFunc) e_html_editor_view_set_text_html,
@@ -2174,7 +2246,7 @@ e_html_editor_view_set_text_html (EHTMLEditorView *view,
g_free);
return;
}
-#endif
+
if (view->priv->reload_in_progress) {
html_editor_view_queue_post_reload_operation (
view,
@@ -2227,15 +2299,12 @@ e_html_editor_view_set_text_plain (EHTMLEditorView *view,
const gchar *text)
{
GDBusProxy *web_extension;
-#if 0 /* FIXME WK2 */
- WebKitLoadStatus status;
/* It can happen that the view is not ready yet (it is in the middle of
* another load operation) so we have to queue the current operation and
* redo it again when the view is ready. This was happening when loading
* the stuff in EMailSignatureEditor. */
- status = webkit_web_view_get_load_status (WEBKIT_WEB_VIEW (view));
- if (status != WEBKIT_LOAD_FINISHED) {
+ if (view->priv->webkit_load_event != WEBKIT_LOAD_FINISHED) {
html_editor_view_queue_post_reload_operation (
view,
(PostReloadOperationFunc) e_html_editor_view_set_text_plain,
@@ -2243,7 +2312,7 @@ e_html_editor_view_set_text_plain (EHTMLEditorView *view,
g_free);
return;
}
-#endif
+
if (view->priv->reload_in_progress) {
html_editor_view_queue_post_reload_operation (
view,
@@ -2309,11 +2378,6 @@ void
e_html_editor_view_embed_styles (EHTMLEditorView *view)
{
GDBusProxy *web_extension;
- gchar *stylesheet_uri;
- gchar *stylesheet_content;
- const gchar *stylesheet;
- gsize length;
- WebKitSettings *settings;
g_return_if_fail (view != NULL);
@@ -2321,36 +2385,20 @@ e_html_editor_view_embed_styles (EHTMLEditorView *view)
if (!web_extension)
return;
- settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW (view));
-
- g_object_get (
- G_OBJECT (settings),
- "user-stylesheet-uri", &stylesheet_uri,
- NULL);
-
- stylesheet = strstr (stylesheet_uri, ",");
- stylesheet_content = (gchar *) g_base64_decode (stylesheet, &length);
- g_free (stylesheet_uri);
-
- if (length == 0) {
- g_free (stylesheet_content);
- return;
+ if (view->priv->current_user_stylesheet) {
+ g_dbus_proxy_call (
+ web_extension,
+ "DOMEmbedStyleSheet",
+ g_variant_new (
+ "(ts)",
+ webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
+ view->priv->current_user_stylesheet),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
}
-
- g_dbus_proxy_call (
- web_extension,
- "DOMEmbedStyleSheet",
- g_variant_new (
- "(ts)",
- webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
- stylesheet_content),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- NULL,
- NULL);
-
- g_free (stylesheet_content);
}
void
@@ -2785,6 +2833,9 @@ e_html_editor_view_update_fonts (EHTMLEditorView *view)
webkit_user_content_manager_add_style_sheet (manager, style_sheet);
+ g_free (view->priv->current_user_stylesheet);
+ view->priv->current_user_stylesheet = g_string_free (stylesheet, FALSE);
+
webkit_user_style_sheet_unref (style_sheet);
pango_font_description_free (ms);
@@ -2873,7 +2924,7 @@ e_html_editor_view_is_message_from_draft (EHTMLEditorView *view)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_VIEW (view), FALSE);
- return get_cached_boolean_property (view, "IsMessageFromDraft");
+ return e_html_editor_view_get_web_extension_boolean_property (view, "IsMessageFromDraft");
}
void
@@ -2890,7 +2941,7 @@ e_html_editor_view_is_message_from_edit_as_new (EHTMLEditorView *view)
{
g_return_val_if_fail (E_IS_HTML_EDITOR_VIEW (view), FALSE);
- return get_cached_boolean_property (view, "IsMessageFromEditAsNew");
+ return e_html_editor_view_get_web_extension_boolean_property (view, "IsMessageFromEditAsNew");
}
void
e_html_editor_view_set_is_message_from_edit_as_new (EHTMLEditorView *view,
@@ -3015,9 +3066,9 @@ insert_base64_image (EHTMLEditorView *view,
g_dbus_proxy_call (
web_extension,
- "EHTMLEditorSelectionInsertBase64Image",
+ "DOMSelectionInsertBase64Image",
g_variant_new (
- "(tssss)",
+ "(tsss)",
webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (view)),
base64_content,
filename,
@@ -3320,7 +3371,7 @@ e_html_editor_view_save_selection (EHTMLEditorView *view)
{
e_html_editor_view_call_simple_extension_function (view, "DOMSaveSelection");
}
-
+/* FIXME WK2
static void
set_link_color (EHTMLEditorView *view)
{
@@ -3344,11 +3395,11 @@ set_link_color (EHTMLEditorView *view)
rgba.blue = ((gdouble) color->blue) / G_MAXUINT16;
}
- /* FIXME WK2
- * This set_link_color needs to be called when the document is loaded
- * (so we will probably emit the signal from WebProcess to Evo when this
- * happens).
- e_html_editor_view_set_link_color (view, &rgba); */
+ // This set_link_color needs to be called when the document is loaded
+ // (so we will probably emit the signal from WebProcess to Evo when this
+ // happens).
+ e_html_editor_view_set_link_color (view, &rgba);
gdk_color_free (color);
}
+*/
diff --git a/e-util/e-html-editor-view.h b/e-util/e-html-editor-view.h
index e54657f..a0636ad 100644
--- a/e-util/e-html-editor-view.h
+++ b/e-util/e-html-editor-view.h
@@ -103,6 +103,12 @@ void e_html_editor_view_remove_element_attribute
EHTMLEditorSelection *
e_html_editor_view_get_selection
(EHTMLEditorView *view);
+guint32 e_html_editor_view_get_web_extension_unsigned_property
+ (EHTMLEditorView *view,
+ const gchar *property_name);
+gboolean e_html_editor_view_get_web_extension_boolean_property
+ (EHTMLEditorView *view,
+ const gchar *property_name);
gboolean e_html_editor_view_get_changed (EHTMLEditorView *view);
void e_html_editor_view_set_changed (EHTMLEditorView *view,
gboolean changed);
diff --git a/e-util/e-html-editor.c b/e-util/e-html-editor.c
index 2b7775f..43c38d7 100644
--- a/e-util/e-html-editor.c
+++ b/e-util/e-html-editor.c
@@ -336,6 +336,8 @@ html_editor_update_actions (EHTMLEditor *editor)
}
}
+ printf ("%s\n", __FUNCTION__);
+ printf ("%d\n", flags);
spell_checker = e_html_editor_view_get_spell_checker (view);
manager = e_html_editor_get_ui_manager (editor);
@@ -601,7 +603,6 @@ html_editor_constructed (GObject *object)
{
EHTMLEditor *editor = E_HTML_EDITOR (object);
EHTMLEditorPrivate *priv = editor->priv;
- GtkIMMulticontext *im_context;
GtkWidget *widget;
GtkToolbar *toolbar;
GtkToolItem *tool_item;
@@ -708,6 +709,7 @@ html_editor_constructed (GObject *object)
priv->html_editor_view, "editable",
priv->color_combo_box, "sensitive",
G_BINDING_SYNC_CREATE);
+ editor_actions_bind (editor);
tool_item = gtk_tool_item_new ();
widget = e_action_combo_box_new_with_action (
@@ -718,16 +720,6 @@ html_editor_constructed (GObject *object)
gtk_toolbar_insert (toolbar, tool_item, 0);
priv->size_combo_box = g_object_ref (widget);
gtk_widget_show_all (GTK_WIDGET (tool_item));
-
- /* Add input methods to the context menu. */
- widget = e_html_editor_get_managed_widget (
- editor, "/context-menu/context-input-methods-menu");
- widget = gtk_menu_item_get_submenu (GTK_MENU_ITEM (widget));
- g_object_get (
- G_OBJECT (priv->html_editor_view), "im-context", &im_context, NULL);
- gtk_im_multicontext_append_menuitems (
- GTK_IM_MULTICONTEXT (im_context),
- GTK_MENU_SHELL (widget));
}
static void
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 21625c6..efdc3e4 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -463,6 +463,7 @@ web_view_context_menu_cb (WebKitWebView *webkit_web_view,
web_view = E_WEB_VIEW (webkit_web_view);
+ printf ("%s\n", __FUNCTION__);
g_free (web_view->priv->cursor_image_src);
web_view->priv->cursor_image_src = NULL;
@@ -1682,7 +1683,6 @@ web_view_file_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
EWebView *web_view;
GTask *task;
- printf ("%s\n", __FUNCTION__);
web_view = E_WEB_VIEW (webkit_uri_scheme_request_get_web_view (request));
task = g_task_new (
@@ -1711,7 +1711,6 @@ web_view_gtk_stock_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
gsize buff_len = 0;
GError *local_error = NULL;
- printf ("%s\n", __FUNCTION__);
uri = soup_uri_new (webkit_uri_scheme_request_get_uri (request));
if (uri && uri->query)
@@ -2268,8 +2267,6 @@ e_web_view_load_uri (EWebView *web_view,
class = E_WEB_VIEW_GET_CLASS (web_view);
g_return_if_fail (class->load_uri != NULL);
- printf ("%s\n", __FUNCTION__);
- printf ("%s\n", uri);
class->load_uri (web_view, uri);
}
@@ -2359,15 +2356,14 @@ get_document_content_html_cb (GDBusProxy *web_extension,
GTask *task)
{
GVariant *result_variant;
- const gchar *html_content;
+ gchar *html_content = NULL;
result_variant = g_dbus_proxy_call_finish (web_extension, result, NULL);
- if (result_variant) {
- html_content = g_variant_get_string (result_variant, NULL);
- g_variant_unref (result_variant);
- }
+ if (result_variant)
+ g_variant_get (result_variant, "(s)", &html_content);
+ g_variant_unref (result_variant);
- g_task_return_pointer (task, g_strdup (html_content), g_free);
+ g_task_return_pointer (task, html_content, g_free);
g_object_unref (task);
}
@@ -2388,7 +2384,7 @@ e_web_view_get_content_html (EWebView *web_view,
if (web_extension) {
g_dbus_proxy_call (
web_extension,
- "GetDocumentContentHtml",
+ "GetDocumentContentHTML",
g_variant_new (
"(t)",
webkit_web_view_get_page_id (
@@ -2402,7 +2398,7 @@ e_web_view_get_content_html (EWebView *web_view,
g_task_return_pointer (task, NULL, NULL);
}
-const gchar *
+gchar *
e_web_view_get_content_html_finish (EWebView *web_view,
GAsyncResult *result,
GError **error)
@@ -2413,7 +2409,7 @@ e_web_view_get_content_html_finish (EWebView *web_view,
return g_task_propagate_pointer (G_TASK (result), error);
}
-const gchar *
+gchar *
e_web_view_get_content_html_sync (EWebView *web_view,
GCancellable *cancellable,
GError **error)
@@ -2425,7 +2421,6 @@ e_web_view_get_content_html_sync (EWebView *web_view,
web_extension = e_web_view_get_web_extension_proxy (web_view);
if (web_extension) {
GVariant *result;
- const gchar *html_content = NULL;
result = g_dbus_proxy_call_sync (
web_extension,
@@ -2440,8 +2435,11 @@ e_web_view_get_content_html_sync (EWebView *web_view,
error);
if (result) {
- html_content = g_variant_get_string (result, NULL);
+ gchar *html_content = NULL;
+
+ g_variant_get (result, "(s)", &html_content);
g_variant_unref (result);
+
return html_content;
}
}
@@ -2531,9 +2529,7 @@ e_web_view_get_editable (EWebView *web_view)
{
g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
- /* FIXME XXX WK2 */
-// return webkit_web_view_get_editable (WEBKIT_WEB_VIEW (web_view));
- return TRUE;
+ return webkit_web_view_is_editable (WEBKIT_WEB_VIEW (web_view));
}
void
@@ -2542,8 +2538,7 @@ e_web_view_set_editable (EWebView *web_view,
{
g_return_if_fail (E_IS_WEB_VIEW (web_view));
- /* FIXME XXX WK2
- webkit_web_view_set_editable (WEBKIT_WEB_VIEW (web_view), editable);*/
+ webkit_web_view_set_editable (WEBKIT_WEB_VIEW (web_view), editable);
}
const gchar *
@@ -2779,10 +2774,35 @@ e_web_view_cut_clipboard (EWebView *web_view)
gboolean
e_web_view_is_selection_active (EWebView *web_view)
{
- g_return_val_if_fail (E_IS_WEB_VIEW (web_view), FALSE);
+ GDBusProxy *web_extension;
+
+ g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
+
+ web_extension = e_web_view_get_web_extension_proxy (web_view);
+ if (web_extension) {
+ GVariant *result;
+
+ result = g_dbus_proxy_call_sync (
+ web_extension,
+ "DocumentHasSelection",
+ g_variant_new (
+ "(t)",
+ webkit_web_view_get_page_id (
+ WEBKIT_WEB_VIEW (web_view))),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL);
+
+ if (result) {
+ gboolean value = FALSE;
+
+ g_variant_get (result, "(b)", &value);
+ g_variant_unref (result);
+ return value;
+ }
+ }
- /* FIXME XXX WK2
- return webkit_web_view_has_selection (WEBKIT_WEB_VIEW (web_view));*/
return FALSE;
}
@@ -2980,15 +3000,14 @@ get_selection_content_html_cb (GDBusProxy *web_extension,
GTask *task)
{
GVariant *result_variant;
- const gchar *html_content;
+ gchar *html_content = NULL;
result_variant = g_dbus_proxy_call_finish (web_extension, result, NULL);
- if (result_variant) {
- html_content = g_variant_get_string (result_variant, NULL);
- g_variant_unref (result_variant);
- }
+ if (result_variant)
+ g_variant_get (result_variant, "(s)", &html_content);
+ g_variant_unref (result_variant);
- g_task_return_pointer (task, g_strdup (html_content), g_free);
+ g_task_return_pointer (task, html_content, g_free);
g_object_unref (task);
}
@@ -3023,7 +3042,7 @@ e_web_view_get_selection_content_html (EWebView *web_view,
g_task_return_pointer (task, NULL, NULL);
}
-const gchar *
+gchar *
e_web_view_get_selection_content_html_finish (EWebView *web_view,
GAsyncResult *result,
GError **error)
@@ -3034,7 +3053,7 @@ e_web_view_get_selection_content_html_finish (EWebView *web_view,
return g_task_propagate_pointer (G_TASK (result), error);
}
-const gchar *
+gchar *
e_web_view_get_selection_content_html_sync (EWebView *web_view,
GCancellable *cancellable,
GError **error)
@@ -3046,11 +3065,10 @@ e_web_view_get_selection_content_html_sync (EWebView *web_view,
web_extension = e_web_view_get_web_extension_proxy (web_view);
if (web_extension) {
GVariant *result;
- const gchar *html_content = NULL;
result = g_dbus_proxy_call_sync (
web_extension,
- "GetSelectionContentHtml",
+ "GetSelectionContentHTML",
g_variant_new (
"(t)",
webkit_web_view_get_page_id (
@@ -3061,7 +3079,9 @@ e_web_view_get_selection_content_html_sync (EWebView *web_view,
error);
if (result) {
- html_content = g_variant_get_string (result, NULL);
+ gchar *html_content = NULL;
+
+ g_variant_get (result, "(s)", &html_content);
g_variant_unref (result);
return html_content;
}
diff --git a/e-util/e-web-view.h b/e-util/e-web-view.h
index 424570d..38d5e6c 100644
--- a/e-util/e-web-view.h
+++ b/e-util/e-web-view.h
@@ -133,11 +133,11 @@ void e_web_view_get_content_html (EWebView *web_view,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-const gchar * e_web_view_get_content_html_finish
+gchar * e_web_view_get_content_html_finish
(EWebView *web_view,
GAsyncResult *result,
GError **error);
-const gchar * e_web_view_get_content_html_sync
+gchar * e_web_view_get_content_html_sync
(EWebView *web_view,
GCancellable *cancellable,
GError **error);
@@ -216,11 +216,11 @@ void e_web_view_get_selection_content_html
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
-const gchar * e_web_view_get_selection_content_html_finish
+gchar * e_web_view_get_selection_content_html_finish
(EWebView *web_view,
GAsyncResult *result,
GError **error);
-const gchar * e_web_view_get_selection_content_html_sync
+gchar * e_web_view_get_selection_content_html_sync
(EWebView *web_view,
GCancellable *cancellable,
GError **error);
diff --git a/e-util/test-html-editor.c b/e-util/test-html-editor.c
index e393f87..65e5426 100644
--- a/e-util/test-html-editor.c
+++ b/e-util/test-html-editor.c
@@ -264,7 +264,7 @@ action_toggle_editor (GtkAction *action,
view = e_html_editor_get_view (editor);
webkit_web_view_set_editable (
WEBKIT_WEB_VIEW (view),
- ! webkit_web_view_get_editable (WEBKIT_WEB_VIEW (view)));
+ ! webkit_web_view_is_editable (WEBKIT_WEB_VIEW (view)));
}
static void
diff --git a/mail/e-mail-display.c b/mail/e-mail-display.c
index 9d8bed4..833bfa4 100644
--- a/mail/e-mail-display.c
+++ b/mail/e-mail-display.c
@@ -1506,7 +1506,6 @@ mail_display_cid_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
CamelDataWrapper *dw;
CamelMimePart *mime_part;
- printf ("%s\n", __FUNCTION__);
display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
@@ -1936,7 +1935,6 @@ mail_display_http_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
GTask *task;
GCancellable *cancellable;
- printf ("%s\n", __FUNCTION__);
display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
@@ -2222,7 +2220,6 @@ mail_display_mail_uri_scheme_appeared_cb (WebKitURISchemeRequest *request)
GCancellable *cancellable;
const gchar *uri;
- printf ("%s\n", __FUNCTION__);
display = E_MAIL_DISPLAY (webkit_uri_scheme_request_get_web_view (request));
g_return_if_fail (E_IS_MAIL_DISPLAY (display));
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 72890dd..d7c06bc 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -2072,7 +2072,7 @@ e_mail_reader_reply_to_message (EMailReader *reader,
EWebView *web_view;
struct _camel_header_raw *header;
const gchar *uid;
- const gchar *selection;
+ gchar *selection = NULL;
gint length;
gchar *mail_uri;
CamelObjectBag *registry;
@@ -2282,6 +2282,7 @@ whole_message:
}
exit:
+ g_free (selection);
g_clear_object (&address);
g_clear_object (&folder);
}
diff --git a/modules/itip-formatter/web-extension/module-itip-formatter-dom-utils.c
b/modules/itip-formatter/web-extension/module-itip-formatter-dom-utils.c
index ff48352..7c11aaf 100644
--- a/modules/itip-formatter/web-extension/module-itip-formatter-dom-utils.c
+++ b/modules/itip-formatter/web-extension/module-itip-formatter-dom-utils.c
@@ -432,10 +432,7 @@ module_itip_formatter_dom_utils_set_area_text (WebKitDOMDocument *document,
WEBKIT_DOM_HTML_ELEMENT (row), (g_strcmp0 (text, "") == 0));
col = webkit_dom_element_get_last_element_child (row);
- webkit_dom_html_element_set_inner_html (
- WEBKIT_DOM_HTML_ELEMENT (col),
- text,
- NULL);
+ webkit_dom_element_set_inner_html (col, text, NULL);
}
void
@@ -574,12 +571,10 @@ module_itip_formatter_dom_utils_update_times (WebKitDOMDocument *document,
WEBKIT_DOM_HTML_ELEMENT (element), FALSE);
col = webkit_dom_element_get_first_element_child (element);
- webkit_dom_html_element_set_inner_html (
- WEBKIT_DOM_HTML_ELEMENT (col), header, NULL);
+ webkit_dom_element_set_inner_html (col, header, NULL);
col = webkit_dom_element_get_last_element_child (element);
- webkit_dom_html_element_set_inner_html (
- WEBKIT_DOM_HTML_ELEMENT (col), label, NULL);
+ webkit_dom_element_set_inner_html (col, label, NULL);
}
void
@@ -601,11 +596,7 @@ module_itip_formatter_dom_utils_append_info_item_row (WebKitDOMDocument *documen
row = webkit_dom_html_table_element_insert_row (
WEBKIT_DOM_HTML_TABLE_ELEMENT (table), -1, NULL);
-#if WEBKIT_CHECK_VERSION(2,2,0) /* XXX should really be (2,1,something) */
webkit_dom_element_set_id (WEBKIT_DOM_ELEMENT (row), row_id);
-#else
- webkit_dom_html_element_set_id (row, row_id);
-#endif
cell = webkit_dom_html_table_row_element_insert_cell (
WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), -1, NULL);
@@ -631,7 +622,7 @@ module_itip_formatter_dom_utils_append_info_item_row (WebKitDOMDocument *documen
cell = webkit_dom_html_table_row_element_insert_cell (
WEBKIT_DOM_HTML_TABLE_ROW_ELEMENT (row), -1, NULL);
- webkit_dom_html_element_set_inner_html (cell, message, NULL);
+ webkit_dom_element_set_inner_html (WEBKIT_DOM_ELEMENT (cell), message, NULL);
}
void
@@ -705,8 +696,7 @@ module_itip_formatter_dom_utils_rebuild_source_list (WebKitDOMDocument *document
WEBKIT_DOM_HTML_OPTION_ELEMENT (option), option_id);
webkit_dom_html_option_element_set_label (
WEBKIT_DOM_HTML_OPTION_ELEMENT (option), option_label);
- webkit_dom_html_element_set_inner_html (
- WEBKIT_DOM_HTML_ELEMENT (option), option_label, NULL);
+ webkit_dom_element_set_inner_html (option, option_label, NULL);
webkit_dom_element_set_class_name (
WEBKIT_DOM_ELEMENT (option), "calendar");
diff --git a/modules/itip-formatter/web-extension/module-itip-formatter-web-extension.c
b/modules/itip-formatter/web-extension/module-itip-formatter-web-extension.c
index c246f43..e2dae0e 100644
--- a/modules/itip-formatter/web-extension/module-itip-formatter-web-extension.c
+++ b/modules/itip-formatter/web-extension/module-itip-formatter-web-extension.c
@@ -31,7 +31,7 @@ static GDBusConnection *dbus_connection;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.Module.ItipFormatter.WebExtension'>"
+" <interface name='"MODULE_ITIP_FORMATTER_WEB_EXTENSION_INTERFACE"'>"
" <signal name='RecurToggled'>"
" </signal>"
" <signal name='SourceChanged'>"
@@ -451,7 +451,11 @@ handle_method_call (GDBusConnection *connection,
document_saved, select_id);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (value));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "SelectSetSelected") == 0) {
const gchar *select_id, *option;
@@ -535,7 +539,11 @@ handle_method_call (GDBusConnection *connection,
document_saved, area_id);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (value));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "RebuildSourceList") == 0) {
const gchar *optgroup_id, *optgroup_label, *option_id, *option_label;
gboolean writable;
diff --git a/modules/mail/web-extension/module-mail-web-extension.c
b/modules/mail/web-extension/module-mail-web-extension.c
index a3d04e3..6d45434 100644
--- a/modules/mail/web-extension/module-mail-web-extension.c
+++ b/modules/mail/web-extension/module-mail-web-extension.c
@@ -29,7 +29,7 @@ static GDBusConnection *dbus_connection;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.Module.Mail.WebExtension'>"
+" <interface name='"MODULE_MAIL_WEB_EXTENSION_INTERFACE"'>"
" <method name='GetActiveElementName'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='element_name' direction='out'/>"
@@ -81,7 +81,11 @@ handle_method_call (GDBusConnection *connection,
element_name = e_dom_utils_get_active_element_name (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (element_name));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ element_name ? element_name : g_strdup (""))));
}
}
diff --git a/modules/mail/web-extension/module-mail-web-extension.h
b/modules/mail/web-extension/module-mail-web-extension.h
index f1fe0a8..09067c1 100644
--- a/modules/mail/web-extension/module-mail-web-extension.h
+++ b/modules/mail/web-extension/module-mail-web-extension.h
@@ -19,8 +19,8 @@
#ifndef MODULE_MAIL_WEB_EXTENSION_H
#define MODULE_MAIL_WEB_EXTENSION_H
-#define MODULE_MAIL_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.Module.Mail.WebExtension"
-#define MODULE_MAIL_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/Module/Mail/WebExtension"
-#define MODULE_MAIL_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.Module.Mail.WebExtension"
+#define MODULE_MAIL_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.WebExtension.Module.Mail"
+#define MODULE_MAIL_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/WebExtension/Module/Mail"
+#define MODULE_MAIL_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.WebExtension.Module.Mail"
#endif /* MODULE_MAIL_WEB_EXTENSION_H */
diff --git a/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.c
b/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.c
index a6e5b7d..e329c19 100644
--- a/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.c
+++ b/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.c
@@ -32,7 +32,7 @@ static GDBusConnection *dbus_connection;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.Module.PreferPlain.WebExtension'>"
+" <interface name='"MODULE_PREFER_PLAIN_WEB_EXTENSION_INTERFACE"'>"
" <method name='ChangeIFrameSource'>"
" <arg type='s' name='new_uri' direction='in'/>"
" </method>"
@@ -116,7 +116,8 @@ handle_method_call (GDBusConnection *connection,
document_uri = g_strdup ("");
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (document_uri));
+ invocation,
+ g_variant_new ("(@s)", g_variant_new_take_string (document_uri)));
}
}
diff --git a/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.h
b/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.h
index a50a992..7733e1d 100644
--- a/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.h
+++ b/modules/prefer-plain/web-extension/module-prefer-plain-web-extension.h
@@ -19,8 +19,8 @@
#ifndef MODULE_PREFER_PLAIN_WEB_EXTENSION_H
#define MODULE_PREFER_PLAIN_WEB_EXTENSION_H
-#define MODULE_PREFER_PLAIN_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.Module.PreferPlain.WebExtension"
-#define MODULE_PREFER_PLAIN_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/Module/PreferPlain/WebExtension"
-#define MODULE_PREFER_PLAIN_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.Module.PreferPlain.WebExtension"
+#define MODULE_PREFER_PLAIN_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.WebExtension.Module.PreferPlain"
+#define MODULE_PREFER_PLAIN_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/WebExtension/Module/PreferPlain"
+#define MODULE_PREFER_PLAIN_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.WebExtension.Module.PreferPlain"
#endif /* MODULE_PREFER_PLAIN_WEB_EXTENSION_H */
diff --git a/modules/text-highlight/web-extension/module-text-highlight-web-extension.c
b/modules/text-highlight/web-extension/module-text-highlight-web-extension.c
index 901119c..3dd680a 100644
--- a/modules/text-highlight/web-extension/module-text-highlight-web-extension.c
+++ b/modules/text-highlight/web-extension/module-text-highlight-web-extension.c
@@ -32,7 +32,7 @@ static GDBusConnection *dbus_connection;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.Module.TextHighlight.WebExtension'>"
+" <interface name='"MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_INTERFACE"'>"
" <method name='ChangeIFrameSource'>"
" <arg type='s' name='new_uri' direction='in'/>"
" </method>"
@@ -116,7 +116,8 @@ handle_method_call (GDBusConnection *connection,
document_uri = g_strdup ("");
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (document_uri));
+ invocation,
+ g_variant_new ("(@s)", g_variant_new_take_string (document_uri)));
}
}
diff --git a/modules/text-highlight/web-extension/module-text-highlight-web-extension.h
b/modules/text-highlight/web-extension/module-text-highlight-web-extension.h
index 7308f65..1401889 100644
--- a/modules/text-highlight/web-extension/module-text-highlight-web-extension.h
+++ b/modules/text-highlight/web-extension/module-text-highlight-web-extension.h
@@ -19,8 +19,8 @@
#ifndef MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_H
#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_H
-#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_SERVICE_NAME
"org.gnome.Evolution.Module.TextHighlight.WebExtension"
-#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_OBJECT_PATH
"/org/gnome/Evolution/Module/TextHighlight/WebExtension"
-#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_INTERFACE
"org.gnome.Evolution.Module.TextHighlight.WebExtension"
+#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_SERVICE_NAME
"org.gnome.Evolution.WebExtension.Module.TextHighlight"
+#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_OBJECT_PATH
"/org/gnome/Evolution/WebExtension/Module/TextHighlight"
+#define MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_INTERFACE
"org.gnome.Evolution.WebExtension.Module.TextHighlight"
#endif /* MODULE_TEXT_HIGHLIGHT_WEB_EXTENSION_H */
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c
index b09a746..c269221 100644
--- a/plugins/external-editor/external-editor.c
+++ b/plugins/external-editor/external-editor.c
@@ -158,8 +158,8 @@ enable_disable_composer (EMsgComposer *composer,
editor = e_msg_composer_get_editor (composer);
view = e_html_editor_get_view (editor);
-/* FIXME WK2
- webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), enable);*/
+
+ webkit_web_view_set_editable (WEBKIT_WEB_VIEW (view), enable);
action = E_HTML_EDITOR_ACTION_EDIT_MENU (editor);
gtk_action_set_sensitive (action, enable);
@@ -310,7 +310,8 @@ external_editor_thread (gpointer user_data)
/* Push the text (if there is one) from the composer to the file */
content = e_html_editor_view_get_text_plain (view);
- g_file_set_contents (filename, content, strlen (content), NULL);
+ if (content && *content)
+ g_file_set_contents (filename, content, strlen (content), NULL);
} else {
struct run_error_dialog_data *data;
diff --git a/web-extensions/Makefile.am b/web-extensions/Makefile.am
index ad2b7ae..8950e19 100644
--- a/web-extensions/Makefile.am
+++ b/web-extensions/Makefile.am
@@ -1,4 +1,6 @@
-webextensions_LTLIBRARIES = libewebextension.la libehtmleditorwebextension.la libedomutils.la
+SUBDIRS = . composer
+
+webextensions_LTLIBRARIES = libewebextension.la libedomutils.la
libedomutils_la_SOURCES = \
e-dom-utils.h \
@@ -36,63 +38,9 @@ libewebextension_la_CPPFLAGS = \
libewebextension_la_LIBADD = \
$(top_builddir)/e-util/libevolution-util.la \
- $(top_builddir)/e-util/libevolution-util.la \
$(EVOLUTION_DATA_SERVER_LIBS) \
$(GNOME_PLATFORM_LIBS) \
$(WEB_EXTENSIONS_LIBS)
libewebextension_la_LDFLAGS = \
-module -avoid-version -no-undefined
-
-libehtmleditorwebextension_la_SOURCES = \
- e-composer-private-dom-functions.h \
- e-dom-utils.h \
- e-html-editor-actions-dom-functions.h \
- e-html-editor-cell-dialog-dom-functions.h \
- e-html-editor-history-event.h \
- e-html-editor-hrule-dialog-dom-functions.h \
- e-html-editor-image-dialog-dom-functions.h \
- e-html-editor-link-dialog-dom-functions.h \
- e-html-editor-page-dialog-dom-functions.h \
- e-html-editor-selection-dom-functions.h \
- e-html-editor-spell-check-dialog-dom-functions.h\
- e-html-editor-table-dialog-dom-functions.h \
- e-html-editor-undo-redo-manager.h \
- e-html-editor-view-dom-functions.h \
- e-msg-composer-dom-functions.h \
- e-composer-private-dom-functions.c \
- e-dom-utils.c \
- e-html-editor-actions-dom-functions.c \
- e-html-editor-cell-dialog-dom-functions.c \
- e-html-editor-hrule-dialog-dom-functions.c \
- e-html-editor-image-dialog-dom-functions.c \
- e-html-editor-link-dialog-dom-functions.c \
- e-html-editor-page-dialog-dom-functions.c \
- e-html-editor-selection-dom-functions.c \
- e-html-editor-spell-check-dialog-dom-functions.c\
- e-html-editor-table-dialog-dom-functions.c \
- e-html-editor-undo-redo-manager.c \
- e-html-editor-view-dom-functions.c \
- e-msg-composer-dom-functions.c \
- e-html-editor-web-extension.c \
- e-html-editor-web-extension.h \
- e-html-editor-web-extension-names.h \
- e-html-editor-web-extension-main.c
-
-libehtmleditorwebextension_la_CPPFLAGS = \
- $(AM_CPPFLAGS) \
- -I$(top_srcdir) \
- -DLIBEUTIL_COMPILATION \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
- $(EVOLUTION_DATA_SERVER_CFLAGS) \
- $(GNOME_PLATFORM_CFLAGS) \
- $(WEB_EXTENSIONS_CFLAGS)
-
-libehtmleditorwebextension_la_LIBADD = \
- $(top_builddir)/e-util/libevolution-util.la \
- $(EVOLUTION_DATA_SERVER_LIBS) \
- $(GNOME_PLATFORM_LIBS) \
- $(WEB_EXTENSIONS_LIBS)
-
-libehtmleditorwebextension_la_LDFLAGS = \
- -module -avoid-version -no-undefined
diff --git a/web-extensions/composer/Makefile.am b/web-extensions/composer/Makefile.am
new file mode 100644
index 0000000..5a15345
--- /dev/null
+++ b/web-extensions/composer/Makefile.am
@@ -0,0 +1,53 @@
+webextensionscomposer_LTLIBRARIES = libehtmleditorwebextension.la
+
+libehtmleditorwebextension_la_SOURCES = \
+ e-composer-private-dom-functions.h \
+ e-html-editor-actions-dom-functions.h \
+ e-html-editor-cell-dialog-dom-functions.h \
+ e-html-editor-history-event.h \
+ e-html-editor-hrule-dialog-dom-functions.h \
+ e-html-editor-image-dialog-dom-functions.h \
+ e-html-editor-link-dialog-dom-functions.h \
+ e-html-editor-page-dialog-dom-functions.h \
+ e-html-editor-selection-dom-functions.h \
+ e-html-editor-spell-check-dialog-dom-functions.h\
+ e-html-editor-table-dialog-dom-functions.h \
+ e-html-editor-undo-redo-manager.h \
+ e-html-editor-view-dom-functions.h \
+ e-msg-composer-dom-functions.h \
+ e-composer-private-dom-functions.c \
+ e-html-editor-actions-dom-functions.c \
+ e-html-editor-cell-dialog-dom-functions.c \
+ e-html-editor-hrule-dialog-dom-functions.c \
+ e-html-editor-image-dialog-dom-functions.c \
+ e-html-editor-link-dialog-dom-functions.c \
+ e-html-editor-page-dialog-dom-functions.c \
+ e-html-editor-selection-dom-functions.c \
+ e-html-editor-spell-check-dialog-dom-functions.c\
+ e-html-editor-table-dialog-dom-functions.c \
+ e-html-editor-undo-redo-manager.c \
+ e-html-editor-view-dom-functions.c \
+ e-msg-composer-dom-functions.c \
+ e-html-editor-web-extension.c \
+ e-html-editor-web-extension.h \
+ e-html-editor-web-extension-names.h \
+ e-html-editor-web-extension-main.c
+
+libehtmleditorwebextension_la_CPPFLAGS = \
+ $(AM_CPPFLAGS) \
+ -I$(top_srcdir) \
+ -DLIBEUTIL_COMPILATION \
+ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
+ $(EVOLUTION_DATA_SERVER_CFLAGS) \
+ $(GNOME_PLATFORM_CFLAGS) \
+ $(WEB_EXTENSIONS_CFLAGS)
+
+libehtmleditorwebextension_la_LIBADD = \
+ $(top_builddir)/e-util/libevolution-util.la \
+ $(top_builddir)/web-extensions/libedomutils.la \
+ $(EVOLUTION_DATA_SERVER_LIBS) \
+ $(GNOME_PLATFORM_LIBS) \
+ $(WEB_EXTENSIONS_LIBS)
+
+libehtmleditorwebextension_la_LDFLAGS = \
+ -module -avoid-version -no-undefined
diff --git a/web-extensions/e-composer-private-dom-functions.c
b/web-extensions/composer/e-composer-private-dom-functions.c
similarity index 99%
rename from web-extensions/e-composer-private-dom-functions.c
rename to web-extensions/composer/e-composer-private-dom-functions.c
index 1e3ae5f..66f5605 100644
--- a/web-extensions/e-composer-private-dom-functions.c
+++ b/web-extensions/composer/e-composer-private-dom-functions.c
@@ -24,6 +24,7 @@
#include <string.h>
+#include <web-extensions/e-dom-utils.h>
#include <e-util/e-misc-utils.h>
#define WEBKIT_DOM_USE_UNSTABLE_API
diff --git a/web-extensions/e-composer-private-dom-functions.h
b/web-extensions/composer/e-composer-private-dom-functions.h
similarity index 100%
rename from web-extensions/e-composer-private-dom-functions.h
rename to web-extensions/composer/e-composer-private-dom-functions.h
diff --git a/web-extensions/e-html-editor-actions-dom-functions.c
b/web-extensions/composer/e-html-editor-actions-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-actions-dom-functions.c
rename to web-extensions/composer/e-html-editor-actions-dom-functions.c
index 8ecbe4f..ea1a133 100644
--- a/web-extensions/e-html-editor-actions-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-actions-dom-functions.c
@@ -18,10 +18,11 @@
#include "e-html-editor-actions-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-history-event.h"
#include "e-html-editor-selection-dom-functions.h"
+#include <web-extensions/e-dom-utils.h>
+
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDocumentFragmentUnstable.h>
#include <webkitdom/WebKitDOMRangeUnstable.h>
diff --git a/web-extensions/e-html-editor-actions-dom-functions.h
b/web-extensions/composer/e-html-editor-actions-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-actions-dom-functions.h
rename to web-extensions/composer/e-html-editor-actions-dom-functions.h
diff --git a/web-extensions/e-html-editor-cell-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-cell-dialog-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-cell-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-cell-dialog-dom-functions.c
index 1fe2f2c..8c21376 100644
--- a/web-extensions/e-html-editor-cell-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-cell-dialog-dom-functions.c
@@ -18,10 +18,11 @@
#include "e-html-editor-cell-dialog-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-undo-redo-manager.h"
#include "e-html-editor-selection-dom-functions.h"
+#include <web-extensions/e-dom-utils.h>
+
enum {
SCOPE_CELL,
SCOPE_ROW,
diff --git a/web-extensions/e-html-editor-cell-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-cell-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-cell-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-cell-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-history-event.h
b/web-extensions/composer/e-html-editor-history-event.h
similarity index 100%
rename from web-extensions/e-html-editor-history-event.h
rename to web-extensions/composer/e-html-editor-history-event.h
diff --git a/web-extensions/e-html-editor-hrule-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-hrule-dialog-dom-functions.c
similarity index 98%
rename from web-extensions/e-html-editor-hrule-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-hrule-dialog-dom-functions.c
index 66f269c..10a940e 100644
--- a/web-extensions/e-html-editor-hrule-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-hrule-dialog-dom-functions.c
@@ -18,11 +18,12 @@
#include "e-html-editor-hrule-dialog-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-selection-dom-functions.h"
#include "e-html-editor-web-extension.h"
#include "e-html-editor-undo-redo-manager.h"
+#include <web-extensions/e-dom-utils.h>
+
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
diff --git a/web-extensions/e-html-editor-hrule-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-hrule-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-hrule-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-hrule-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-image-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-image-dialog-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-image-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-image-dialog-dom-functions.c
index a892476..bef410e 100644
--- a/web-extensions/e-html-editor-image-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-image-dialog-dom-functions.c
@@ -18,11 +18,12 @@
#include "e-html-editor-image-dialog-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-selection-dom-functions.h"
#include "e-html-editor-web-extension.h"
#include "e-html-editor-undo-redo-manager.h"
+#include <web-extensions/e-dom-utils.h>
+
static WebKitDOMElement *
get_current_image_element (WebKitDOMDocument *document)
{
diff --git a/web-extensions/e-html-editor-image-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-image-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-image-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-image-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-link-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-link-dialog-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-link-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-link-dialog-dom-functions.c
index 213642d..24cd334 100644
--- a/web-extensions/e-html-editor-link-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-link-dialog-dom-functions.c
@@ -18,12 +18,12 @@
#include "e-html-editor-link-dialog-dom-functions.h"
-#include <e-util/e-util-enums.h>
-
-#include "e-dom-utils.h"
#include "e-html-editor-view-dom-functions.h"
#include "e-html-editor-selection-dom-functions.h"
+#include <e-util/e-util-enums.h>
+#include <web-extensions/e-dom-utils.h>
+
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
diff --git a/web-extensions/e-html-editor-link-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-link-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-link-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-link-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-page-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-page-dialog-dom-functions.c
similarity index 98%
rename from web-extensions/e-html-editor-page-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-page-dialog-dom-functions.c
index b34e85a..b18e0bd 100644
--- a/web-extensions/e-html-editor-page-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-page-dialog-dom-functions.c
@@ -18,10 +18,11 @@
#include "e-html-editor-page-dialog-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-selection-dom-functions.h"
#include "e-html-editor-web-extension.h"
+#include <web-extensions/e-dom-utils.h>
+
void
e_html_editor_page_dialog_save_history (WebKitDOMDocument *document,
EHTMLEditorWebExtension *extension)
diff --git a/web-extensions/e-html-editor-page-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-page-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-page-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-page-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-selection-dom-functions.c
b/web-extensions/composer/e-html-editor-selection-dom-functions.c
similarity index 98%
rename from web-extensions/e-html-editor-selection-dom-functions.c
rename to web-extensions/composer/e-html-editor-selection-dom-functions.c
index c40bc89..ce7aaaa 100644
--- a/web-extensions/e-html-editor-selection-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.c
@@ -18,10 +18,11 @@
#include "e-html-editor-selection-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-view-dom-functions.h"
#include "e-html-editor-web-extension.h"
+#include <web-extensions/e-dom-utils.h>
+
#include <string.h>
#include <stdlib.h>
@@ -1039,8 +1040,7 @@ dom_selection_indent (WebKitDOMDocument *document,
dom_selection_restore (document);
dom_force_spell_check_for_current_paragraph (document, extension);
- /* FIXME WK2
- g_object_notify (G_OBJECT (selection), "indented"); */
+ set_dbus_property_boolean (extension, "Indented", TRUE);
}
static void
@@ -3086,12 +3086,15 @@ dom_selection_is_subscript (WebKitDOMDocument *document,
WebKitDOMNode *node;
WebKitDOMRange *range;
- range = dom_get_current_range (document);
+ if (!(range = dom_get_current_range (document)))
+ return FALSE;
+
node = webkit_dom_range_get_common_ancestor_container (range, NULL);
g_object_unref (range);
- while (node) {
- if (element_has_tag (WEBKIT_DOM_ELEMENT (node), "sub"))
+ while (node && !WEBKIT_DOM_IS_HTML_BODY_ELEMENT (node)) {
+ if (WEBKIT_DOM_IS_ELEMENT (node) &&
+ element_has_tag (WEBKIT_DOM_ELEMENT (node), "sub"))
break;
node = webkit_dom_node_get_parent_node (node);
@@ -3118,9 +3121,7 @@ dom_selection_set_subscript (WebKitDOMDocument *document,
dom_exec_command (document, extension, E_HTML_EDITOR_VIEW_COMMAND_SUBSCRIPT, NULL);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "subscript");
-*/
+ set_dbus_property_boolean (extension, "Subscript", subscript);
}
/**
@@ -3139,12 +3140,15 @@ dom_selection_is_superscript (WebKitDOMDocument *document,
WebKitDOMNode *node;
WebKitDOMRange *range;
- range = dom_get_current_range (document);
+ if (!(range = dom_get_current_range (document)))
+ return FALSE;
+
node = webkit_dom_range_get_common_ancestor_container (range, NULL);
g_object_unref (range);
- while (node) {
- if (element_has_tag (WEBKIT_DOM_ELEMENT (node), "sup"))
+ while (node && !WEBKIT_DOM_IS_HTML_BODY_ELEMENT (node)) {
+ if (WEBKIT_DOM_IS_ELEMENT (node) &&
+ element_has_tag (WEBKIT_DOM_ELEMENT (node), "sup"))
break;
node = webkit_dom_node_get_parent_node (node);
@@ -3171,9 +3175,7 @@ dom_selection_set_superscript (WebKitDOMDocument *document,
dom_exec_command (document, extension, E_HTML_EDITOR_VIEW_COMMAND_SUPERSCRIPT, NULL);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "superscript");
-*/
+ set_dbus_property_boolean (extension, "Superscript", superscript);
}
/**
@@ -3248,14 +3250,11 @@ dom_selection_set_strikethrough (WebKitDOMDocument *document,
{
if (dom_selection_is_strikethrough (document, extension) == strikethrough)
return;
-/* FIXME WK2
- selection->priv->is_strikethrough = strikethrough;
-*/
+
selection_set_font_style (
document, extension, E_HTML_EDITOR_VIEW_COMMAND_STRIKETHROUGH, strikethrough);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "strikethrough");
-*/
+
+ set_dbus_property_boolean (extension, "Strikethrough", strikethrough);
}
static gboolean
@@ -3312,8 +3311,7 @@ dom_selection_is_monospaced (WebKitDOMDocument *document,
text_content = webkit_dom_node_get_text_content (node);
if (g_strcmp0 (text_content, "") == 0) {
g_free (text_content);
- return FALSE;
-/* FIXME WK2 return selection->priv->is_monospaced; */
+ return e_html_editor_web_extension_get_monospaced (extension);
}
g_free (text_content);
@@ -3358,11 +3356,9 @@ dom_selection_set_monospaced (WebKitDOMDocument *document,
WebKitDOMDOMWindow *dom_window;
WebKitDOMDOMSelection *dom_selection;
- if (dom_selection_is_monospaced (document, extension) == monospaced)
+ if (e_html_editor_web_extension_get_monospaced (extension) == monospaced)
return;
-/* FIXME WK2
- selection->priv->is_monospaced = monospaced;
-*/
+
range = dom_get_current_range (document);
if (!range)
return;
@@ -3587,8 +3583,8 @@ dom_selection_set_monospaced (WebKitDOMDocument *document,
g_object_unref (range);
g_object_unref (dom_selection);
g_object_unref (dom_window);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "monospaced");*/
+
+ set_dbus_property_boolean (extension, "Monospaced", monospaced);
}
/**
@@ -3661,17 +3657,15 @@ dom_selection_set_bold (WebKitDOMDocument *document,
EHTMLEditorWebExtension *extension,
gboolean bold)
{
- if (dom_selection_is_bold (document, extension) == bold)
+ if (e_html_editor_web_extension_get_bold (extension) == bold)
return;
-/* FIXME WK2
- selection->priv->is_bold = bold; */
selection_set_font_style (
document, extension, E_HTML_EDITOR_VIEW_COMMAND_BOLD, bold);
dom_force_spell_check_for_current_paragraph (document, extension);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "bold");*/
+
+ set_dbus_property_boolean (extension, "Bold", bold);
}
/**
@@ -3746,13 +3740,11 @@ dom_selection_set_italic (WebKitDOMDocument *document,
{
if (dom_selection_is_italic (document, extension) == italic)
return;
-/* FIXME WK2
- selection->priv->is_italic = italic;*/
selection_set_font_style (
document, extension, E_HTML_EDITOR_VIEW_COMMAND_ITALIC, italic);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "italic");*/
+
+ set_dbus_property_boolean (extension, "Italic", italic);
}
/**
@@ -3949,8 +3941,6 @@ dom_selection_set_font_size (WebKitDOMDocument *document,
ev->data.style.to = font_size;
}
-/* FIXME WK2
- selection->priv->font_size = font_size; */
size_str = g_strdup_printf ("%d", font_size);
if (dom_selection_is_collapsed (document)) {
@@ -4000,8 +3990,8 @@ dom_selection_set_font_size (WebKitDOMDocument *document,
e_html_editor_undo_redo_manager_insert_history_event (manager, ev);
}
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "font-size"); */
+
+ set_dbus_property_unsigned (extension, "FontSize", font_size);
}
/**
@@ -4019,7 +4009,7 @@ dom_selection_set_font_name (WebKitDOMDocument *document,
{
dom_exec_command (document, extension, E_HTML_EDITOR_VIEW_COMMAND_FONT_NAME, font_name);
/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "font-name");*/
+ set_dbus_property_string (extension, "FontName", font_name); */
}
/**
@@ -4043,14 +4033,8 @@ dom_selection_get_font_name (WebKitDOMDocument *document,
range = dom_get_current_range (document);
node = webkit_dom_range_get_common_ancestor_container (range, NULL);
g_object_unref (range);
-/* FIXME WK2
- g_free (selection->priv->font_family);
-*/
+
css = webkit_dom_element_get_style (WEBKIT_DOM_ELEMENT (node));
-/* FIXME WK2
- selection->priv->font_family =
- webkit_dom_css_style_declaration_get_property_value (css, "fontFamily");
-*/
value = webkit_dom_css_style_declaration_get_property_value (css, "fontFamily");
g_object_unref (css);
@@ -4085,13 +4069,10 @@ dom_selection_set_font_color (WebKitDOMDocument *document,
&ev->before.end.x,
&ev->before.end.y);
-/* FIXME WK2
- ev->data.string.from = g_strdup (selection->priv->font_color);*/
+ ev->data.string.from = g_strdup (e_html_editor_web_extension_get_font_color (extension));
ev->data.string.to = g_strdup (color);
}
-/* FIXME WK2
- selection->priv->font_color = g_strdup (color); */
dom_exec_command (document, extension, E_HTML_EDITOR_VIEW_COMMAND_FORE_COLOR, color);
if (ev) {
@@ -4103,8 +4084,8 @@ dom_selection_set_font_color (WebKitDOMDocument *document,
&ev->after.end.y);
e_html_editor_undo_redo_manager_insert_history_event (manager, ev);
}
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "font-color"); */
+
+ set_dbus_property_string (extension, "FontColor", color);
}
/**
@@ -4975,8 +4956,8 @@ dom_selection_set_block_format (WebKitDOMDocument *document,
&ev->after.end.y);
e_html_editor_undo_redo_manager_insert_history_event (manager, ev);
}
-/*
- g_object_notify (G_OBJECT (selection), "block-format");*/
+
+ set_dbus_property_unsigned (extension, "BlockFormat", format);
}
/**
@@ -5029,7 +5010,7 @@ dom_selection_set_background_color (WebKitDOMDocument *document,
{
dom_exec_command (document, extension, E_HTML_EDITOR_VIEW_COMMAND_BACKGROUND_COLOR, color);
/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "background-color");*/
+ set_dbus_property_string (extension, "BackgroundColor", color); */
}
/**
@@ -5126,7 +5107,7 @@ dom_selection_set_alignment (WebKitDOMDocument *document,
WebKitDOMElement *selection_start_marker, *selection_end_marker;
WebKitDOMNode *block;
- current_alignment = dom_selection_get_alignment (document, extension);
+ current_alignment = e_html_editor_web_extension_get_alignment (extension);
if (current_alignment == alignment)
return;
@@ -5145,8 +5126,6 @@ dom_selection_set_alignment (WebKitDOMDocument *document,
list_class = "-x-evo-list-item-align-right";
break;
}
-/* FIXME WK2
- selection->priv->alignment = alignment;*/
dom_selection_save (document);
@@ -5248,8 +5227,7 @@ dom_selection_set_alignment (WebKitDOMDocument *document,
dom_force_spell_check_for_current_paragraph (document, extension);
-/* FIXME WK2
- g_object_notify (G_OBJECT (selection), "alignment");*/
+ set_dbus_property_unsigned (extension, "Alignment", alignment);
}
/**
diff --git a/web-extensions/e-html-editor-selection-dom-functions.h
b/web-extensions/composer/e-html-editor-selection-dom-functions.h
similarity index 99%
rename from web-extensions/e-html-editor-selection-dom-functions.h
rename to web-extensions/composer/e-html-editor-selection-dom-functions.h
index 8b42f43..3341f05 100644
--- a/web-extensions/e-html-editor-selection-dom-functions.h
+++ b/web-extensions/composer/e-html-editor-selection-dom-functions.h
@@ -23,8 +23,6 @@
#include "e-html-editor-web-extension.h"
-#include "e-dom-utils.h"
-
#define UNICODE_ZERO_WIDTH_SPACE "\xe2\x80\x8b"
#define UNICODE_NBSP "\xc2\xa0"
diff --git a/web-extensions/e-html-editor-spell-check-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-spell-check-dialog-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-spell-check-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-spell-check-dialog-dom-functions.c
index bf97ee4..1ef8422 100644
--- a/web-extensions/e-html-editor-spell-check-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-spell-check-dialog-dom-functions.c
@@ -18,7 +18,7 @@
#include "e-html-editor-spell-check-dialog-dom-functions.h"
-#include "e-dom-utils.h"
+#include <web-extensions/e-dom-utils.h>
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
diff --git a/web-extensions/e-html-editor-spell-check-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-spell-check-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-spell-check-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-spell-check-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-table-dialog-dom-functions.c
b/web-extensions/composer/e-html-editor-table-dialog-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-table-dialog-dom-functions.c
rename to web-extensions/composer/e-html-editor-table-dialog-dom-functions.c
index 60f2f04..dc3023f 100644
--- a/web-extensions/e-html-editor-table-dialog-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-table-dialog-dom-functions.c
@@ -18,9 +18,10 @@
#include "e-html-editor-table-dialog-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-selection-dom-functions.h"
+#include <web-extensions/e-dom-utils.h>
+
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDOMSelection.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
diff --git a/web-extensions/e-html-editor-table-dialog-dom-functions.h
b/web-extensions/composer/e-html-editor-table-dialog-dom-functions.h
similarity index 100%
rename from web-extensions/e-html-editor-table-dialog-dom-functions.h
rename to web-extensions/composer/e-html-editor-table-dialog-dom-functions.h
diff --git a/web-extensions/e-html-editor-undo-redo-manager.c
b/web-extensions/composer/e-html-editor-undo-redo-manager.c
similarity index 99%
rename from web-extensions/e-html-editor-undo-redo-manager.c
rename to web-extensions/composer/e-html-editor-undo-redo-manager.c
index 935a719..ae8626a 100644
--- a/web-extensions/e-html-editor-undo-redo-manager.c
+++ b/web-extensions/composer/e-html-editor-undo-redo-manager.c
@@ -22,7 +22,8 @@
#include "e-html-editor-web-extension.h"
#include "e-html-editor-selection-dom-functions.h"
#include "e-html-editor-view-dom-functions.h"
-#include "e-dom-utils.h"
+
+#include <web-extensions/e-dom-utils.h>
#define WEBKIT_DOM_USE_UNSTABLE_API
#include <webkitdom/WebKitDOMDocumentFragmentUnstable.h>
@@ -2061,5 +2062,7 @@ e_html_editor_undo_redo_manager_init (EHTMLEditorUndoRedoManager *manager)
manager->priv->operation_in_progress = FALSE;
manager->priv->history = NULL;
- e_html_editor_undo_redo_manager_clean_history (manager);
+ manager->priv->history_size = 0;
+ manager->priv->can_undo = FALSE;
+ manager->priv->can_redo = FALSE;
}
diff --git a/web-extensions/e-html-editor-undo-redo-manager.h
b/web-extensions/composer/e-html-editor-undo-redo-manager.h
similarity index 100%
rename from web-extensions/e-html-editor-undo-redo-manager.h
rename to web-extensions/composer/e-html-editor-undo-redo-manager.h
diff --git a/web-extensions/e-html-editor-view-dom-functions.c
b/web-extensions/composer/e-html-editor-view-dom-functions.c
similarity index 99%
rename from web-extensions/e-html-editor-view-dom-functions.c
rename to web-extensions/composer/e-html-editor-view-dom-functions.c
index f50dba2..9b536e6 100644
--- a/web-extensions/e-html-editor-view-dom-functions.c
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.c
@@ -19,9 +19,10 @@
#include "e-html-editor-view-dom-functions.h"
#include "e-html-editor-selection-dom-functions.h"
-#include "e-dom-utils.h"
+
#include <e-util/e-misc-utils.h>
#include <e-util/e-emoticon-chooser.h>
+#include <web-extensions/e-dom-utils.h>
#include <string.h>
@@ -94,7 +95,7 @@ dom_exec_command (WebKitDOMDocument *document,
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_NEW_LINE_IN_QUOTED_CONTENT,
"InsertNewlineInQuotedContent", FALSE)
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_ORDERED_LIST, "InsertOrderedList", FALSE)
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_PARAGRAPH, "InsertParagraph", FALSE)
- CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_TEXT, "InsertText", TRUE)
+ CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_TEXT, "InsertText", FALSE)
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_INSERT_UNORDERED_LIST, "InsertUnorderedList", FALSE)
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_ITALIC, "Italic", FALSE)
CHECK_COMMAND (E_HTML_EDITOR_VIEW_COMMAND_JUSTIFY_CENTER, "JustifyCenter", FALSE)
@@ -129,23 +130,6 @@ dom_exec_command (WebKitDOMDocument *document,
}
static void
-block_selection_changed_callbacks (EHTMLEditorWebExtension *extension)
-{
- /* FIXME WK2
- e_html_editor_selection_block_selection_changed (view->priv->selection);
- g_signal_handlers_block_by_func (view, html_editor_view_selection_changed_cb, NULL);
- */
-}
-
-static void
-unblock_selection_changed_callbacks (EHTMLEditorWebExtension *extension)
-{
- /* FIXME WK2
- e_html_editor_selection_unblock_selection_changed (view->priv->selection);
- g_signal_handlers_unblock_by_func (view, html_editor_view_selection_changed_cb, NULL);*/
-}
-
-static void
perform_spell_check (WebKitDOMDOMSelection *dom_selection,
WebKitDOMRange *start_range,
WebKitDOMRange *end_range)
@@ -201,7 +185,7 @@ dom_force_spell_check_for_current_paragraph (WebKitDOMDocument *document,
/* Block callbacks of selection-changed signal as we don't want to
* recount all the block format things in EHTMLEditorSelection and here as well
* when we are moving with caret */
- block_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_block_selection_changed_callback (extension);
parent = get_parent_block_element (WEBKIT_DOM_NODE (selection_end_marker));
@@ -242,7 +226,7 @@ dom_force_spell_check_for_current_paragraph (WebKitDOMDocument *document,
remove_node (WEBKIT_DOM_NODE (text));
/* Unblock the callbacks */
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
dom_selection_restore (document);
}
@@ -297,7 +281,7 @@ refresh_spell_check (WebKitDOMDocument *document,
/* Block callbacks of selection-changed signal as we don't want to
* recount all the block format things in EHTMLEditorSelection and here as well
* when we are moving with caret */
- block_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_block_selection_changed_callback (extension);
/* Append some text on the end of the body */
text = webkit_dom_document_create_text_node (document, "-x-evo-end");
@@ -328,7 +312,7 @@ refresh_spell_check (WebKitDOMDocument *document,
remove_node (WEBKIT_DOM_NODE (text));
/* Unblock the callbacks */
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
dom_selection_restore (document);
}
@@ -372,7 +356,7 @@ dom_force_spell_check_in_viewport (WebKitDOMDocument *document,
/* Block callbacks of selection-changed signal as we don't want to
* recount all the block format things in EHTMLEditorSelection and here as well
* when we are moving with caret */
- block_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_block_selection_changed_callback (extension);
/* We have to add 10 px offset as otherwise just the HTML element will be returned */
actual = webkit_dom_document_caret_range_from_point (document, 10, 10);
@@ -414,7 +398,7 @@ dom_force_spell_check_in_viewport (WebKitDOMDocument *document,
remove_node (WEBKIT_DOM_NODE (text));
/* Unblock the callbacks */
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
dom_selection_restore (document);
}
@@ -1587,6 +1571,18 @@ dom_insert_smiley (WebKitDOMDocument *document,
}
void
+dom_insert_smiley_by_name (WebKitDOMDocument *document,
+ EHTMLEditorWebExtension *extension,
+ const gchar *name)
+{
+ const EEmoticon *emoticon;
+
+ emoticon = e_emoticon_chooser_lookup_emoticon (name);
+ e_html_editor_web_extension_set_is_smiley_written (extension, FALSE);
+ dom_insert_smiley (document, extension, (EEmoticon *) emoticon);
+}
+
+void
dom_check_magic_smileys (WebKitDOMDocument *document,
EHTMLEditorWebExtension *extension)
{
@@ -1649,8 +1645,8 @@ dom_check_magic_smileys (WebKitDOMDocument *document,
}
}
- emoticon = (e_emoticon_chooser_lookup_emoticon (
- emoticons_icon_names[-state - 1]));
+ emoticon = e_emoticon_chooser_lookup_emoticon (
+ emoticons_icon_names[-state - 1]);
e_html_editor_web_extension_set_is_smiley_written (extension, TRUE);
dom_insert_smiley (document, extension, (EEmoticon *) emoticon);
}
@@ -1964,7 +1960,7 @@ save_history_for_input (WebKitDOMDocument *document,
ev = g_new0 (EHTMLEditorHistoryEvent, 1);
ev->type = HISTORY_INPUT;
- block_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_block_selection_changed_callback (extension);
dom_selection_get_coordinates (
document,
@@ -2063,7 +2059,7 @@ save_history_for_input (WebKitDOMDocument *document,
g_object_unref (range);
g_object_unref (range_clone);
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
ev->data.fragment = fragment;
@@ -7033,7 +7029,7 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
if (webkit_dom_range_get_collapsed (range, NULL)) {
WebKitDOMRange *range_clone;
- block_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_block_selection_changed_callback (extension);
range_clone = webkit_dom_range_clone_range (range, NULL);
if (delete_key) {
@@ -7055,7 +7051,7 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
g_object_unref (range_clone);
if (!webkit_dom_node_get_first_child (WEBKIT_DOM_NODE (fragment))) {
g_free (ev);
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
g_object_unref (range);
g_object_unref (dom_selection);
return;
@@ -7103,7 +7099,7 @@ save_history_for_delete_or_backspace (WebKitDOMDocument *document,
NULL);
}
- unblock_selection_changed_callbacks (extension);
+ e_html_editor_web_extension_unblock_selection_changed_callback (extension);
} else {
ev->after.start.x = ev->before.start.x;
ev->after.start.y = ev->before.start.y;
diff --git a/web-extensions/e-html-editor-view-dom-functions.h
b/web-extensions/composer/e-html-editor-view-dom-functions.h
similarity index 97%
rename from web-extensions/e-html-editor-view-dom-functions.h
rename to web-extensions/composer/e-html-editor-view-dom-functions.h
index e16700d..b5be126 100644
--- a/web-extensions/e-html-editor-view-dom-functions.h
+++ b/web-extensions/composer/e-html-editor-view-dom-functions.h
@@ -73,6 +73,10 @@ void dom_insert_smiley (WebKitDOMDocument *document,
EHTMLEditorWebExtension *extension,
EEmoticon *emoticon);
+void dom_insert_smiley_by_name (WebKitDOMDocument *document,
+ EHTMLEditorWebExtension *extension,
+ const gchar *name);
+
void dom_check_magic_smileys (WebKitDOMDocument *document,
EHTMLEditorWebExtension *extension);
diff --git a/web-extensions/e-html-editor-web-extension-main.c
b/web-extensions/composer/e-html-editor-web-extension-main.c
similarity index 100%
rename from web-extensions/e-html-editor-web-extension-main.c
rename to web-extensions/composer/e-html-editor-web-extension-main.c
diff --git a/web-extensions/e-html-editor-web-extension-names.h
b/web-extensions/composer/e-html-editor-web-extension-names.h
similarity index 91%
rename from web-extensions/e-html-editor-web-extension-names.h
rename to web-extensions/composer/e-html-editor-web-extension-names.h
index 0c42931..10e840d 100644
--- a/web-extensions/e-html-editor-web-extension-names.h
+++ b/web-extensions/composer/e-html-editor-web-extension-names.h
@@ -19,8 +19,8 @@
#ifndef E_HTML_EDITOR_WEB_EXTENSION_NAMES_H
#define E_HTML_EDITOR_WEB_EXTENSION_NAMES_H
-#define E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.EHTMLEditor.WebExtension"
-#define E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/EHTMLEditor/WebExtension"
-#define E_HTML_EDITOR_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.EHTMLEditor.WebExtension"
+#define E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.WebExtension.EHTMLEditor"
+#define E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/WebExtension/EHTMLEditor"
+#define E_HTML_EDITOR_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.WebExtension.EHTMLEditor"
#endif /* E_HTML_EDITOR_WEB_EXTENSION_NAMES_H */
diff --git a/web-extensions/e-html-editor-web-extension.c
b/web-extensions/composer/e-html-editor-web-extension.c
similarity index 82%
rename from web-extensions/e-html-editor-web-extension.c
rename to web-extensions/composer/e-html-editor-web-extension.c
index 50c091f..2100ba4 100644
--- a/web-extensions/e-html-editor-web-extension.c
+++ b/web-extensions/composer/e-html-editor-web-extension.c
@@ -20,20 +20,7 @@
#include "e-html-editor-web-extension.h"
-#include <string.h>
-
-#include <gio/gio.h>
-#include <gtk/gtk.h>
-#include <webkit2/webkit-web-extension.h>
-
-#include <camel/camel.h>
-
-#include <e-util/e-misc-utils.h>
-
-#include <e-util/e-html-editor-defines.h>
-
#include "e-composer-private-dom-functions.h"
-#include "e-dom-utils.h"
#include "e-html-editor-actions-dom-functions.h"
#include "e-html-editor-cell-dialog-dom-functions.h"
#include "e-html-editor-hrule-dialog-dom-functions.h"
@@ -46,6 +33,17 @@
#include "e-html-editor-view-dom-functions.h"
#include "e-msg-composer-dom-functions.h"
+#include <e-util/e-misc-utils.h>
+#include <e-util/e-html-editor-defines.h>
+#include <web-extensions/e-dom-utils.h>
+
+#include <string.h>
+
+#include <gio/gio.h>
+#include <gtk/gtk.h>
+#include <webkit2/webkit-web-extension.h>
+#include <camel/camel.h>
+
#define E_HTML_EDITOR_WEB_EXTENSION_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_HTML_EDITOR_WEB_EXTENSION, EHTMLEditorWebExtensionPrivate))
@@ -108,27 +106,29 @@ static CamelDataCache *emd_global_http_cache = NULL;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.WebExtension'>"
+" <interface name='"E_HTML_EDITOR_WEB_EXTENSION_INTERFACE"'>"
"<!-- ********************************************************* -->"
"<!-- PROPERTIES -->"
"<!-- ********************************************************* -->"
" <property type='b' name='ForceImageLoad' access='readwrite'/>"
" <property type='b' name='InlineSpelling' access='readwrite'/>"
" <property type='b' name='MagicLinks' access='readwrite'/>"
+" <property type='b' name='MagicSmileys' access='readwrite'/>"
" <property type='b' name='HTMLMode' access='readwrite'/>"
" <property type='b' name='IsMessageFromEditAsNew' access='readwrite'/>"
" <property type='b' name='IsMessageFromDraft' access='readwrite'/>"
" <property type='b' name='IsMessageFromSelection' access='readwrite'/>"
" <property type='b' name='IsFromNewMessage' access='readwrite'/>"
" <property type='b' name='RemoveInitialInputLine' access='readwrite'/>"
-" <property type='b' name='NodeUnderMouseClickFlags' access='read'/>"
+" <property type='u' name='NodeUnderMouseClickFlags' access='readwrite'/>"
"<!-- ********************************************************* -->"
"<!-- These properties show the actual state of EHTMLEditorView -->"
"<!-- ********************************************************* -->"
-" <property type='b' name='Alignment' access='readwrite'/>"
+" <property type='u' name='Alignment' access='readwrite'/>"
" <property type='s' name='BackgroundColor' access='readwrite'/>"
" <property type='u' name='BlockFormat' access='readwrite'/>"
" <property type='b' name='Bold' access='readwrite'/>"
+" <property type='b' name='Changed' access='readwrite'/>"
" <property type='s' name='FontColor' access='readwrite'/>"
" <property type='s' name='FontName' access='readwrite'/>"
" <property type='u' name='FontSize' access='readwrite'/>"
@@ -545,12 +545,70 @@ static const char introspection_xml[] =
" <method name='DOMIMContextPreEditEnd'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
+" <method name='DOMInsertSmiley'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='s' name='smiley_name' direction='in'/>"
+" </method>"
"<!-- ********************************************************* -->"
"<!-- Functions that are used in EHTMLEditorSelection -->"
"<!-- ********************************************************* -->"
" <method name='DOMSelectionIndent'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
+" <method name='DOMSelectionInsertBase64Image'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='s' name='base64_content' direction='in'/>"
+" <arg type='s' name='filename' direction='in'/>"
+" <arg type='s' name='uri' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionReplace'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='s' name='replacement' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetAlignment'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='u' name='alignment' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetBold'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='bold' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetBlockFormat'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='u' name='block_format' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetFontColor'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='s' name='color' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetFontSize'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='u' name='font_size' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetItalic'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='italic' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetMonospaced'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='monospaced' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetStrikethrough'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='strikethrough' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetSubscript'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='subscript' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetSuperscript'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='superscript' direction='in'/>"
+" </method>"
+" <method name='DOMSelectionSetUnderline'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='underline' direction='in'/>"
+" </method>"
" <method name='DOMSelectionUnindent'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
@@ -617,6 +675,7 @@ handle_method_call (GDBusConnection *connection,
if (g_strcmp0 (interface_name, E_HTML_EDITOR_WEB_EXTENSION_INTERFACE) != 0)
return;
+ printf ("%s - %s\n", __FUNCTION__, method_name);
if (g_strcmp0 (method_name, "ElementHasAttribute") == 0) {
gboolean value = FALSE;
const gchar *element_id, *attribute;
@@ -628,7 +687,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -648,7 +707,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -657,7 +716,10 @@ handle_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "ElementGetAttributeBySelector") == 0) {
const gchar *attribute, *selector;
gchar *value = NULL;
@@ -669,7 +731,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_query_selector (document, selector, NULL);
@@ -678,7 +740,10 @@ handle_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "ElementRemoveAttribute") == 0) {
const gchar *element_id, *attribute;
WebKitDOMElement *element;
@@ -689,7 +754,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -707,7 +772,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_query_selector (document, selector, NULL);
@@ -727,7 +792,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -741,12 +806,12 @@ handle_method_call (GDBusConnection *connection,
WebKitDOMElement *element;
g_variant_get (
- parameters, "(t&s&s)", &page_id, &selector, &attribute, &value);
+ parameters, "(t&s&s&s)", &page_id, &selector, &attribute, &value);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_query_selector (document, selector, NULL);
@@ -770,7 +835,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -779,7 +844,10 @@ handle_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "RemoveImageAttributesFromElementBySelector") == 0) {
const gchar *selector;
WebKitDOMElement *element;
@@ -790,7 +858,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_query_selector (document, selector, NULL);
@@ -810,7 +878,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_mark_current_cell_element (document, extension, element_id);
@@ -822,7 +890,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_save_history_on_exit (document, extension);
@@ -837,7 +905,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_v_align (document, value, scope);
@@ -852,7 +920,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_align (document, value, scope);
@@ -867,7 +935,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_no_wrap (document, value, scope);
@@ -882,7 +950,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_header_style (
@@ -898,7 +966,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_width (document, value, scope);
@@ -913,7 +981,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_col_span (document, value, scope);
@@ -928,7 +996,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_row_span (document, value, scope);
@@ -943,7 +1011,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_cell_dialog_set_element_bg_color (document, value, scope);
@@ -956,21 +1024,21 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
created_new_hr = e_html_editor_hrule_dialog_find_hrule (
document, extension, extension->priv->node_under_mouse_click);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (created_new_hr));
+ invocation, g_variant_new ("(b)", created_new_hr));
} else if (g_strcmp0 (method_name, "EHTMLEditorHRuleDialogSaveHistoryOnExit") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_hrule_dialog_save_history_on_exit (document, extension);
@@ -987,7 +1055,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1007,7 +1075,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1016,14 +1084,14 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_HR_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (value));
+ invocation, g_variant_new ("(b)", value));
} else if (g_strcmp0 (method_name, "EHTMLEditorImageDialogMarkImage") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_image_dialog_mark_image (
@@ -1036,7 +1104,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_image_dialog_save_history_on_exit (document, extension);
@@ -1050,7 +1118,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_image_dialog_set_element_url (document, value);
@@ -1064,14 +1132,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = e_html_editor_image_dialog_get_element_url (document);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "ImageElementSetWidth") == 0) {
const gchar *element_id;
glong value;
@@ -1083,7 +1154,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1103,7 +1174,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1112,7 +1183,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "ImageElementSetHeight") == 0) {
const gchar *element_id;
glong value;
@@ -1124,7 +1195,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1144,7 +1215,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1153,7 +1224,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "ImageElementGetNaturalWidth") == 0) {
const gchar *element_id;
glong value = 0;
@@ -1165,7 +1236,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1174,7 +1245,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "ImageElementGetNaturalHeight") == 0) {
const gchar *element_id;
glong value = 0;
@@ -1186,7 +1257,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1195,7 +1266,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "ImageElementSetHSpace") == 0) {
const gchar *element_id;
glong value;
@@ -1207,7 +1278,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1227,7 +1298,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1236,7 +1307,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "ImageElementSetVSpace") == 0) {
const gchar *element_id;
glong value;
@@ -1248,7 +1319,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1268,7 +1339,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1277,7 +1348,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_IMAGE_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "EHTMLEditorLinkDialogOk") == 0) {
const gchar *url, *inner_text;
@@ -1286,7 +1357,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_link_dialog_ok (document, extension, url, inner_text);
@@ -1298,7 +1369,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_page_dialog_save_history (document, extension);
@@ -1310,7 +1381,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_page_dialog_save_history_on_exit (document, extension);
@@ -1325,14 +1396,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = e_html_editor_spell_check_dialog_next (document, word);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "EHTMLEditorSpellCheckDialogPrev") == 0) {
const gchar *word;
gchar *value = NULL;
@@ -1342,14 +1416,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = e_html_editor_spell_check_dialog_prev (document, word);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "EHTMLEditorTableDialogSetRowCount") == 0) {
gulong value;
@@ -1358,7 +1435,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_table_dialog_set_row_count (document, value);
@@ -1372,13 +1449,13 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = e_html_editor_table_dialog_get_row_count (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_uint32 (value));
+ invocation, g_variant_new ("(u)", value));
} else if (g_strcmp0 (method_name, "EHTMLEditorTableDialogSetColumnCount") == 0) {
gulong value;
@@ -1387,7 +1464,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_table_dialog_set_column_count (document, value);
@@ -1401,13 +1478,13 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = e_html_editor_table_dialog_get_column_count (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_uint32 (value));
+ invocation, g_variant_new ("(u)", value));
} else if (g_strcmp0 (method_name, "EHTMLEditorTableDialogShow") == 0) {
gboolean created_new_table;
@@ -1416,20 +1493,20 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
created_new_table = e_html_editor_table_dialog_show (document, extension);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (created_new_table));
+ invocation, g_variant_new ("(b)", created_new_table));
} else if (g_strcmp0 (method_name, "EHTMLEditorTableDialogSaveHistoryOnExit") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_table_dialog_save_history_on_exit (document, extension);
@@ -1441,7 +1518,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_delete_cell_contents (document, extension);
@@ -1453,7 +1530,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_delete_column (document, extension);
@@ -1465,7 +1542,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_delete_row (document, extension);
@@ -1477,7 +1554,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_delete_table (document, extension);
@@ -1489,7 +1566,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_delete_cell_contents (document, extension);
@@ -1501,7 +1578,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_insert_column_after (document, extension);
@@ -1513,7 +1590,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_insert_column_before (document, extension);
@@ -1525,7 +1602,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_insert_row_above (document, extension);
@@ -1537,7 +1614,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
e_html_editor_dialog_insert_row_below (document, extension);
@@ -1549,7 +1626,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_unlink (document, extension);
@@ -1561,7 +1638,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_unlink (document, extension);
@@ -1573,7 +1650,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_save_history_for_cut (document, extension);
@@ -1589,7 +1666,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1598,7 +1675,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (value));
+ invocation, g_variant_new ("(b)", value));
} else if (g_strcmp0 (method_name, "TableCellElementGetRowSpan") == 0) {
const gchar *element_id;
glong value = 0;
@@ -1609,7 +1686,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1618,7 +1695,7 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "TableCellElementGetColSpan") == 0) {
const gchar *element_id;
glong value = 0;
@@ -1629,7 +1706,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
element = webkit_dom_document_get_element_by_id (document, element_id);
@@ -1638,14 +1715,14 @@ handle_method_call (GDBusConnection *connection,
WEBKIT_DOM_HTML_TABLE_CELL_ELEMENT (element));
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_int32 (value));
+ invocation, g_variant_new ("(i)", value));
} else if (g_strcmp0 (method_name, "DOMSaveSelection") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_save (document);
@@ -1656,7 +1733,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_restore (document);
@@ -1667,7 +1744,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_turn_spell_check_off (document, extension);
@@ -1680,7 +1757,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_quote_and_insert_text_into_selection (document, extension, text);
@@ -1694,7 +1771,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_convert_and_insert_html_into_selection (document, extension, text, is_html);
@@ -1707,7 +1784,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_embed_style_sheet (document, style_sheet_content);
@@ -1718,7 +1795,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_remove_embed_style_sheet (document);
@@ -1729,7 +1806,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_force_spell_check (document, extension);
@@ -1740,7 +1817,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_check_magic_links (document, extension, FALSE);
@@ -1754,12 +1831,12 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
stop_handlers = dom_process_on_key_press (document, extension, key_val);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (stop_handlers));
+ invocation, g_variant_new ("(b)", stop_handlers));
} else if (g_strcmp0 (method_name, "DOMCheckIfConversionNeeded") == 0) {
gboolean conversion_needed;
@@ -1768,19 +1845,19 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
conversion_needed = dom_check_if_conversion_needed (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_boolean (conversion_needed));
+ invocation, g_variant_new ("(b)", conversion_needed));
} else if (g_strcmp0 (method_name, "DOMConvertWhenChangingComposerMode") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_convert_when_changing_composer_mode (document, extension);
@@ -1791,7 +1868,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_process_content_after_mode_change (document, extension);
@@ -1804,14 +1881,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_process_content_for_draft (document);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMProcessContentForHTML") == 0) {
const gchar *from_domain;
gchar *value = NULL;
@@ -1821,14 +1901,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_process_content_for_html (document, extension, from_domain);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMProcessContentForPlainText") == 0) {
gchar *value = NULL;
@@ -1837,14 +1920,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_process_content_for_plain_text (document, extension);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMInsertHTML") == 0) {
const gchar *html;
@@ -1853,7 +1939,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_insert_html (document, extension, html);
@@ -1866,7 +1952,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_convert_content (document, extension, preferred_text);
@@ -1880,7 +1966,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
images_data = dom_get_inline_images_data (document, extension, uid_domain);
@@ -1893,7 +1979,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
e_html_editor_web_extension_add_new_inline_image_into_list (
extension, cid_uri, src);
@@ -1910,7 +1996,21 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_replace_base64_image_src (document, selector, base64_content, filename, uri);
+
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMReplaceBase64ImageSrc") == 0) {
+ const gchar *selector, *base64_content, *filename, *uri;
+
+ g_variant_get (parameters, "(t&s&s)", &page_id, &selector, &base64_content, &filename, &uri);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_replace_base64_image_src (document, selector, base64_content, filename, uri);
@@ -1922,7 +2022,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_drag_and_drop_end (document, extension);
@@ -1933,7 +2033,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
extension->priv->im_input_in_progress = TRUE;
document = webkit_web_page_get_dom_document (web_page);
@@ -1945,12 +2045,25 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
extension->priv->im_input_in_progress = FALSE;
document = webkit_web_page_get_dom_document (web_page);
dom_register_input_event_listener_on_body (document, extension);
g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMInsertSmiley") == 0) {
+ const gchar *smiley_name;
+
+ g_variant_get (parameters, "(t&s)", &page_id, &smiley_name);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_insert_smiley_by_name (document, extension, smiley_name);
+ g_dbus_method_invocation_return_value (invocation, NULL);
} else if (g_strcmp0 (method_name, "DOMMoveSelectionOnPoint") == 0) {
gboolean cancel_if_not_collapsed;
gint x, y;
@@ -1960,7 +2073,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
if (cancel_if_not_collapsed) {
@@ -1975,18 +2088,188 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_indent (document, extension);
g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionInsertBase64Image") == 0) {
+ const gchar *base64_content, *filename, *uri;
+
+ g_variant_get (parameters, "(t&s&s&s)", &page_id, &base64_content, &filename, &uri);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_insert_base64_image (document, extension, filename, uri, base64_content);
+
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionReplace") == 0) {
+ const gchar *replacement;
+
+ g_variant_get (parameters, "(t&s)", &page_id, &replacement);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_replace (document, extension, replacement);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetAlignment") == 0) {
+ guint32 alignment;
+
+ g_variant_get (parameters, "(tu)", &page_id, &alignment);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_alignment (document, extension, alignment);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetBold") == 0) {
+ gboolean bold;
+
+ g_variant_get (parameters, "(tb)", &page_id, &bold);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_bold (document, extension, bold);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetBlockFormat") == 0) {
+ guint32 block_format;
+
+ g_variant_get (parameters, "(tu)", &page_id, &block_format);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_block_format (document, extension, block_format);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetFontColor") == 0) {
+ const gchar *color;
+
+ g_variant_get (parameters, "(t&s)", &page_id, &color);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_font_color (document, extension, color);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetFontSize") == 0) {
+ guint32 font_size;
+
+ g_variant_get (parameters, "(tu)", &page_id, &font_size);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_font_size (document, extension, font_size);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetItalic") == 0) {
+ gboolean italic;
+
+ g_variant_get (parameters, "(tb)", &page_id, &italic);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_italic (document, extension, italic);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetMonospaced") == 0) {
+ gboolean monospaced;
+
+ g_variant_get (parameters, "(tb)", &page_id, &monospaced);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_monospaced (document, extension, monospaced);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetStrikethrough") == 0) {
+ gboolean strikethrough;
+
+ g_variant_get (parameters, "(tb)", &page_id, &strikethrough);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_strikethrough (document, extension, strikethrough);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetSubscript") == 0) {
+ gboolean subscript;
+
+ g_variant_get (parameters, "(tb)", &page_id, &subscript);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_subscript (document, extension, subscript);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetSuperscript") == 0) {
+ gboolean superscript;
+
+ g_variant_get (parameters, "(tb)", &page_id, &superscript);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_superscript (document, extension, superscript);
+ g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DOMSelectionSetUnderline") == 0) {
+ gboolean underline;
+
+ g_variant_get (parameters, "(tb)", &page_id, &underline);
+
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ goto error;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ dom_selection_set_underline (document, extension, underline);
+ g_dbus_method_invocation_return_value (invocation, NULL);
} else if (g_strcmp0 (method_name, "DOMSelectionUnindent") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_unindent (document, extension);
@@ -1997,7 +2280,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_selection_wrap (document, extension);
@@ -2011,14 +2294,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
active_signature = dom_remove_signatures (document, extension, top_signature);
g_dbus_method_invocation_return_value (
invocation,
- active_signature ? g_variant_new_take_string (active_signature) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ active_signature ? active_signature : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMInsertSignature") == 0) {
gboolean top_signature, start_bottom;
const gchar *signature_html;
@@ -2029,7 +2315,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_insert_signature (document, extension, signature_html, top_signature, start_bottom);
@@ -2042,7 +2328,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
dom_clean_after_drag_and_drop (document, extension);
@@ -2056,14 +2342,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_get_active_signature_uid (document);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMGetRawBodyContentWithoutSignature") == 0) {
gchar *value;
@@ -2072,14 +2361,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_get_raw_body_content_without_signature (document);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMGetRawBodyContent") == 0) {
gchar *value;
@@ -2088,14 +2380,17 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_get_raw_body_content (document);
g_dbus_method_invocation_return_value (
invocation,
- value ? g_variant_new_take_string (value) : NULL);
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ value ? value : g_strdup (""))));
} else if (g_strcmp0 (method_name, "DOMGetCaretPosition") == 0) {
gint32 value;
@@ -2104,7 +2399,7 @@ handle_method_call (GDBusConnection *connection,
web_page = get_webkit_web_page_or_return_dbus_error (
invocation, web_extension, page_id);
if (!web_page)
- return;
+ goto error;
document = webkit_web_page_get_dom_document (web_page);
value = dom_get_caret_position (document);
@@ -2112,7 +2407,14 @@ handle_method_call (GDBusConnection *connection,
g_dbus_method_invocation_return_value (
invocation,
value ? g_variant_new_int32 (value) : NULL);
+ } else {
+ g_warning ("UNKNOWN METHOD '%s:i'", method_name);
}
+
+ return;
+
+ error:
+ g_warning ("Cannot obtain WebKitWebPage for '%ld'", page_id);
}
static GVariant *
@@ -2127,12 +2429,15 @@ handle_get_property (GDBusConnection *connection,
EHTMLEditorWebExtension *extension = E_HTML_EDITOR_WEB_EXTENSION (user_data);
GVariant *variant;
+ printf ("%s - %s - %s\n", __FUNCTION__, sender, property_name);
if (g_strcmp0 (property_name, "ForceImageLoad") == 0)
variant = g_variant_new_boolean (extension->priv->force_image_load);
else if (g_strcmp0 (property_name, "InlineSpelling") == 0)
variant = g_variant_new_boolean (extension->priv->inline_spelling);
else if (g_strcmp0 (property_name, "MagicLinks") == 0)
variant = g_variant_new_boolean (extension->priv->magic_links);
+ else if (g_strcmp0 (property_name, "MagicSmileys") == 0)
+ variant = g_variant_new_boolean (extension->priv->magic_smileys);
else if (g_strcmp0 (property_name, "HTMLMode") == 0)
variant = g_variant_new_boolean (extension->priv->html_mode);
else if (g_strcmp0 (property_name, "IsFromNewMessage") == 0)
@@ -2146,19 +2451,21 @@ handle_get_property (GDBusConnection *connection,
else if (g_strcmp0 (property_name, "RemoveInitialInputLine") == 0)
variant = g_variant_new_boolean (extension->priv->remove_initial_input_line);
else if (g_strcmp0 (property_name, "Alignment") == 0)
- variant = g_variant_new_int32 (extension->priv->alignment);
+ variant = g_variant_new_uint32 (extension->priv->alignment);
else if (g_strcmp0 (property_name, "BackgroundColor") == 0)
variant = g_variant_new_string (extension->priv->background_color);
else if (g_strcmp0 (property_name, "BlockFormat") == 0)
- variant = g_variant_new_int32 (extension->priv->block_format);
+ variant = g_variant_new_uint32 (extension->priv->block_format);
else if (g_strcmp0 (property_name, "Bold") == 0)
variant = g_variant_new_boolean (extension->priv->bold);
+ else if (g_strcmp0 (property_name, "Changed") == 0)
+ variant = g_variant_new_boolean (extension->priv->changed);
else if (g_strcmp0 (property_name, "FontColor") == 0)
variant = g_variant_new_string (extension->priv->font_color);
else if (g_strcmp0 (property_name, "FontName") == 0)
variant = g_variant_new_string (extension->priv->font_name);
else if (g_strcmp0 (property_name, "FontSize") == 0)
- variant = g_variant_new_int32 (extension->priv->font_size);
+ variant = g_variant_new_uint32 (extension->priv->font_size);
else if (g_strcmp0 (property_name, "Indented") == 0)
variant = g_variant_new_boolean (extension->priv->indented);
else if (g_strcmp0 (property_name, "Italic") == 0)
@@ -2197,6 +2504,7 @@ handle_set_property (GDBusConnection *connection,
GError *local_error = NULL;
GVariantBuilder *builder;
+ printf ("%s - %s - %s\n", __FUNCTION__, sender, property_name);
builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
if (g_strcmp0 (property_name, "ForceImageLoad") == 0) {
@@ -2295,6 +2603,18 @@ handle_set_property (GDBusConnection *connection,
"{sv}",
"MagicLinks",
g_variant_new_boolean (extension->priv->magic_links));
+ } else if (g_strcmp0 (property_name, "MagicSmileys") == 0) {
+ gboolean value = g_variant_get_boolean (variant);
+
+ if (value == extension->priv->magic_smileys)
+ goto exit;
+
+ extension->priv->magic_smileys = value;
+
+ g_variant_builder_add (builder,
+ "{sv}",
+ "MagicSmileys",
+ g_variant_new_boolean (extension->priv->magic_smileys));
} else if (g_strcmp0 (property_name, "InlineSpelling") == 0) {
gboolean value = g_variant_get_boolean (variant);
@@ -2308,7 +2628,7 @@ handle_set_property (GDBusConnection *connection,
"InlineSpelling",
g_variant_new_boolean (extension->priv->inline_spelling));
} else if (g_strcmp0 (property_name, "Alignment") == 0) {
- gint32 value = g_variant_get_int32 (variant);
+ gint32 value = g_variant_get_uint32 (variant);
if (value == extension->priv->alignment)
goto exit;
@@ -2318,7 +2638,7 @@ handle_set_property (GDBusConnection *connection,
g_variant_builder_add (builder,
"{sv}",
"Alignment",
- g_variant_new_int32 (extension->priv->alignment));
+ g_variant_new_uint32 (extension->priv->alignment));
} else if (g_strcmp0 (property_name, "BackgroundColor") == 0) {
const gchar *value = g_variant_get_string (variant, NULL);
@@ -2333,7 +2653,7 @@ handle_set_property (GDBusConnection *connection,
"BackgroundColor",
g_variant_new_string (extension->priv->background_color));
} else if (g_strcmp0 (property_name, "BlockFormat") == 0) {
- gint32 value = g_variant_get_int32 (variant);
+ guint32 value = g_variant_get_uint32 (variant);
if (value == extension->priv->block_format)
goto exit;
@@ -2343,7 +2663,7 @@ handle_set_property (GDBusConnection *connection,
g_variant_builder_add (builder,
"{sv}",
"BlockFormat",
- g_variant_new_int32 (extension->priv->block_format));
+ g_variant_new_uint32 (extension->priv->block_format));
} else if (g_strcmp0 (property_name, "Bold") == 0) {
gboolean value = g_variant_get_boolean (variant);
@@ -2356,10 +2676,22 @@ handle_set_property (GDBusConnection *connection,
"{sv}",
"Bold",
g_variant_new_boolean (extension->priv->bold));
+ } else if (g_strcmp0 (property_name, "Changed") == 0) {
+ gboolean value = g_variant_get_boolean (variant);
+
+ if (value == extension->priv->changed)
+ goto exit;
+
+ extension->priv->changed = value;
+
+ g_variant_builder_add (builder,
+ "{sv}",
+ "Changed",
+ g_variant_new_boolean (extension->priv->changed));
} else if (g_strcmp0 (property_name, "FontColor") == 0) {
const gchar *value = g_variant_get_string (variant, NULL);
- if (g_strcmp0 (value, extension->priv->font_color) != 0)
+ if (g_strcmp0 (value, extension->priv->font_color) == 0)
goto exit;
g_free (extension->priv->font_color);
@@ -2372,7 +2704,7 @@ handle_set_property (GDBusConnection *connection,
} else if (g_strcmp0 (property_name, "FontName") == 0) {
const gchar *value = g_variant_get_string (variant, NULL);
- if (g_strcmp0 (value, extension->priv->font_name) != 0)
+ if (g_strcmp0 (value, extension->priv->font_name) == 0)
goto exit;
g_free (extension->priv->font_name);
@@ -2383,7 +2715,7 @@ handle_set_property (GDBusConnection *connection,
"FontName",
g_variant_new_string (extension->priv->font_name));
} else if (g_strcmp0 (property_name, "FontSize") == 0) {
- gint32 value = g_variant_get_int32 (variant);
+ gint32 value = g_variant_get_uint32 (variant);
if (value == extension->priv->font_size)
goto exit;
@@ -2393,7 +2725,7 @@ handle_set_property (GDBusConnection *connection,
g_variant_builder_add (builder,
"{sv}",
"FontSize",
- g_variant_new_int32 (extension->priv->font_size));
+ g_variant_new_uint32 (extension->priv->font_size));
} else if (g_strcmp0 (property_name, "Indented") == 0) {
gboolean value = g_variant_get_boolean (variant);
@@ -2476,12 +2808,12 @@ handle_set_property (GDBusConnection *connection,
g_variant_builder_add (builder,
"{sv}",
- "Undeline",
+ "Underline",
g_variant_new_boolean (extension->priv->underline));
} else if (g_strcmp0 (property_name, "Text") == 0) {
const gchar *value = g_variant_get_string (variant, NULL);
- if (g_strcmp0 (value, extension->priv->text) != 0)
+ if (g_strcmp0 (value, extension->priv->text) == 0)
goto exit;
g_free (extension->priv->text);
@@ -2491,6 +2823,18 @@ handle_set_property (GDBusConnection *connection,
"{sv}",
"Text",
g_variant_new_string (extension->priv->text));
+ } else if (g_strcmp0 (property_name, "NodeUnderMouseClickFlags") == 0) {
+ guint32 value = g_variant_get_uint32 (variant);
+
+ extension->priv->node_under_mouse_click_flags = value;
+
+ printf ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa %d\n", value);
+ g_variant_builder_add (builder,
+ "{sv}",
+ "NodeUnderMouseClickFlags",
+ g_variant_new_uint32 (extension->priv->node_under_mouse_click_flags));
+ } else {
+ g_warning ("UNKNOWN PROPERY '%s'", property_name);
}
g_dbus_connection_emit_signal (connection,
@@ -2508,6 +2852,7 @@ handle_set_property (GDBusConnection *connection,
g_assert_no_error (local_error);
exit:
+ printf ("\tExitting\n");
g_variant_builder_unref (builder);
return TRUE;
@@ -2555,7 +2900,6 @@ e_html_editor_web_extension_dispose (GObject *object)
if (extension->priv->undo_redo_manager != NULL) {
g_object_unref (extension->priv->undo_redo_manager);
extension->priv->undo_redo_manager = NULL;
- extension->priv->text = NULL;
}
g_clear_object (&extension->priv->wk_extension);
@@ -2593,10 +2937,10 @@ e_html_editor_web_extension_init (EHTMLEditorWebExtension *extension)
extension->priv = G_TYPE_INSTANCE_GET_PRIVATE (extension, E_TYPE_HTML_EDITOR_WEB_EXTENSION,
EHTMLEditorWebExtensionPrivate);
extension->priv->bold = FALSE;
- extension->priv->background_color = NULL;
- extension->priv->font_color = NULL;
- extension->priv->font_name = NULL;
- extension->priv->text = NULL;
+ extension->priv->background_color = g_strdup ("");
+ extension->priv->font_color = g_strdup ("");
+ extension->priv->font_name = g_strdup ("");
+ extension->priv->text = g_strdup ("");
extension->priv->font_size = E_HTML_EDITOR_SELECTION_FONT_SIZE_NORMAL;
extension->priv->indented = FALSE;
extension->priv->italic = FALSE;
@@ -2617,11 +2961,10 @@ e_html_editor_web_extension_init (EHTMLEditorWebExtension *extension)
extension->priv->return_key_pressed = FALSE;
extension->priv->space_key_pressed = FALSE;
extension->priv->smiley_written = FALSE;
- extension->priv->body_input_event_removed = FALSE;
extension->priv->word_wrap_length = 71;
extension->priv->convert_in_situ = FALSE;
- extension->priv->body_input_event_removed = FALSE;
+ extension->priv->body_input_event_removed = TRUE;
extension->priv->is_message_from_draft = FALSE;
extension->priv->is_message_from_edit_as_new = FALSE;
extension->priv->is_from_new_message = FALSE;
@@ -2636,7 +2979,7 @@ e_html_editor_web_extension_init (EHTMLEditorWebExtension *extension)
extension->priv->undo_redo_manager = g_object_new (
E_TYPE_HTML_EDITOR_UNDO_REDO_MANAGER,
- "html-editor-web-extension", extension->priv->undo_redo_manager,
+ "html-editor-web-extension", extension,
NULL);
extension->priv->inline_images = g_hash_table_new_full (
@@ -2771,6 +3114,8 @@ web_page_document_loaded_cb (WebKitWebPage *web_page,
e_html_editor_undo_redo_manager_set_document (
web_extension->priv->undo_redo_manager, document);
+ web_extension->priv->body_input_event_removed = TRUE;
+
dom_process_content_after_load (document, web_extension);
}
@@ -2786,11 +3131,6 @@ web_page_context_menu_cb (WebKitWebPage *web_page,
node = webkit_web_hit_test_result_get_node (hit_test_result);
web_extension->priv->node_under_mouse_click = node;
- if (WEBKIT_DOM_IS_TEXT (node)) {
- flags |= E_HTML_EDITOR_NODE_IS_TEXT;
- return flags;
- }
-
if (WEBKIT_DOM_IS_HTML_HR_ELEMENT (node))
flags |= E_HTML_EDITOR_NODE_IS_HR;
@@ -2821,30 +3161,69 @@ web_page_context_menu_cb (WebKitWebPage *web_page,
if (flags == 0)
flags |= E_HTML_EDITOR_NODE_IS_TEXT;
- web_extension->priv->node_under_mouse_click_flags = flags;
+ set_dbus_property_unsigned (web_extension, "NodeUnderMouseClickFlags", flags);
return FALSE;
}
static void
+web_editor_selection_changed_cb (WebKitWebEditor *editor,
+ EHTMLEditorWebExtension *extension)
+{
+ WebKitWebPage *page;
+ WebKitDOMDocument *document;
+
+ page = webkit_web_editor_get_page (editor);
+ document = webkit_web_page_get_dom_document (page);
+
+ set_dbus_property_unsigned (extension, "Alignment", dom_selection_get_alignment (document,
extension));
+ set_dbus_property_unsigned (extension, "BlockFormat", dom_selection_get_block_format (document,
extension));
+ set_dbus_property_boolean (extension, "Indented", dom_selection_is_indented (document));
+ /*
+ g_object_notify (G_OBJECT (selection), "text");
+*/
+ if (!extension->priv->html_mode)
+ return;
+
+ set_dbus_property_boolean (extension, "Bold", dom_selection_is_bold (document, extension));
+ set_dbus_property_boolean (extension, "Italic", dom_selection_is_italic (document, extension));
+ set_dbus_property_boolean (extension, "Underline", dom_selection_is_underline (document, extension));
+ set_dbus_property_boolean (extension, "Strikethrough", dom_selection_is_strikethrough (document,
extension));
+ set_dbus_property_boolean (extension, "Monospaced", dom_selection_is_monospaced (document,
extension));
+ set_dbus_property_boolean (extension, "Subscript", dom_selection_is_subscript (document, extension));
+ set_dbus_property_boolean (extension, "Superscript", dom_selection_is_superscript (document,
extension));
+ set_dbus_property_unsigned (extension, "FontSize", dom_selection_get_font_size (document, extension));
+ set_dbus_property_take_string (extension, "FontColor", dom_selection_get_font_color (document,
extension));
+/*
+ g_object_notify (G_OBJECT (selection), "background-color");
+ g_object_notify (G_OBJECT (selection), "font-name");
+ */
+}
+
+static void
web_page_created_cb (WebKitWebExtension *wk_extension,
WebKitWebPage *web_page,
EHTMLEditorWebExtension *extension)
{
- g_signal_connect_object (
+ WebKitWebEditor *web_editor;
+
+ g_signal_connect (
web_page, "send-request",
- G_CALLBACK (web_page_send_request_cb),
- extension, 0);
+ G_CALLBACK (web_page_send_request_cb), extension);
- g_signal_connect_object (
+ g_signal_connect (
web_page, "document-loaded",
- G_CALLBACK (web_page_document_loaded_cb),
- extension, 0);
+ G_CALLBACK (web_page_document_loaded_cb), extension);
- g_signal_connect_object (
+ g_signal_connect (
web_page, "context-menu",
- G_CALLBACK (web_page_context_menu_cb),
- extension, 0);
+ G_CALLBACK (web_page_context_menu_cb), extension);
+
+ web_editor = webkit_web_page_get_editor (web_page);
+
+ g_signal_connect (
+ web_editor, "selection-changed",
+ G_CALLBACK (web_editor_selection_changed_cb), extension);
}
void
@@ -2902,33 +3281,113 @@ e_html_editor_web_extension_dbus_register (EHTMLEditorWebExtension *extension,
extension->priv->dbus_connection = connection;
g_object_add_weak_pointer (
G_OBJECT (connection),
- (gpointer *)&extension->priv->dbus_connection);
+ (gpointer *) &extension->priv->dbus_connection);
}
}
}
void
+set_dbus_property_string (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ const gchar *value)
+{
+ if (extension->priv->dbus_connection) {
+ g_dbus_connection_call (
+ extension->priv->dbus_connection,
+ E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
+ E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ g_variant_new (
+ "(ssv)",
+ E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
+ name,
+ g_variant_new_string (value)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ }
+}
+
+void
+set_dbus_property_take_string (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ gchar *value)
+{
+ if (extension->priv->dbus_connection) {
+ g_dbus_connection_call (
+ extension->priv->dbus_connection,
+ E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
+ E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ g_variant_new (
+ "(ssv)",
+ E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
+ name,
+ g_variant_new_take_string (value)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ }
+}
+
+void
+set_dbus_property_unsigned (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ guint32 value)
+{
+ if (extension->priv->dbus_connection) {
+ g_dbus_connection_call (
+ extension->priv->dbus_connection,
+ E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
+ E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ g_variant_new (
+ "(ssv)",
+ E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
+ name,
+ g_variant_new_uint32 (value)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ }
+}
+
+void
set_dbus_property_boolean (EHTMLEditorWebExtension *extension,
const gchar *name,
gboolean value)
{
- g_dbus_connection_call (
- extension->priv->dbus_connection,
- E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
- E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
- "org.freedesktop.DBus.Properties",
- "Set",
- g_variant_new (
- "(ssv)",
- E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
- name,
- g_variant_new_boolean (value)),
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- NULL,
- NULL);
+ if (extension->priv->dbus_connection) {
+ g_dbus_connection_call (
+ extension->priv->dbus_connection,
+ E_HTML_EDITOR_WEB_EXTENSION_SERVICE_NAME,
+ E_HTML_EDITOR_WEB_EXTENSION_OBJECT_PATH,
+ "org.freedesktop.DBus.Properties",
+ "Set",
+ g_variant_new (
+ "(ssv)",
+ E_HTML_EDITOR_WEB_EXTENSION_INTERFACE,
+ name,
+ g_variant_new_boolean (value)),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ NULL,
+ NULL);
+ }
}
void
@@ -2980,17 +3439,29 @@ e_html_editor_web_extension_get_underline (EHTMLEditorWebExtension *extension)
}
gboolean
+e_html_editor_web_extension_get_monospaced (EHTMLEditorWebExtension *extension)
+{
+ return extension->priv->monospaced;
+}
+
+gboolean
e_html_editor_web_extension_get_strikethrough (EHTMLEditorWebExtension *extension)
{
return extension->priv->strikethrough;
}
-gint
+guint
e_html_editor_web_extension_get_font_size (EHTMLEditorWebExtension *extension)
{
return extension->priv->font_size;
}
+const gchar *
+e_html_editor_web_extension_get_font_color (EHTMLEditorWebExtension *extension)
+{
+ return extension->priv->font_color;
+}
+
EHTMLEditorSelectionAlignment
e_html_editor_web_extension_get_alignment (EHTMLEditorWebExtension *extension)
{
@@ -3113,7 +3584,7 @@ e_html_editor_web_extension_add_new_inline_image_into_list (EHTMLEditorWebExtens
const gchar *cid_src,
const gchar *src)
{
- g_hash_table_insert (extension->priv->inline_images, g_strdup(cid_src), g_strdup(src));
+ g_hash_table_insert (extension->priv->inline_images, g_strdup (cid_src), g_strdup (src));
}
gboolean
@@ -3180,3 +3651,15 @@ e_html_editor_web_extension_set_spell_check_on_scroll_event_source_id (EHTMLEdit
{
extension->priv->spell_check_on_scroll_event_source_id = value;
}
+
+void
+e_html_editor_web_extension_block_selection_changed_callback (EHTMLEditorWebExtension *extension)
+{
+ g_signal_handlers_block_by_func (extension, web_editor_selection_changed_cb, NULL);
+}
+
+void
+e_html_editor_web_extension_unblock_selection_changed_callback (EHTMLEditorWebExtension *extension)
+{
+ g_signal_handlers_unblock_by_func (extension, web_editor_selection_changed_cb, NULL);
+}
diff --git a/web-extensions/e-html-editor-web-extension.h
b/web-extensions/composer/e-html-editor-web-extension.h
similarity index 89%
rename from web-extensions/e-html-editor-web-extension.h
rename to web-extensions/composer/e-html-editor-web-extension.h
index b12da67..ff38c9f 100644
--- a/web-extensions/e-html-editor-web-extension.h
+++ b/web-extensions/composer/e-html-editor-web-extension.h
@@ -80,6 +80,18 @@ void e_html_editor_web_extension_dbus_register
(EHTMLEditorWebExtension *extension,
GDBusConnection *connection);
+void set_dbus_property_string (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ const gchar *value);
+
+void set_dbus_property_take_string (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ gchar *value);
+
+void set_dbus_property_unsigned (EHTMLEditorWebExtension *extension,
+ const gchar *name,
+ guint32 value);
+
void set_dbus_property_boolean (EHTMLEditorWebExtension *extension,
const gchar *name,
gboolean value);
@@ -109,10 +121,16 @@ gboolean e_html_editor_web_extension_get_italic
gboolean e_html_editor_web_extension_get_underline
(EHTMLEditorWebExtension *extension);
+gboolean e_html_editor_web_extension_get_monospaced
+ (EHTMLEditorWebExtension *extension);
+
gboolean e_html_editor_web_extension_get_strikethrough
(EHTMLEditorWebExtension *extension);
-gint e_html_editor_web_extension_get_font_size
+guint e_html_editor_web_extension_get_font_size
+ (EHTMLEditorWebExtension *extension);
+
+const gchar * e_html_editor_web_extension_get_font_color
(EHTMLEditorWebExtension *extension);
EHTMLEditorSelectionAlignment
@@ -213,4 +231,12 @@ e_html_editor_web_extension_set_spell_check_on_scroll_event_source_id
(EHTMLEditorWebExtension *extension,
guint value);
+void
+e_html_editor_web_extension_block_selection_changed_callback
+ (EHTMLEditorWebExtension *web_extension);
+
+void
+e_html_editor_web_extension_unblock_selection_changed_callback
+ (EHTMLEditorWebExtension *web_extension);
+
#endif /* E_HTML_EDITOR_WEB_EXTENSION_H */
diff --git a/web-extensions/e-msg-composer-dom-functions.c
b/web-extensions/composer/e-msg-composer-dom-functions.c
similarity index 100%
rename from web-extensions/e-msg-composer-dom-functions.c
rename to web-extensions/composer/e-msg-composer-dom-functions.c
diff --git a/web-extensions/e-msg-composer-dom-functions.h
b/web-extensions/composer/e-msg-composer-dom-functions.h
similarity index 100%
rename from web-extensions/e-msg-composer-dom-functions.h
rename to web-extensions/composer/e-msg-composer-dom-functions.h
diff --git a/web-extensions/e-dom-utils.c b/web-extensions/e-dom-utils.c
index e96aa00..ddef6b2 100644
--- a/web-extensions/e-dom-utils.c
+++ b/web-extensions/e-dom-utils.c
@@ -24,6 +24,7 @@
#include <webkitdom/WebKitDOMHTMLElementUnstable.h>
#include "e-web-extension.h"
+#include "e-web-extension-names.h"
#include <e-util/e-util-enums.h>
#include <e-util/e-misc-utils.h>
@@ -94,29 +95,61 @@ e_dom_utils_replace_local_image_links (WebKitDOMDocument *document)
}
}
-static gboolean
-document_has_selection (WebKitDOMDocument *document)
+gboolean
+e_dom_utils_document_has_selection (WebKitDOMDocument *document)
{
- WebKitDOMDOMWindow *dom_window;
- WebKitDOMDOMSelection *dom_selection;
+ gboolean ret_val = FALSE;
+ WebKitDOMDOMWindow *dom_window = NULL;
+ WebKitDOMDOMSelection *dom_selection = NULL;
+
+ if (!document)
+ return FALSE;
dom_window = webkit_dom_document_get_default_view (document);
if (!dom_window)
- return FALSE;
+ goto out;
dom_selection = webkit_dom_dom_window_get_selection (dom_window);
if (!WEBKIT_DOM_IS_DOM_SELECTION (dom_selection))
- return FALSE;
-
- if (webkit_dom_dom_selection_get_range_count (dom_selection) == 0)
- return FALSE;
+ goto out;
if (webkit_dom_dom_selection_get_is_collapsed (dom_selection))
- return FALSE;
+ goto out;
- return TRUE;
+ ret_val = TRUE;
+ out:
+ g_clear_object (&dom_window);
+ g_clear_object (&dom_selection);
+
+ if (!ret_val) {
+ WebKitDOMNodeList *frames;
+ gulong ii, length;
+
+ frames = webkit_dom_document_get_elements_by_tag_name (document, "iframe");
+ length = webkit_dom_node_list_get_length (frames);
+ for (ii = 0; ii < length; ii++) {
+ WebKitDOMNode *node;
+ WebKitDOMDocument *content_document;
+
+ node = webkit_dom_node_list_item (frames, ii);
+ content_document = webkit_dom_html_iframe_element_get_content_document (
+ WEBKIT_DOM_HTML_IFRAME_ELEMENT (node));
+
+ if ((ret_val = e_dom_utils_document_has_selection (content_document))) {
+ g_object_unref (node);
+ break;
+ }
+
+ g_object_unref (node);
+ }
+
+ g_object_unref (frames);
+ }
+
+ return ret_val;
}
+
gchar *
e_dom_utils_get_document_content_html (WebKitDOMDocument *document)
{
@@ -232,7 +265,7 @@ e_dom_utils_get_selection_content_html (WebKitDOMDocument *document)
WebKitDOMNodeList *frames;
gulong ii, length;
- if (!document_has_selection (document))
+ if (!e_dom_utils_document_has_selection (document))
return NULL;
frames = webkit_dom_document_get_elements_by_tag_name (document, "IFRAME");
@@ -752,13 +785,13 @@ element_focus_cb (WebKitDOMElement *element,
{
g_dbus_connection_call (
connection,
- "org.gnome.Evolution.WebExtension",
- "/org/gnome/Evolution/WebExtension",
- "org.freedesktop.DBus.Properties",
+ E_WEB_EXTENSION_SERVICE_NAME,
+ E_WEB_EXTENSION_OBJECT_PATH,
+ E_WEB_EXTENSION_INTERFACE,
"Set",
g_variant_new (
"(ssv)",
- "org.gnome.Evolution.WebExtension",
+ E_WEB_EXTENSION_INTERFACE,
"NeedInput",
g_variant_new_boolean (TRUE)),
NULL,
@@ -777,13 +810,13 @@ element_blur_cb (WebKitDOMElement *element,
{
g_dbus_connection_call (
connection,
- "org.gnome.Evolution.WebExtension",
- "/org/gnome/Evolution/WebExtension",
- "org.freedesktop.DBus.Properties",
+ E_WEB_EXTENSION_SERVICE_NAME,
+ E_WEB_EXTENSION_OBJECT_PATH,
+ E_WEB_EXTENSION_INTERFACE,
"Set",
g_variant_new (
"(ssv)",
- "org.gnome.Evolution.WebExtension",
+ E_WEB_EXTENSION_INTERFACE,
"NeedInput",
g_variant_new_boolean (FALSE)),
NULL,
@@ -1360,27 +1393,27 @@ WebKitDOMElement *
dom_node_find_parent_element (WebKitDOMNode *node,
const gchar *tagname)
{
+ WebKitDOMNode *tmp_node = node;
gint taglen = strlen (tagname);
- while (node) {
-
- if (WEBKIT_DOM_IS_ELEMENT (node)) {
+ while (tmp_node) {
+ if (WEBKIT_DOM_IS_ELEMENT (tmp_node)) {
gchar *node_tagname;
node_tagname = webkit_dom_element_get_tag_name (
- WEBKIT_DOM_ELEMENT (node));
+ WEBKIT_DOM_ELEMENT (tmp_node));
if (node_tagname &&
(strlen (node_tagname) == taglen) &&
(g_ascii_strncasecmp (node_tagname, tagname, taglen) == 0)) {
g_free (node_tagname);
- return WEBKIT_DOM_ELEMENT (node);
+ return WEBKIT_DOM_ELEMENT (tmp_node);
}
g_free (node_tagname);
}
- node = WEBKIT_DOM_NODE (webkit_dom_node_get_parent_element (node));
+ tmp_node = webkit_dom_node_get_parent_node (tmp_node);
}
return NULL;
@@ -1448,13 +1481,13 @@ element_has_id (WebKitDOMElement *element,
element_id = webkit_dom_element_get_id (element);
- if (g_ascii_strcasecmp (element_id, id) != 0) {
+ if (element_id && g_ascii_strcasecmp (element_id, id) == 0) {
g_free (element_id);
- return FALSE;
+ return TRUE;
}
g_free (element_id);
- return TRUE;
+ return FALSE;
}
gboolean
@@ -1491,7 +1524,7 @@ element_has_class (WebKitDOMElement *element,
element_class = webkit_dom_element_get_class_name (element);
- if (g_strstr_len (element_class, -1, class)) {
+ if (element_class && g_strstr_len (element_class, -1, class)) {
g_free (element_class);
return TRUE;
}
@@ -1515,7 +1548,7 @@ element_add_class (WebKitDOMElement *element,
element_class = webkit_dom_element_get_class_name (element);
- if (g_strcmp0 (element_class, "") == 0)
+ if (!element_class)
new_class = g_strdup (class);
else
new_class = g_strconcat (element_class, " ", class, NULL);
diff --git a/web-extensions/e-dom-utils.h b/web-extensions/e-dom-utils.h
index 912223b..94b0140 100644
--- a/web-extensions/e-dom-utils.h
+++ b/web-extensions/e-dom-utils.h
@@ -27,6 +27,8 @@ G_BEGIN_DECLS
void e_dom_utils_replace_local_image_links
(WebKitDOMDocument *document);
+gboolean e_dom_utils_document_has_selection
+ (WebKitDOMDocument *document);
gchar * e_dom_utils_get_document_content_html
(WebKitDOMDocument *document);
gchar * e_dom_utils_get_selection_content_html
diff --git a/web-extensions/e-web-extension-main.c b/web-extensions/e-web-extension-main.c
index b6fb88b..ac9a270 100644
--- a/web-extensions/e-web-extension-main.c
+++ b/web-extensions/e-web-extension-main.c
@@ -37,6 +37,7 @@ webkit_web_extension_initialize (WebKitWebExtension *wk_extension)
{
EWebExtension *extension;
+ printf ("%s\n", __FUNCTION__);
extension = e_web_extension_get ();
e_web_extension_initialize (extension, wk_extension);
diff --git a/web-extensions/e-web-extension.c b/web-extensions/e-web-extension.c
index 08545f5..c13bbd5 100644
--- a/web-extensions/e-web-extension.c
+++ b/web-extensions/e-web-extension.c
@@ -52,13 +52,17 @@ static CamelDataCache *emd_global_http_cache = NULL;
static const char introspection_xml[] =
"<node>"
-" <interface name='org.gnome.Evolution.WebExtension'>"
+" <interface name='"E_WEB_EXTENSION_INTERFACE"'>"
" <signal name='HeadersCollapsed'>"
" <arg type='b' name='expanded' direction='out'/>"
" </signal>"
" <method name='ReplaceLocalImageLinks'>"
" <arg type='t' name='page_id' direction='in'/>"
" </method>"
+" <method name='DocumentHasSelection'>"
+" <arg type='t' name='page_id' direction='in'/>"
+" <arg type='b' name='has_selection' direction='out'/>"
+" </method>"
" <method name='GetDocumentContentHTML'>"
" <arg type='t' name='page_id' direction='in'/>"
" <arg type='s' name='html_content' direction='out'/>"
@@ -162,6 +166,7 @@ handle_method_call (GDBusConnection *connection,
if (g_strcmp0 (interface_name, E_WEB_EXTENSION_INTERFACE) != 0)
return;
+ printf ("EWebExtension - %s - %s\n", __FUNCTION__, method_name);
if (g_strcmp0 (method_name, "ReplaceLocalImageLinks") == 0) {
g_variant_get (parameters, "(t)", &page_id);
web_page = get_webkit_web_page_or_return_dbus_error (
@@ -173,6 +178,20 @@ handle_method_call (GDBusConnection *connection,
e_dom_utils_replace_local_image_links (document);
g_dbus_method_invocation_return_value (invocation, NULL);
+ } else if (g_strcmp0 (method_name, "DocumentHasSelection") == 0) {
+ gboolean has_selection;
+
+ g_variant_get (parameters, "(t)", &page_id);
+ web_page = get_webkit_web_page_or_return_dbus_error (
+ invocation, web_extension, page_id);
+ if (!web_page)
+ return;
+
+ document = webkit_web_page_get_dom_document (web_page);
+ has_selection = e_dom_utils_document_has_selection (document);
+
+ g_dbus_method_invocation_return_value (
+ invocation, g_variant_new ("(b)", has_selection));
} else if (g_strcmp0 (method_name, "GetDocumentContentHTML") == 0) {
gchar *html_content;
@@ -186,7 +205,11 @@ handle_method_call (GDBusConnection *connection,
html_content = e_dom_utils_get_document_content_html (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (html_content));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ html_content ? html_content : g_strdup (""))));
} else if (g_strcmp0 (method_name, "GetSelectionContentHTML") == 0) {
gchar *html_content;
@@ -200,7 +223,11 @@ handle_method_call (GDBusConnection *connection,
html_content = e_dom_utils_get_selection_content_html (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (html_content));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ html_content ? html_content : g_strdup (""))));
} else if (g_strcmp0 (method_name, "GetSelectionContentText") == 0) {
gchar *text_content;
@@ -211,7 +238,7 @@ handle_method_call (GDBusConnection *connection,
return;
document = webkit_web_page_get_dom_document (web_page);
- text_content = e_dom_utils_get_selection_content_html (document);
+ text_content = e_dom_utils_get_selection_content_text (document);
g_dbus_method_invocation_return_value (
invocation, g_variant_new_take_string (text_content));
@@ -296,7 +323,11 @@ handle_method_call (GDBusConnection *connection,
element_name = e_dom_utils_get_active_element_name (document);
g_dbus_method_invocation_return_value (
- invocation, g_variant_new_take_string (element_name));
+ invocation,
+ g_variant_new (
+ "(@s)",
+ g_variant_new_take_string (
+ element_name ? element_name : g_strdup (""))));
} else if (g_strcmp0 (method_name, "EMailPartHeadersBindDOMElement") == 0) {
const gchar *element_id;
@@ -630,7 +661,6 @@ static void
web_page_document_loaded_cb (WebKitWebPage *web_page,
gpointer user_data)
{
-
}
static void
diff --git a/web-extensions/e-web-extension.h b/web-extensions/e-web-extension.h
index d54ea96..a1f5837 100644
--- a/web-extensions/e-web-extension.h
+++ b/web-extensions/e-web-extension.h
@@ -41,10 +41,6 @@
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_WEB_EXTENSION, EWebExtensionClass))
-#define E_WEB_EXTENSION_SERVICE_NAME "org.gnome.Evolution.WebExtension"
-#define E_WEB_EXTENSION_OBJECT_PATH "/org/gnome/Evolution/WebExtension"
-#define E_WEB_EXTENSION_INTERFACE "org.gnome.Evolution.WebExtension"
-
G_BEGIN_DECLS
typedef struct _EWebExtension EWebExtension;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]