[evolution/wip/mcrha/webkit-jsc-api] Adapt ITip Formatter and finally remove D-Bus proxy from EWebView
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/mcrha/webkit-jsc-api] Adapt ITip Formatter and finally remove D-Bus proxy from EWebView
- Date: Tue, 8 Oct 2019 11:58:25 +0000 (UTC)
commit 860cef9b6e10b2b1490a9c02f7aa5452d6ef1710
Author: Milan Crha <mcrha redhat com>
Date: Tue Oct 8 13:57:09 2019 +0200
Adapt ITip Formatter and finally remove D-Bus proxy from EWebView
src/e-util/e-web-view-jsc-utils.c | 54 +-
src/e-util/e-web-view-jsc-utils.h | 14 +-
src/e-util/e-web-view.c | 102 +-
src/e-util/e-web-view.h | 2 -
src/mail/e-mail-display.c | 2 -
src/modules/itip-formatter/e-mail-part-itip.c | 18 +-
src/modules/itip-formatter/itip-view.c | 911 +++------
src/modules/itip-formatter/itip-view.h | 4 +-
src/web-extensions/CMakeLists.txt | 7 +-
src/web-extensions/e-dom-utils.c | 164 --
src/web-extensions/e-dom-utils.h | 14 -
src/web-extensions/e-itip-formatter-dom-utils.c | 649 ------
src/web-extensions/e-itip-formatter-dom-utils.h | 111 -
src/web-extensions/e-web-extension-main.c | 37 -
src/web-extensions/e-web-extension-names.h | 25 -
src/web-extensions/e-web-extension.c | 2129 +-------------------
src/web-extensions/e-web-extension.h | 5 -
.../{ext-utils.js => evolution-utils.js} | 369 +++-
.../evolution-web-process-extension.gresource.xml | 2 +-
19 files changed, 792 insertions(+), 3827 deletions(-)
---
diff --git a/src/e-util/e-web-view-jsc-utils.c b/src/e-util/e-web-view-jsc-utils.c
index 8e6f33e335..ccdd8c84ff 100644
--- a/src/e-util/e-web-view-jsc-utils.c
+++ b/src/e-util/e-web-view-jsc-utils.c
@@ -125,23 +125,55 @@ e_web_view_jsc_printf_script (const gchar *script_format,
g_return_val_if_fail (script_format != NULL, NULL);
va_start (va, script_format);
- script = e_web_view_jsc_printf_scriptv (script_format, va);
+ script = e_web_view_jsc_vprintf_script (script_format, va);
va_end (va);
return script;
}
gchar *
-e_web_view_jsc_printf_scriptv (const gchar *script_format,
+e_web_view_jsc_vprintf_script (const gchar *script_format,
va_list va)
{
GString *script;
- const gchar *ptr;
g_return_val_if_fail (script_format != NULL, NULL);
script = g_string_sized_new (128);
+ e_web_view_jsc_vprintf_script_gstring (script, script_format, va);
+
+ return g_string_free (script, FALSE);
+}
+
+void
+e_web_view_jsc_printf_script_gstring (GString *script,
+ const gchar *script_format,
+ ...)
+{
+ va_list va;
+
+ g_return_if_fail (script != NULL);
+ g_return_if_fail (script_format != NULL);
+
+ va_start (va, script_format);
+ e_web_view_jsc_vprintf_script_gstring (script, script_format, va);
+ va_end (va);
+}
+
+void
+e_web_view_jsc_vprintf_script_gstring (GString *script,
+ const gchar *script_format,
+ va_list va)
+{
+ const gchar *ptr;
+
+ g_return_if_fail (script != NULL);
+ g_return_if_fail (script_format != NULL);
+
+ if (script->len)
+ g_string_append_c (script, '\n');
+
for (ptr = script_format; *ptr; ptr++) {
if (*ptr == '\\') {
g_warn_if_fail (ptr[1]);
@@ -218,8 +250,6 @@ e_web_view_jsc_printf_scriptv (const gchar *script_format,
g_string_append_c (script, *ptr);
}
}
-
- return g_string_free (script, FALSE);
}
static void
@@ -271,9 +301,21 @@ e_web_view_jsc_run_script (WebKitWebView *web_view,
g_return_if_fail (script_format != NULL);
va_start (va, script_format);
- script = e_web_view_jsc_printf_scriptv (script_format, va);
+ script = e_web_view_jsc_vprintf_script (script_format, va);
va_end (va);
+ e_web_view_jsc_run_script_take (web_view, script, cancellable);
+}
+
+/* Assumes ownership of the 'script' variable and frees is with g_free(), when no longe needed. */
+void
+e_web_view_jsc_run_script_take (WebKitWebView *web_view,
+ gchar *script,
+ GCancellable *cancellable)
+{
+ g_return_if_fail (WEBKIT_IS_WEB_VIEW (web_view));
+ g_return_if_fail (script != NULL);
+
webkit_web_view_run_javascript (web_view, script, cancellable, ewv_jsc_call_done_cb, script);
}
diff --git a/src/e-util/e-web-view-jsc-utils.h b/src/e-util/e-web-view-jsc-utils.h
index 8abb21bf46..8968e0bfb7 100644
--- a/src/e-util/e-web-view-jsc-utils.h
+++ b/src/e-util/e-web-view-jsc-utils.h
@@ -45,13 +45,23 @@ gchar * e_web_view_jsc_get_object_property_string
gchar * e_web_view_jsc_printf_script (const gchar *script_format,
...) G_GNUC_PRINTF (1, 2);
-gchar * e_web_view_jsc_printf_scriptv (const gchar *script_format,
+gchar * e_web_view_jsc_vprintf_script (const gchar *script_format,
+ va_list va);
+void e_web_view_jsc_printf_script_gstring
+ (GString *script,
+ const gchar *script_format,
+ ...) G_GNUC_PRINTF (2, 3);
+void e_web_view_jsc_vprintf_script_gstring
+ (GString *script,
+ const gchar *script_format,
va_list va);
void e_web_view_jsc_run_script (WebKitWebView *web_view,
GCancellable *cancellable,
const gchar *script_format,
...) G_GNUC_PRINTF (3, 4);
-
+void e_web_view_jsc_run_script_take (WebKitWebView *web_view,
+ gchar *script,
+ GCancellable *cancellable);
void e_web_view_jsc_set_element_hidden
(WebKitWebView *web_view,
const gchar *iframe_id,
diff --git a/src/e-util/e-web-view.c b/src/e-util/e-web-view.c
index 122e08e717..411a566c2d 100644
--- a/src/e-util/e-web-view.c
+++ b/src/e-util/e-web-view.c
@@ -41,16 +41,12 @@
#include "e-web-extension-container.h"
#include "e-web-view-jsc-utils.h"
-#include "web-extensions/e-web-extension-names.h"
-
#include "e-web-view.h"
#define E_WEB_VIEW_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
((obj), E_TYPE_WEB_VIEW, EWebViewPrivate))
-static void e_web_view_set_web_extension_proxy (EWebView *web_view, GDBusProxy *proxy);
-
typedef struct _AsyncContext AsyncContext;
typedef struct _ElementClickedData {
@@ -84,10 +80,6 @@ struct _EWebViewPrivate {
GHashTable *old_settings;
- EWebExtensionContainer *container;
- GDBusProxy *web_extension_proxy;
- gint stamp; /* Changed only in the main thread, doesn't need locking */
-
WebKitFindController *find_controller;
gulong found_text_handler_id;
gulong failed_to_find_text_handler_id;
@@ -130,8 +122,7 @@ enum {
PROP_PASTE_TARGET_LIST,
PROP_PRINT_PROXY,
PROP_SAVE_AS_PROXY,
- PROP_SELECTED_URI,
- PROP_WEB_EXTENSION_PROXY
+ PROP_SELECTED_URI
};
enum {
@@ -217,19 +208,6 @@ action_copy_clipboard_cb (GtkAction *action,
e_web_view_copy_clipboard (web_view);
}
-static gint
-e_web_view_assign_new_stamp (EWebView *web_view)
-{
- g_return_val_if_fail (E_IS_WEB_VIEW (web_view), 0);
-
- if (web_view->priv->stamp)
- e_web_extension_container_forget_stamp (web_view->priv->container, web_view->priv->stamp);
-
- web_view->priv->stamp = e_web_extension_container_reserve_stamp (web_view->priv->container);
-
- return web_view->priv->stamp;
-}
-
static void
e_web_view_search_web_get_selection_cb (GObject *source,
GAsyncResult *result,
@@ -245,7 +223,7 @@ e_web_view_search_web_get_selection_cb (GObject *source,
if (local_error &&
!g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
e_alert_submit (E_ALERT_SINK (source), "widgets:get-selected-text-failed",
local_error->message, NULL);
- } else if (!texts) {
+ } else if (texts) {
GSettings *settings;
gchar *text = texts->data;
gchar *uri_prefix;
@@ -1083,12 +1061,6 @@ web_view_get_property (GObject *object,
value, e_web_view_get_selected_uri (
E_WEB_VIEW (object)));
return;
-
- case PROP_WEB_EXTENSION_PROXY:
- g_value_set_object (
- value, e_web_view_get_web_extension_proxy (
- E_WEB_VIEW (object)));
- return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1149,18 +1121,12 @@ web_view_dispose (GObject *object)
g_slist_free_full (priv->content_requests, g_object_unref);
priv->content_requests = NULL;
- e_web_view_set_web_extension_proxy (E_WEB_VIEW (object), NULL);
-
- if (priv->container && priv->stamp)
- e_web_extension_container_forget_stamp (priv->container, priv->stamp);
-
g_clear_object (&priv->ui_manager);
g_clear_object (&priv->open_proxy);
g_clear_object (&priv->print_proxy);
g_clear_object (&priv->save_as_proxy);
g_clear_object (&priv->aliasing_settings);
g_clear_object (&priv->font_settings);
- g_clear_object (&priv->container);
/* Chain up to parent's dispose() method. */
G_OBJECT_CLASS (e_web_view_parent_class)->dispose (object);
@@ -1348,13 +1314,8 @@ e_web_view_initialize_web_extensions_cb (WebKitWebContext *web_context,
EWebView *web_view = user_data;
g_return_if_fail (E_IS_WEB_VIEW (web_view));
- g_return_if_fail (web_view->priv->container);
webkit_web_context_set_web_extensions_directory (web_context, EVOLUTION_WEB_EXTENSIONS_DIR);
- webkit_web_context_set_web_extensions_initialization_user_data (web_context,
- g_variant_new ("(ss)",
- e_web_extension_container_get_server_guid (web_view->priv->container),
- e_web_extension_container_get_server_address (web_view->priv->container)));
}
static void
@@ -1778,40 +1739,25 @@ static void
web_view_load_string (EWebView *web_view,
const gchar *string)
{
- gchar *uri_with_stamp;
-
- uri_with_stamp = g_strdup_printf ("evo-file:///?evo-stamp=%d", e_web_view_assign_new_stamp
(web_view));
-
if (!string || !*string) {
- webkit_web_view_load_html (WEBKIT_WEB_VIEW (web_view), "", uri_with_stamp);
+ webkit_web_view_load_html (WEBKIT_WEB_VIEW (web_view), "", "evo-file:///");
} else {
GBytes *bytes;
bytes = g_bytes_new (string, strlen (string));
- webkit_web_view_load_bytes (WEBKIT_WEB_VIEW (web_view), bytes, NULL, NULL, uri_with_stamp);
+ webkit_web_view_load_bytes (WEBKIT_WEB_VIEW (web_view), bytes, NULL, NULL, "evo-file:///");
g_bytes_unref (bytes);
}
-
- g_free (uri_with_stamp);
}
static void
web_view_load_uri (EWebView *web_view,
const gchar *uri)
{
- gchar *uri_with_stamp;
-
- if (uri == NULL)
+ if (!uri)
uri = "about:blank";
- if (strchr (uri, '?'))
- uri_with_stamp = g_strdup_printf ("%s&evo-stamp=%d", uri, e_web_view_assign_new_stamp
(web_view));
- else
- uri_with_stamp = g_strdup_printf ("%s?evo-stamp=%d", uri, e_web_view_assign_new_stamp
(web_view));
-
- webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), uri_with_stamp);
-
- g_free (uri_with_stamp);
+ webkit_web_view_load_uri (WEBKIT_WEB_VIEW (web_view), uri);
}
static gchar *
@@ -1859,31 +1805,6 @@ web_view_stop_loading (EWebView *web_view)
webkit_web_view_stop_loading (WEBKIT_WEB_VIEW (web_view));
}
-static void
-e_web_view_set_web_extension_proxy (EWebView *web_view,
- GDBusProxy *proxy)
-{
- g_return_if_fail (E_IS_WEB_VIEW (web_view));
-
- if (web_view->priv->web_extension_proxy == proxy)
- return;
-
- g_clear_object (&web_view->priv->web_extension_proxy);
-
- if (proxy)
- web_view->priv->web_extension_proxy = g_object_ref (proxy);
-
- g_object_notify (G_OBJECT (web_view), "web-extension-proxy");
-}
-
-GDBusProxy *
-e_web_view_get_web_extension_proxy (EWebView *web_view)
-{
- g_return_val_if_fail (E_IS_WEB_VIEW (web_view), NULL);
-
- return web_view->priv->web_extension_proxy;
-}
-
static void
web_view_update_actions (EWebView *web_view)
{
@@ -2387,16 +2308,6 @@ e_web_view_class_init (EWebViewClass *class)
NULL,
G_PARAM_READWRITE));
- g_object_class_install_property (
- object_class,
- PROP_WEB_EXTENSION_PROXY,
- g_param_spec_object (
- "web-extension-proxy",
- "Web Extension Proxy",
- NULL,
- G_TYPE_DBUS_PROXY,
- G_PARAM_READABLE));
-
signals[NEW_ACTIVITY] = g_signal_new (
"new-activity",
G_TYPE_FROM_CLASS (class),
@@ -2514,7 +2425,6 @@ e_web_view_init (EWebView *web_view)
web_view->priv = E_WEB_VIEW_GET_PRIVATE (web_view);
- web_view->priv->container = e_web_extension_container_new (E_WEB_EXTENSION_OBJECT_PATH,
E_WEB_EXTENSION_INTERFACE);
web_view->priv->old_settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free,
(GDestroyNotify) g_variant_unref);
g_signal_connect (
diff --git a/src/e-util/e-web-view.h b/src/e-util/e-web-view.h
index 6e7dcff02d..8f403df411 100644
--- a/src/e-util/e-web-view.h
+++ b/src/e-util/e-web-view.h
@@ -146,8 +146,6 @@ void e_web_view_load_uri (EWebView *web_view,
gchar * e_web_view_suggest_filename (EWebView *web_view,
const gchar *uri);
void e_web_view_reload (EWebView *web_view);
-GDBusProxy * e_web_view_get_web_extension_proxy
- (EWebView *web_view);
gboolean e_web_view_get_caret_mode (EWebView *web_view);
void e_web_view_set_caret_mode (EWebView *web_view,
gboolean caret_mode);
diff --git a/src/mail/e-mail-display.c b/src/mail/e-mail-display.c
index 11f85b317e..c343f32ddd 100644
--- a/src/mail/e-mail-display.c
+++ b/src/mail/e-mail-display.c
@@ -44,8 +44,6 @@
#include "em-composer-utils.h"
#include "em-utils.h"
-#include "web-extensions/e-web-extension-names.h"
-
#include "e-mail-display.h"
#define d(x)
diff --git a/src/modules/itip-formatter/e-mail-part-itip.c b/src/modules/itip-formatter/e-mail-part-itip.c
index 66007594bb..eabdbd7621 100644
--- a/src/modules/itip-formatter/e-mail-part-itip.c
+++ b/src/modules/itip-formatter/e-mail-part-itip.c
@@ -74,7 +74,6 @@ mail_part_itip_content_loaded (EMailPart *part,
EWebView *web_view)
{
EMailPartItip *pitip;
- ItipView *itip_view;
g_return_if_fail (E_IS_MAIL_PART_ITIP (part));
g_return_if_fail (E_IS_WEB_VIEW (web_view));
@@ -82,6 +81,23 @@ mail_part_itip_content_loaded (EMailPart *part,
pitip = E_MAIL_PART_ITIP (part);
if (pitip->folder && pitip->message_uid && pitip->message) {
+ ItipView *itip_view;
+ GSList *link;
+
+ for (link = pitip->priv->views; link; link = g_slist_next (link)) {
+ EWebView *used_web_view;
+
+ itip_view = link->data;
+ used_web_view = itip_view_ref_web_view (itip_view);
+
+ if (used_web_view == web_view) {
+ g_clear_object (&used_web_view);
+ return;
+ }
+
+ g_clear_object (&used_web_view);
+ }
+
itip_view = itip_view_new (
e_mail_part_get_id (part),
pitip,
diff --git a/src/modules/itip-formatter/itip-view.c b/src/modules/itip-formatter/itip-view.c
index 3d9c32cd09..66ecb63ddc 100644
--- a/src/modules/itip-formatter/itip-view.c
+++ b/src/modules/itip-formatter/itip-view.c
@@ -32,8 +32,6 @@
#include "calendar/gui/comp-util.h"
#include "calendar/gui/itip-utils.h"
-#include "web-extensions/e-web-extension-names.h"
-
#include <mail/em-config.h>
#include <mail/em-utils.h>
#include <em-format/e-mail-formatter-utils.h>
@@ -110,11 +108,8 @@ struct _ItipViewPrivate {
gpointer itip_part_ptr; /* not referenced, only for a "reference" to which part this belongs */
- GDBusConnection *dbus_connection;
- guint web_extension_source_changed_cb_signal_id;
- guint web_extension_recur_toggled_signal_id;
-
gchar *part_id;
+ gchar *selected_source_uid;
gchar *error;
GWeakRef *web_view_weakref;
@@ -183,6 +178,15 @@ struct _ItipViewPrivate {
guint update_item_error_info_id;
ItipViewResponse update_item_response;
GHashTable *real_comps; /* ESource's UID -> ECalComponent stored on the server */
+
+ gchar *state_rsvp_comment;
+ gboolean state_rsvp_check;
+ gboolean state_update_check;
+ gboolean state_recur_check;
+ gboolean state_free_time_check;
+ gboolean state_keep_alarm_check;
+ gboolean state_inherit_alarm_check;
+ gint state_response_id;
};
enum {
@@ -199,27 +203,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-static GDBusProxy *
-itip_view_ref_web_extension_proxy (ItipView *view)
-{
- EWebView *web_view;
- GDBusProxy *proxy = NULL;
-
- g_return_val_if_fail (ITIP_IS_VIEW (view), NULL);
-
- web_view = g_weak_ref_get (view->priv->web_view_weakref);
- if (!web_view)
- return NULL;
-
- proxy = e_web_view_get_web_extension_proxy (web_view);
- if (proxy)
- g_object_ref (proxy);
-
- g_object_unref (web_view);
-
- return proxy;
-}
-
static void
format_date_and_time_x (struct tm *date_tm,
struct tm *current_tm,
@@ -663,60 +646,19 @@ set_journal_sender_text (ItipView *view)
return sender;
}
-static guint64
-itip_view_get_page_id (ItipView *view)
-{
- EWebView *web_view;
- guint64 page_id = 0;
-
- web_view = g_weak_ref_get (view->priv->web_view_weakref);
- if (web_view) {
- page_id = webkit_web_view_get_page_id (WEBKIT_WEB_VIEW (web_view));
- g_object_unref (web_view);
- }
-
- return page_id;
-}
-
static void
enable_button (ItipView *view,
const gchar *button_id,
gboolean enable)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipEnableButton",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id, button_id,
enable),
- NULL);
-
- g_object_unref (proxy);
-}
-
-static void
-show_button (ItipView *view,
- const gchar *id)
-{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipShowButton",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, id),
- NULL);
+ EWebView *web_view;
- g_object_unref (proxy);
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_set_element_disabled (WEBKIT_WEB_VIEW (web_view), view->priv->part_id,
button_id, !enable,
+ e_web_view_get_cancellable (web_view));
+ g_object_unref (web_view);
+ }
}
static void
@@ -724,72 +666,32 @@ hide_element (ItipView *view,
const gchar *element_id,
gboolean hide)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipHideElement",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id, element_id, hide),
- NULL);
-
- g_object_unref (proxy);
-}
-
-static gboolean
-element_is_hidden (ItipView *view,
- const gchar *element_id)
-{
- GVariant *result;
- gboolean hidden;
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return FALSE;
-
- result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
- proxy,
- "ItipElementIsHidden",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id,
element_id),
- NULL);
+ EWebView *web_view;
- if (result) {
- g_variant_get (result, "(b)", &hidden);
- g_variant_unref (result);
- g_object_unref (proxy);
- return hidden;
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_set_element_hidden (WEBKIT_WEB_VIEW (web_view), view->priv->part_id,
element_id, hide,
+ e_web_view_get_cancellable (web_view));
+ g_object_unref (web_view);
}
-
- g_object_unref (proxy);
-
- return FALSE;
}
+#define show_button(_view, _id) hide_element(_view, _id, FALSE)
+
static void
set_inner_html (ItipView *view,
const gchar *element_id,
const gchar *inner_html)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipElementSetInnerHTML",
- g_variant_new ("(tsss)", itip_view_get_page_id (view), view->priv->part_id, element_id,
inner_html),
- NULL);
+ EWebView *web_view;
- g_object_unref (proxy);
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetElementInnerHTML(%s, %s, %s);",
+ view->priv->part_id, element_id, inner_html);
+ g_object_unref (web_view);
+ }
}
static void
@@ -797,73 +699,31 @@ input_set_checked (ItipView *view,
const gchar *input_id,
gboolean checked)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipInputSetChecked",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id, input_id,
checked),
- NULL);
-
- g_object_unref (proxy);
-}
-
-static gboolean
-input_is_checked (ItipView *view,
- const gchar *input_id)
-{
- GVariant *result;
- gboolean checked;
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return FALSE;
-
- result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
- proxy,
- "ItipInputIsChecked",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, input_id),
- NULL);
+ EWebView *web_view;
- if (result) {
- g_variant_get (result, "(b)", &checked);
- g_variant_unref (result);
- g_object_unref (proxy);
- return checked;
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_set_element_checked (WEBKIT_WEB_VIEW (web_view), view->priv->part_id,
input_id, checked,
+ e_web_view_get_cancellable (web_view));
+ g_object_unref (web_view);
}
-
- g_object_unref (proxy);
-
- return FALSE;
}
static void
show_checkbox (ItipView *view,
- const gchar *id,
+ const gchar *element_id,
gboolean show,
gboolean update_second)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipShowCheckbox",
- g_variant_new ("(tssbb)", itip_view_get_page_id (view), view->priv->part_id, id, show,
update_second),
- NULL);
+ EWebView *web_view;
- g_object_unref (proxy);
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetShowCheckbox(%s, %s, %x, %x);",
+ view->priv->part_id, element_id, show, update_second);
+ g_object_unref (web_view);
+ }
}
static void
@@ -871,20 +731,15 @@ set_area_text (ItipView *view,
const gchar *id,
const gchar *text)
{
- GDBusProxy *proxy;
-
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipSetAreaText",
- g_variant_new ("(tsss)", itip_view_get_page_id (view), view->priv->part_id, id, text ? text :
""),
- NULL);
+ EWebView *web_view;
- g_object_unref (proxy);
+ web_view = itip_view_ref_web_view (view);
+ if (web_view) {
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetAreaText(%s, %s, %s);",
+ view->priv->part_id, id, text);
+ g_object_unref (web_view);
+ }
}
static void
@@ -919,7 +774,7 @@ static void
update_start_end_times (ItipView *view)
{
ItipViewPrivate *priv;
- GDBusProxy *proxy;
+ EWebView *web_view;
gchar buffer[256];
time_t now;
struct tm *now_tm;
@@ -964,42 +819,92 @@ update_start_end_times (ItipView *view)
}
#undef is_same
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
if (priv->start_header && priv->start_label) {
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipUpdateTimes",
- g_variant_new (
- "(tssss)",
- itip_view_get_page_id (view),
- view->priv->part_id,
- TABLE_ROW_START_DATE,
- priv->start_header,
- priv->start_label),
- NULL);
- } else
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.UpdateTimes(%s, %s, %s, %s);",
+ view->priv->part_id,
+ TABLE_ROW_START_DATE,
+ priv->start_header,
+ priv->start_label);
+ } else {
hide_element (view, TABLE_ROW_START_DATE, TRUE);
+ }
if (priv->end_header && priv->end_label) {
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipUpdateTimes",
- g_variant_new (
- "(tssss)",
- itip_view_get_page_id (view),
- view->priv->part_id,
- TABLE_ROW_END_DATE,
- priv->end_header,
- priv->end_label),
- NULL);
- } else
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.UpdateTimes(%s, %s, %s, %s);",
+ view->priv->part_id,
+ TABLE_ROW_END_DATE,
+ priv->end_header,
+ priv->end_label);
+ } else {
hide_element (view, TABLE_ROW_END_DATE, TRUE);
+ }
+
+ g_object_unref (web_view);
+}
+
+static void
+itip_view_get_state_cb (GObject *source_object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ ItipView *view;
+ GWeakRef *wkrf = user_data;
+
+ g_return_if_fail (E_IS_WEB_VIEW (source_object));
+ g_return_if_fail (wkrf != NULL);
+
+ view = g_weak_ref_get (wkrf);
+ if (view) {
+ WebKitJavascriptResult *js_result;
+ GError *error = NULL;
+
+ g_clear_pointer (&view->priv->state_rsvp_comment, g_free);
+
+ js_result = webkit_web_view_run_javascript_finish (WEBKIT_WEB_VIEW (source_object), result,
&error);
+
+ if (error) {
+ if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) &&
+ (!g_error_matches (error, WEBKIT_JAVASCRIPT_ERROR,
WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED) ||
+ /* WebKit can return empty error message, thus ignore those. */
+ (error->message && *(error->message))))
+ g_warning ("Failed to call 'ItipView.GetState()' function: %s:%d: %s",
g_quark_to_string (error->domain), error->code, error->message);
+ g_clear_error (&error);
+ }
+
+ if (js_result) {
+ JSCException *exception;
+ JSCValue *value;
+
+ value = webkit_javascript_result_get_js_value (js_result);
+ exception = jsc_context_get_exception (jsc_value_get_context (value));
+
+ if (exception)
+ g_warning ("Failed to call 'ItipView.GetState()': %s",
jsc_exception_get_message (exception));
+
+ view->priv->state_rsvp_comment = e_web_view_jsc_get_object_property_string (value,
"rsvp-comment", NULL);
+ view->priv->state_rsvp_check = e_web_view_jsc_get_object_property_boolean (value,
"rsvp-check", FALSE);
+ view->priv->state_update_check = e_web_view_jsc_get_object_property_boolean (value,
"update-check", FALSE);
+ view->priv->state_recur_check = e_web_view_jsc_get_object_property_boolean (value,
"recur-check", FALSE);
+ view->priv->state_free_time_check = e_web_view_jsc_get_object_property_boolean
(value, "free-time-check", FALSE);
+ view->priv->state_keep_alarm_check = e_web_view_jsc_get_object_property_boolean
(value, "keep-alarm-check", FALSE);
+ view->priv->state_inherit_alarm_check = e_web_view_jsc_get_object_property_boolean
(value, "inherit-alarm-check", FALSE);
- g_object_unref (proxy);
+ webkit_javascript_result_unref (js_result);
+
+ g_signal_emit (view, signals[RESPONSE], 0, view->priv->state_response_id);
+ }
+
+ g_object_unref (view);
+ }
+
+ e_weak_ref_free (wkrf);
}
static void
@@ -1028,8 +933,16 @@ itip_view_itip_button_clicked_cb (EWebView *web_view,
if (can_use) {
gint response = atoi (element_value);
+ gchar *script;
- g_signal_emit (view, signals[RESPONSE], 0, response);
+ view->priv->state_response_id = response;
+
+ script = e_web_view_jsc_printf_script ("EvoItip.GetState(%s);", view->priv->part_id);
+
+ webkit_web_view_run_javascript (WEBKIT_WEB_VIEW (web_view),
+ script, e_web_view_get_cancellable (web_view), itip_view_get_state_cb, e_weak_ref_new
(view));
+
+ g_free (script);
}
}
@@ -1050,27 +963,13 @@ itip_view_register_clicked_listener (ItipView *view)
}
static void
-recur_toggled_signal_cb (GDBusConnection *connection,
- const gchar *sender_name,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *signal_name,
- GVariant *parameters,
- ItipView *view)
+itip_set_selected_source_uid (ItipView *view,
+ const gchar *uid)
{
- guint64 page_id = 0;
- const gchar *part_id = NULL;
-
- g_return_if_fail (ITIP_IS_VIEW (view));
-
- if (g_strcmp0 (signal_name, "ItipRecurToggled") != 0)
- return;
-
- g_variant_get (parameters, "(t&s)", &page_id, &part_id);
-
- if (itip_view_get_page_id (view) == page_id &&
- g_strcmp0 (view->priv->part_id, part_id) == 0)
- itip_view_set_mode (view, view->priv->mode);
+ if (g_strcmp0 (view->priv->selected_source_uid, uid) != 0) {
+ g_free (view->priv->selected_source_uid);
+ view->priv->selected_source_uid = g_strdup (uid);
+ }
}
static void
@@ -1088,31 +987,6 @@ source_changed_cb (ItipView *view)
}
}
-static void
-source_changed_cb_signal_cb (GDBusConnection *connection,
- const gchar *sender_name,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
-{
- ItipView *view = user_data;
- guint64 page_id = 0;
- const gchar *part_id = NULL;
-
- g_return_if_fail (ITIP_IS_VIEW (view));
-
- if (g_strcmp0 (signal_name, "ItipSourceChanged") != 0)
- return;
-
- g_variant_get (parameters, "(t&s)", &page_id, &part_id);
-
- if (itip_view_get_page_id (view) == page_id &&
- g_strcmp0 (view->priv->part_id, part_id) == 0)
- source_changed_cb (view);
-}
-
static void
append_checkbox_table_row (GString *buffer,
const gchar *name,
@@ -1179,13 +1053,13 @@ append_info_item_row (ItipView *view,
const gchar *table_id,
ItipViewInfoItem *item)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
const gchar *icon_name;
gchar *row_id;
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
switch (item->type) {
@@ -1209,20 +1083,15 @@ append_info_item_row (ItipView *view,
row_id = g_strdup_printf ("%s_row_%d", table_id, item->id);
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipAppendInfoItemRow",
- g_variant_new (
- "(tsssss)",
- itip_view_get_page_id (view),
- view->priv->part_id,
- table_id,
- row_id,
- icon_name,
- item->message),
- NULL);
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.AppendInfoRow(%s, %s, %s, %s, %s);",
+ view->priv->part_id,
+ table_id,
+ row_id,
+ icon_name,
+ item->message);
- g_object_unref (proxy);
+ g_object_unref (web_view);
g_free (row_id);
d (printf ("Added row %s_row_%d ('%s')\n", table_id, item->id, item->message));
@@ -1233,23 +1102,22 @@ remove_info_item_row (ItipView *view,
const gchar *table_id,
guint id)
{
+ EWebView *web_view;
gchar *row_id;
- GDBusProxy *proxy;
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
row_id = g_strdup_printf ("%s_row_%d", table_id, id);
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipRemoveElement",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, row_id),
- NULL);
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.RemoveInfoRow(%s, %s);",
+ view->priv->part_id,
+ row_id);
- g_object_unref (proxy);
+ g_object_unref (web_view);
g_free (row_id);
d (printf ("Removed row %s_row_%d\n", table_id, id));
@@ -1347,30 +1215,32 @@ static void
itip_view_rebuild_source_list (ItipView *view)
{
ESourceRegistry *registry;
- GDBusProxy *proxy;
+ EWebView *web_view;
GList *list, *link;
+ GString *script;
const gchar *extension_name;
d (printf ("Assigning a new source list!\n"));
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
registry = view->priv->registry;
extension_name = itip_view_get_extension_name (view);
if (!extension_name) {
- g_object_unref (proxy);
+ g_object_unref (web_view);
return;
}
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipElementRemoveChildNodes",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, SELECT_ESOURCE),
- NULL);
+ script = g_string_sized_new (1024);
+
+ e_web_view_jsc_printf_script_gstring (script,
+ "EvoItip.RemoveChildNodes(%s, %s);",
+ view->priv->part_id,
+ SELECT_ESOURCE);
list = e_source_registry_list_enabled (registry, extension_name);
@@ -1381,25 +1251,23 @@ itip_view_rebuild_source_list (ItipView *view)
parent = e_source_registry_ref_source (
registry, e_source_get_parent (source));
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipRebuildSourceList",
- g_variant_new (
- "(tsssssb)",
- itip_view_get_page_id (view),
- view->priv->part_id,
- e_source_get_uid (parent),
- e_source_get_display_name (parent),
- e_source_get_uid (source),
- e_source_get_display_name (source),
- e_source_get_writable (source)),
- NULL);
+ e_web_view_jsc_printf_script_gstring (script,
+ "EvoItip.AddToSourceList(%s, %s, %s, %s, %s, %x);",
+ view->priv->part_id,
+ e_source_get_uid (parent),
+ e_source_get_display_name (parent),
+ e_source_get_uid (source),
+ e_source_get_display_name (source),
+ e_source_get_writable (source));
g_object_unref (parent);
}
+ e_web_view_jsc_run_script_take (WEBKIT_WEB_VIEW (web_view), g_string_free (script, FALSE),
+ e_web_view_get_cancellable (web_view));
+
g_list_free_full (list, (GDestroyNotify) g_object_unref);
- g_object_unref (proxy);
+ g_object_unref (web_view);
source_changed_cb (view);
}
@@ -1440,25 +1308,6 @@ itip_view_source_removed_cb (ESourceRegistry *registry,
itip_view_rebuild_source_list (view);
}
-static void
-itip_view_unregister_dbus_signals (ItipView *view)
-{
- g_return_if_fail (ITIP_IS_VIEW (view));
-
- if (view->priv->dbus_connection && !g_dbus_connection_is_closed (view->priv->dbus_connection)) {
- if (view->priv->web_extension_recur_toggled_signal_id)
- g_dbus_connection_signal_unsubscribe (view->priv->dbus_connection,
view->priv->web_extension_recur_toggled_signal_id);
-
- if (view->priv->web_extension_source_changed_cb_signal_id)
- g_dbus_connection_signal_unsubscribe (view->priv->dbus_connection,
view->priv->web_extension_source_changed_cb_signal_id);
- }
-
- view->priv->web_extension_recur_toggled_signal_id = 0;
- view->priv->web_extension_source_changed_cb_signal_id = 0;
-
- g_clear_object (&view->priv->dbus_connection);
-}
-
static void
itip_view_set_client_cache (ItipView *view,
EClientCache *client_cache)
@@ -1538,11 +1387,8 @@ itip_view_dispose (GObject *object)
priv->source_removed_handler_id = 0;
}
- itip_view_unregister_dbus_signals (ITIP_VIEW (object));
-
g_clear_object (&priv->client_cache);
g_clear_object (&priv->registry);
- g_clear_object (&priv->dbus_connection);
g_clear_object (&priv->cancellable);
g_clear_object (&priv->comp);
@@ -1579,6 +1425,7 @@ itip_view_finalize (GObject *object)
g_free (priv->description);
g_free (priv->error);
g_free (priv->part_id);
+ g_free (priv->selected_source_uid);
for (iter = priv->lower_info_items; iter; iter = iter->next) {
ItipViewInfoItem *item = iter->data;
@@ -1608,6 +1455,7 @@ itip_view_finalize (GObject *object)
g_free (priv->delegator_name);
g_free (priv->my_address);
g_free (priv->message_uid);
+ g_free (priv->state_rsvp_comment);
g_clear_object (&priv->folder);
g_clear_object (&priv->message);
@@ -1921,65 +1769,6 @@ itip_view_write_for_printing (ItipView *view,
g_string_append (buffer, "</div>");
}
-static void
-itip_view_web_extension_proxy_notify_cb (GObject *web_view,
- GParamSpec *param,
- gpointer user_data)
-{
- ItipView *view = user_data;
- GDBusConnection *connection;
- GDBusProxy *proxy;
-
- if (!view)
- return;
-
- itip_view_unregister_dbus_signals (view);
-
- proxy = e_web_view_get_web_extension_proxy (E_WEB_VIEW (web_view));
- if (!proxy)
- return;
-
- connection = g_dbus_proxy_get_connection (proxy);
- if (!connection || g_dbus_connection_is_closed (connection))
- return;
-
- view->priv->dbus_connection = g_object_ref (connection);
-
- view->priv->web_extension_source_changed_cb_signal_id =
- g_dbus_connection_signal_subscribe (
- view->priv->dbus_connection,
- g_dbus_proxy_get_name (proxy),
- E_WEB_EXTENSION_INTERFACE,
- "ItipSourceChanged",
- E_WEB_EXTENSION_OBJECT_PATH,
- NULL,
- G_DBUS_SIGNAL_FLAGS_NONE,
- source_changed_cb_signal_cb,
- view,
- NULL);
-
- view->priv->web_extension_recur_toggled_signal_id =
- g_dbus_connection_signal_subscribe (
- view->priv->dbus_connection,
- g_dbus_proxy_get_name (proxy),
- E_WEB_EXTENSION_INTERFACE,
- "ItipRecurToggled",
- E_WEB_EXTENSION_OBJECT_PATH,
- NULL,
- G_DBUS_SIGNAL_FLAGS_NONE,
- (GDBusSignalCallback) recur_toggled_signal_cb,
- view,
- NULL);
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipCreateDOMBindings",
- g_variant_new ("(ts)", itip_view_get_page_id (view), view->priv->part_id),
- NULL);
-
- itip_view_init_view (view);
-}
-
static void
itip_view_init (ItipView *view)
{
@@ -2024,23 +1813,22 @@ void
itip_view_set_mode (ItipView *view,
ItipViewMode mode)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
g_return_if_fail (ITIP_IS_VIEW (view));
view->priv->mode = mode;
set_sender_text (view);
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipElementHideChildNodes",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, TABLE_ROW_BUTTONS),
- NULL);
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.HideButtons(%s, %s);",
+ view->priv->part_id,
+ TABLE_ROW_BUTTONS);
view->priv->is_recur_set = itip_view_get_recur_check_state (view);
@@ -2085,7 +1873,7 @@ itip_view_set_mode (ItipView *view,
break;
}
- g_object_unref (proxy);
+ g_object_unref (web_view);
}
ItipViewMode
@@ -2100,16 +1888,16 @@ void
itip_view_set_item_type (ItipView *view,
ECalClientSourceType type)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
const gchar *header;
gchar *access_key, *html_label;
g_return_if_fail (ITIP_IS_VIEW (view));
view->priv->type = type;
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
switch (view->priv->type) {
@@ -2129,21 +1917,21 @@ itip_view_set_item_type (ItipView *view,
if (!header) {
set_sender_text (view);
- g_object_unref (proxy);
+ g_object_unref (web_view);
return;
}
html_label = e_mail_formatter_parse_html_mnemonics (header, &access_key);
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipElementSetAccessKey",
- g_variant_new ("(tsss)", itip_view_get_page_id (view), view->priv->part_id,
TABLE_ROW_ESCB_LABEL, access_key),
- NULL);
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetElementAccessKey(%s, %s, %s);",
+ view->priv->part_id,
+ TABLE_ROW_ESCB_LABEL,
+ access_key);
set_inner_html (view, TABLE_ROW_ESCB_LABEL, html_label);
- g_object_unref (proxy);
+ g_object_unref (web_view);
g_free (html_label);
if (access_key)
@@ -2831,7 +2619,7 @@ itip_view_set_source (ItipView *view,
ESource *source)
{
ESource *selected_source;
- GDBusProxy *proxy;
+ EWebView *web_view;
g_return_if_fail (ITIP_IS_VIEW (view));
@@ -2854,110 +2642,56 @@ itip_view_set_source (ItipView *view,
if (selected_source != NULL)
g_object_unref (selected_source);
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipEnableSelect",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id, SELECT_ESOURCE,
TRUE),
- NULL);
+ e_web_view_jsc_set_element_disabled (WEBKIT_WEB_VIEW (web_view),
+ view->priv->part_id, SELECT_ESOURCE, FALSE,
+ e_web_view_get_cancellable (web_view));
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipSelectSetSelected",
- g_variant_new ("(tsss)", itip_view_get_page_id (view), view->priv->part_id, SELECT_ESOURCE,
e_source_get_uid (source)),
- NULL);
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetSelectSelected(%s, %s, %s);",
+ view->priv->part_id,
+ SELECT_ESOURCE,
+ e_source_get_uid (source));
+
+ itip_set_selected_source_uid (view, e_source_get_uid (source));
source_changed_cb (view);
- g_object_unref (proxy);
+ g_object_unref (web_view);
}
ESource *
itip_view_ref_source (ItipView *view)
{
- ESource *source = NULL;
- gboolean disable = FALSE, enabled = FALSE;
- GDBusProxy *proxy;
- GVariant *result;
-
g_return_val_if_fail (ITIP_IS_VIEW (view), NULL);
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
+ if (!view->priv->selected_source_uid || !*view->priv->selected_source_uid)
return NULL;
- result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
- proxy,
- "ItipSelectIsEnabled",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id,
SELECT_ESOURCE),
- NULL);
-
- if (result) {
- g_variant_get (result, "(b)", &enabled);
- g_variant_unref (result);
- }
-
- if (!enabled) {
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipEnableSelect",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id,
SELECT_ESOURCE, TRUE),
- NULL);
-
- disable = TRUE;
- }
-
- result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
- proxy,
- "ItipSelectGetValue",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id, SELECT_ESOURCE),
- NULL);
-
- if (result) {
- const gchar *uid;
-
- g_variant_get (result, "(&s)", &uid);
- source = e_source_registry_ref_source (view->priv->registry, uid);
- g_variant_unref (result);
- }
-
- if (disable) {
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipEnableSelect",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id,
SELECT_ESOURCE, FALSE),
- NULL);
- }
-
- g_object_unref (proxy);
-
- return source;
+ return e_source_registry_ref_source (view->priv->registry, view->priv->selected_source_uid);
}
void
itip_view_set_rsvp (ItipView *view,
gboolean rsvp)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
input_set_checked (view, CHECKBOX_RSVP, rsvp);
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipEnableTextArea",
- g_variant_new ("(tssb)", itip_view_get_page_id (view), view->priv->part_id,
TEXTAREA_RSVP_COMMENT, !rsvp),
- NULL);
+ e_web_view_jsc_set_element_disabled (WEBKIT_WEB_VIEW (web_view),
+ view->priv->part_id, TEXTAREA_RSVP_COMMENT, rsvp,
+ e_web_view_get_cancellable (web_view));
- g_object_unref (proxy);
+ g_object_unref (web_view);
}
gboolean
@@ -2965,7 +2699,7 @@ itip_view_get_rsvp (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_RSVP);
+ return view->priv->state_rsvp_check;
}
void
@@ -2978,14 +2712,6 @@ itip_view_set_show_rsvp_check (ItipView *view,
hide_element (view, TABLE_ROW_RSVP_COMMENT, !show);
}
-gboolean
-itip_view_get_show_rsvp_check (ItipView *view)
-{
- g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
-
- return !element_is_hidden (view, CHECKBOX_RSVP);
-}
-
void
itip_view_set_update (ItipView *view,
gboolean update)
@@ -3000,7 +2726,7 @@ itip_view_get_update (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_UPDATE);
+ return view->priv->state_update_check;
}
void
@@ -3012,72 +2738,32 @@ itip_view_set_show_update_check (ItipView *view,
show_checkbox (view, CHECKBOX_UPDATE, show, FALSE);
}
-gboolean
-itip_view_get_show_update_check (ItipView *view)
-{
- g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
-
- return !element_is_hidden (view, CHECKBOX_UPDATE);
-}
-
void
itip_view_set_rsvp_comment (ItipView *view,
const gchar *comment)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
- proxy = itip_view_ref_web_extension_proxy (view);
+ web_view = itip_view_ref_web_view (view);
- if (!proxy)
+ if (!web_view)
return;
- if (comment) {
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipTextAreaSetValue",
- g_variant_new ("(tsss)", itip_view_get_page_id (view), view->priv->part_id,
TEXTAREA_RSVP_COMMENT, comment),
- NULL);
- }
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetAreaText(%s, %s, %s);",
+ view->priv->part_id,
+ TEXTAREA_RSVP_COMMENT,
+ comment);
- g_object_unref (proxy);
+ g_object_unref (web_view);
}
-gchar *
+const gchar *
itip_view_get_rsvp_comment (ItipView *view)
{
- GDBusProxy *proxy;
- GVariant *result;
-
g_return_val_if_fail (ITIP_IS_VIEW (view), NULL);
- proxy = itip_view_ref_web_extension_proxy (view);
-
- if (!proxy)
- return NULL;
-
- if (element_is_hidden (view, TEXTAREA_RSVP_COMMENT)) {
- g_object_unref (proxy);
- return NULL;
- }
-
- result = e_util_invoke_g_dbus_proxy_call_sync_wrapper_with_error_check (
- proxy,
- "ItipTextAreaGetValue",
- g_variant_new ("(tss)", itip_view_get_page_id (view), view->priv->part_id,
TEXTAREA_RSVP_COMMENT),
- NULL);
-
- if (result) {
- gchar *value;
-
- g_variant_get (result, "(s)", &value);
- g_variant_unref (result);
- g_object_unref (proxy);
- return value;
- }
-
- g_object_unref (proxy);
-
- return NULL;
+ return view->priv->state_rsvp_comment;
}
void
@@ -3093,25 +2779,23 @@ void
itip_view_set_buttons_sensitive (ItipView *view,
gboolean sensitive)
{
- GDBusProxy *proxy;
+ EWebView *web_view;
g_return_if_fail (ITIP_IS_VIEW (view));
d (printf ("Settings buttons %s\n", sensitive ? "sensitive" : "insensitive"));
view->priv->buttons_sensitive = sensitive;
- proxy = itip_view_ref_web_extension_proxy (view);
- if (!proxy)
- return;
-
- e_util_invoke_g_dbus_proxy_call_with_error_check (
- proxy,
- "ItipSetButtonsSensitive",
- g_variant_new ("(tsb)", itip_view_get_page_id (view), view->priv->part_id, sensitive),
- NULL);
+ web_view = itip_view_ref_web_view (view);
- g_object_unref (proxy);
+ if (web_view) {
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.SetButtonsDisabled(%s, %x);",
+ view->priv->part_id,
+ !sensitive);
+ g_object_unref (web_view);
+ }
}
gboolean
@@ -3127,7 +2811,7 @@ itip_view_get_recur_check_state (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_RECUR);
+ return view->priv->state_recur_check;
}
void
@@ -3153,7 +2837,7 @@ itip_view_get_free_time_check_state (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_FREE_TIME);
+ return view->priv->state_free_time_check;
}
void
@@ -3181,7 +2865,7 @@ itip_view_get_keep_alarm_check_state (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_KEEP_ALARM);
+ return view->priv->state_keep_alarm_check;
}
void
@@ -3198,7 +2882,7 @@ itip_view_get_inherit_alarm_check_state (ItipView *view)
{
g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE);
- return input_is_checked (view, CHECKBOX_INHERIT_ALARM);
+ return view->priv->state_inherit_alarm_check;
}
void
@@ -4928,7 +4612,7 @@ finish_message_delete_with_rsvp (ItipView *view,
ICalComponent *icomp;
ICalProperty *prop;
const gchar *attendee;
- gchar *comment;
+ const gchar *comment;
GSList *l, *list = NULL;
gboolean found;
@@ -4985,7 +4669,6 @@ finish_message_delete_with_rsvp (ItipView *view,
e_cal_component_set_comments (comp, &comments);
e_cal_component_text_free (text);
- g_free (comment);
}
if (itip_send_comp_sync (
@@ -6941,6 +6624,55 @@ itip_view_init_view (ItipView *view)
}
}
+static void
+itip_source_changed_cb (WebKitUserContentManager *manager,
+ WebKitJavascriptResult *js_result,
+ gpointer user_data)
+{
+ ItipView *view = user_data;
+ JSCValue *jsc_value;
+ gchar *iframe_id, *source_uid;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (js_result != NULL);
+
+ jsc_value = webkit_javascript_result_get_js_value (js_result);
+ g_return_if_fail (jsc_value_is_object (jsc_value));
+
+ iframe_id = e_web_view_jsc_get_object_property_string (jsc_value, "iframe-id", NULL);
+ source_uid = e_web_view_jsc_get_object_property_string (jsc_value, "source-uid", NULL);
+
+ if (g_strcmp0 (iframe_id, view->priv->part_id) == 0) {
+ itip_set_selected_source_uid (view, source_uid);
+ source_changed_cb (view);
+ }
+
+ g_free (iframe_id);
+}
+
+static void
+itip_recur_toggled_cb (WebKitUserContentManager *manager,
+ WebKitJavascriptResult *js_result,
+ gpointer user_data)
+{
+ ItipView *view = user_data;
+ JSCValue *jsc_value;
+ gchar *iframe_id;
+
+ g_return_if_fail (view != NULL);
+ g_return_if_fail (js_result != NULL);
+
+ jsc_value = webkit_javascript_result_get_js_value (js_result);
+ g_return_if_fail (jsc_value_is_string (jsc_value));
+
+ iframe_id = jsc_value_to_string (jsc_value);
+
+ if (g_strcmp0 (iframe_id, view->priv->part_id) == 0)
+ itip_view_set_mode (view, view->priv->mode);
+
+ g_free (iframe_id);
+}
+
void
itip_view_set_web_view (ItipView *view,
EWebView *web_view)
@@ -6952,13 +6684,24 @@ itip_view_set_web_view (ItipView *view,
g_weak_ref_set (view->priv->web_view_weakref, web_view);
if (web_view) {
- g_signal_connect_object (web_view, "notify::web-extension-proxy",
- G_CALLBACK (itip_view_web_extension_proxy_notify_cb), view, 0);
+ WebKitUserContentManager *manager;
- if (e_web_view_get_web_extension_proxy (web_view))
- itip_view_web_extension_proxy_notify_cb (G_OBJECT (web_view), NULL, view);
- } else {
- itip_view_unregister_dbus_signals (view);
+ manager = webkit_web_view_get_user_content_manager (WEBKIT_WEB_VIEW (web_view));
+
+ g_signal_connect_object (manager, "script-message-received::itipSourceChanged",
+ G_CALLBACK (itip_source_changed_cb), view, 0);
+
+ g_signal_connect_object (manager, "script-message-received::itipRecurToggled",
+ G_CALLBACK (itip_recur_toggled_cb), view, 0);
+
+ webkit_user_content_manager_register_script_message_handler (manager, "itipSourceChanged");
+ webkit_user_content_manager_register_script_message_handler (manager, "itipRecurToggled");
+
+ e_web_view_jsc_run_script (WEBKIT_WEB_VIEW (web_view), e_web_view_get_cancellable (web_view),
+ "EvoItip.Initialize(%s);",
+ view->priv->part_id);
+
+ itip_view_init_view (view);
}
itip_view_register_clicked_listener (view);
diff --git a/src/modules/itip-formatter/itip-view.h b/src/modules/itip-formatter/itip-view.h
index 696f614d33..05e26f84a6 100644
--- a/src/modules/itip-formatter/itip-view.h
+++ b/src/modules/itip-formatter/itip-view.h
@@ -211,16 +211,14 @@ void itip_view_set_source (ItipView *view,
gboolean itip_view_get_rsvp (ItipView *view);
void itip_view_set_rsvp (ItipView *view,
gboolean rsvp);
-gboolean itip_view_get_show_rsvp_check (ItipView *view);
void itip_view_set_show_rsvp_check (ItipView *view,
gboolean show);
gboolean itip_view_get_update (ItipView *view);
void itip_view_set_update (ItipView *view,
gboolean update);
-gboolean itip_view_get_show_update_check (ItipView *view);
void itip_view_set_show_update_check (ItipView *view,
gboolean show);
-gchar * itip_view_get_rsvp_comment (ItipView *view);
+const gchar * itip_view_get_rsvp_comment (ItipView *view);
void itip_view_set_rsvp_comment (ItipView *view,
const gchar *comment);
gboolean itip_view_get_buttons_sensitive (ItipView *view);
diff --git a/src/web-extensions/CMakeLists.txt b/src/web-extensions/CMakeLists.txt
index ae6425e77a..cb53096496 100644
--- a/src/web-extensions/CMakeLists.txt
+++ b/src/web-extensions/CMakeLists.txt
@@ -1,5 +1,5 @@
set(GRESOURCE_FILES
- ext-utils.js
+ evolution-utils.js
)
glib_compile_resources(${CMAKE_CURRENT_SOURCE_DIR} evolution-web-extension-resource
evolution_web_extension_resource evolution-web-process-extension.gresource.xml ${GRESOURCE_FILES})
@@ -51,14 +51,9 @@ install(TARGETS edomutils
)
set(SOURCES
- e-dom-utils.h
- e-dom-utils.c
- e-itip-formatter-dom-utils.h
- e-itip-formatter-dom-utils.c
e-web-extension.h
e-web-extension.c
e-web-extension-main.c
- e-web-extension-names.h
${CMAKE_CURRENT_BINARY_DIR}/evolution-web-extension-resource.c
${CMAKE_CURRENT_BINARY_DIR}/evolution-web-extension-resource.h
)
diff --git a/src/web-extensions/e-dom-utils.c b/src/web-extensions/e-dom-utils.c
index 6cb7d4b567..7a4eac53a7 100644
--- a/src/web-extensions/e-dom-utils.c
+++ b/src/web-extensions/e-dom-utils.c
@@ -23,7 +23,6 @@
#include <webkitdom/webkitdom.h>
#include "e-web-extension.h"
-#include "e-web-extension-names.h"
#include "e-dom-utils.h"
@@ -1502,169 +1501,6 @@ e_dom_utils_get_document_from_point (WebKitDOMDocument *document,
WEBKIT_DOM_NODE (element));
}
-/* VCard Inline Module DOM functions */
-
-static void
-display_mode_toggle_button_cb (WebKitDOMElement *button,
- WebKitDOMEvent *event,
- GDBusConnection *connection)
-{
- GError *error = NULL;
- gchar *element_id;
-
- element_id = webkit_dom_element_get_id (button);
-
- g_dbus_connection_emit_signal (
- connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "VCardInlineDisplayModeToggled",
- g_variant_new ("(s)", element_id ? element_id : ""),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal DisplayModeToggled: %s\n", error->message);
- g_error_free (error);
- }
-
- g_free (element_id);
-}
-
-static void
-save_vcard_button_cb (WebKitDOMElement *button,
- WebKitDOMEvent *event,
- GDBusConnection *connection)
-{
- GError *error = NULL;
- gchar *button_value;
-
- button_value = webkit_dom_html_button_element_get_value (
- WEBKIT_DOM_HTML_BUTTON_ELEMENT (button));
-
- g_dbus_connection_emit_signal (
- connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "VCardInlineSaveButtonPressed",
- g_variant_new ("(s)", button_value),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal SaveVCardButtonPressed: %s\n", error->message);
- g_error_free (error);
- }
-
- g_free (button_value);
-}
-
-void
-e_dom_utils_module_vcard_inline_bind_dom (WebKitDOMDocument *document,
- const gchar *element_id,
- GDBusConnection *connection)
-{
- WebKitDOMElement *element;
- WebKitDOMDocument *element_document;
- gchar *selector;
-
- element = e_dom_utils_find_element_by_id (document, element_id);
- if (!element)
- return;
-
- element_document = webkit_dom_node_get_owner_document (
- WEBKIT_DOM_NODE (element));
-
- selector = g_strconcat ("button[id='", element_id, "']", NULL);
- e_dom_utils_bind_dom (
- element_document,
- selector,
- "click",
- display_mode_toggle_button_cb,
- connection);
- g_free (selector);
-
- selector = g_strconcat ("button[value='", element_id, "']", NULL);
- e_dom_utils_bind_dom (
- element_document,
- selector,
- "click",
- save_vcard_button_cb,
- connection);
- g_free (selector);
-
- e_dom_utils_eab_contact_formatter_bind_dom (element_document);
-}
-
-void
-e_dom_utils_module_vcard_inline_update_button (WebKitDOMDocument *document,
- const gchar *button_id,
- const gchar *html_label,
- const gchar *access_key)
-{
- WebKitDOMElement *element;
- gchar *selector;
-
- selector = g_strconcat ("button[id='", button_id, "']", NULL);
- element = e_dom_utils_find_element_by_selector (document, selector);
- g_free (selector);
-
- if (!element)
- return;
-
- webkit_dom_element_set_inner_html (element, html_label, NULL);
-
- if (access_key) {
- webkit_dom_html_element_set_access_key (
- WEBKIT_DOM_HTML_ELEMENT (element), access_key);
- }
-}
-
-static void
-iframe_inner_doc_gone (gpointer iframe,
- GObject *inner_doc)
-{
- WebKitDOMDocument *inner_document;
-
- inner_document = webkit_dom_html_iframe_element_get_content_document (iframe);
-
- if (inner_document)
- e_dom_utils_eab_contact_formatter_bind_dom (inner_document);
-
- g_object_unref (iframe);
-}
-
-void
-e_dom_utils_module_vcard_inline_set_iframe_src (WebKitDOMDocument *document,
- const gchar *button_id,
- const gchar *src)
-{
- WebKitDOMElement *element, *parent, *iframe;
- WebKitDOMDocument *inner_document;
- gchar *selector;
-
- selector = g_strconcat ("button[id='", button_id, "']", NULL);
- element = e_dom_utils_find_element_by_selector (document, selector);
- g_free (selector);
-
- parent = webkit_dom_node_get_parent_element (WEBKIT_DOM_NODE (element));
- if (!parent)
- return;
-
- iframe = webkit_dom_element_query_selector (parent, "iframe", NULL);
- if (!iframe)
- return;
-
- inner_document = webkit_dom_html_iframe_element_get_content_document (WEBKIT_DOM_HTML_IFRAME_ELEMENT
(iframe));
-
- /* This is an ugly hack, relying on the WebKitGTK+ behavior to
- free the inner document GObject when the new source is loaded. */
- g_object_weak_ref (G_OBJECT (inner_document), iframe_inner_doc_gone, g_object_ref (iframe));
-
- webkit_dom_html_iframe_element_set_src (
- WEBKIT_DOM_HTML_IFRAME_ELEMENT (iframe), src);
-}
-
/**
* e_html_editor_dom_node_find_parent_element:
* @node: Start node
diff --git a/src/web-extensions/e-dom-utils.h b/src/web-extensions/e-dom-utils.h
index 09d76deb59..27b2350cb9 100644
--- a/src/web-extensions/e-dom-utils.h
+++ b/src/web-extensions/e-dom-utils.h
@@ -108,20 +108,6 @@ WebKitDOMDocument *
(WebKitDOMDocument *document,
gint32 x,
gint32 y);
-/* VCard Inline Module DOM functions */
-void e_dom_utils_module_vcard_inline_bind_dom
- (WebKitDOMDocument *document,
- const gchar *element_id,
- GDBusConnection *connection);
-void e_dom_utils_module_vcard_inline_update_button
- (WebKitDOMDocument *document,
- const gchar *button_id,
- const gchar *html_label,
- const gchar *access_key);
-void e_dom_utils_module_vcard_inline_set_iframe_src
- (WebKitDOMDocument *document,
- const gchar *button_id,
- const gchar *src);
WebKitDOMElement *
dom_node_find_parent_element (WebKitDOMNode *node,
const gchar *tagname);
diff --git a/src/web-extensions/e-web-extension-main.c b/src/web-extensions/e-web-extension-main.c
index cb09f246ee..a094c97056 100644
--- a/src/web-extensions/e-web-extension-main.c
+++ b/src/web-extensions/e-web-extension-main.c
@@ -25,31 +25,6 @@
#undef E_UTIL_INCLUDE_WITHOUT_WEBKIT
#include "e-web-extension.h"
-#include "e-web-extension-names.h"
-
-static void
-connected_to_server_cb (GObject *source_object,
- GAsyncResult *result,
- gpointer user_data)
-{
- EWebExtension *extension = user_data;
- GDBusConnection *connection;
- GError *error = NULL;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- connection = e_web_extension_container_utils_connect_to_server_finish (result, &error);
- if (!connection) {
- g_warning ("%d %s: Failed to connect to the UI D-Bus server: %s", getpid (), G_STRFUNC,
- error ? error->message : "Unknown error");
- g_clear_error (&error);
- return;
- }
-
- e_web_extension_dbus_register (extension, connection);
- g_object_unref (connection);
- g_object_unref (extension);
-}
/* Forward declaration */
G_MODULE_EXPORT void webkit_web_extension_initialize_with_user_data (WebKitWebExtension *wk_extension,
@@ -60,16 +35,6 @@ webkit_web_extension_initialize_with_user_data (WebKitWebExtension *wk_extension
GVariant *user_data)
{
EWebExtension *extension;
- const gchar *guid = NULL, *server_address = NULL;
-
- g_return_if_fail (user_data != NULL);
-
- g_variant_get (user_data, "(&s&s)", &guid, &server_address);
-
- if (!server_address) {
- g_warning ("%d %s: The UI process didn't provide server address", getpid (), G_STRFUNC);
- return;
- }
camel_debug_init ();
@@ -78,6 +43,4 @@ webkit_web_extension_initialize_with_user_data (WebKitWebExtension *wk_extension
extension = e_web_extension_get ();
e_web_extension_initialize (extension, wk_extension);
-
- e_web_extension_container_utils_connect_to_server (server_address, NULL, connected_to_server_cb,
g_object_ref (extension));
}
diff --git a/src/web-extensions/e-web-extension.c b/src/web-extensions/e-web-extension.c
index 9ea45a6537..78f4af890e 100644
--- a/src/web-extensions/e-web-extension.c
+++ b/src/web-extensions/e-web-extension.c
@@ -27,1847 +27,18 @@
#include <camel/camel.h>
#include <libedataserver/libedataserver.h>
-#include "e-web-extension.h"
-#include "e-dom-utils.h"
-#include "e-itip-formatter-dom-utils.h"
-#include "e-web-extension-names.h"
-
-#include <webkitdom/webkitdom.h>
-
-#define WEB_EXTENSION_PAGE_ID_KEY "web-extension-page-id"
-
-#define E_WEB_EXTENSION_GET_PRIVATE(obj) \
- (G_TYPE_INSTANCE_GET_PRIVATE \
- ((obj), E_TYPE_WEB_EXTENSION, EWebExtensionPrivate))
-
-typedef struct _EWebPageData {
- WebKitWebPage *web_page; /* not referenced */
- gint stamp;
- gboolean need_input;
- guint32 clipboard_flags;
-} EWebPageData;
-
-struct _EWebExtensionPrivate {
- WebKitWebExtension *wk_extension;
-
- GDBusConnection *dbus_connection;
- guint registration_id;
-
- gboolean initialized;
-
- GSList *pages; /* EWebPageData * */
-};
-
-enum {
- REGISTER_DBUS_CONNECTION,
- LAST_SIGNAL
-};
-
-static guint signals[LAST_SIGNAL];
-
-static const char introspection_xml[] =
-"<node>"
-" <interface name='" E_WEB_EXTENSION_INTERFACE "'>"
-" <signal name='ExtensionObjectReady'>"
-" </signal>"
-" <method name='GetExtensionHandlesPages'>"
-" <arg type='at' name='array' direction='out'/>"
-" </method>"
-" <signal name='ExtensionHandlesPage'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='i' name='stamp' direction='out'/>"
-" </signal>"
-" <method name='RegisterElementClicked'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_class' direction='in'/>"
-" </method>"
-" <signal name='ElementClicked'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='s' name='element_class' direction='out'/>"
-" <arg type='s' name='element_value' direction='out'/>"
-" <arg type='i' name='position_left' direction='out'/>"
-" <arg type='i' name='position_top' direction='out'/>"
-" <arg type='i' name='position_width' direction='out'/>"
-" <arg type='i' name='position_height' direction='out'/>"
-" </signal>"
-" <method name='SetElementHidden'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='b' name='hidden' direction='in'/>"
-" </method>"
-" <method name='SetElementStyleProperty'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='s' name='property_name' direction='in'/>"
-" <arg type='s' name='value' direction='in'/>"
-" <arg type='s' name='priority' direction='in'/>"
-" </method>"
-" <method name='SetElementAttribute'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='s' name='namespace_uri' direction='in'/>"
-" <arg type='s' name='qualified_name' direction='in'/>"
-" <arg type='s' name='value' direction='in'/>"
-" </method>"
-" <signal name='HeadersCollapsed'>"
-" <arg type='b' name='expanded' direction='out'/>"
-" </signal>"
-" <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'/>"
-" </method>"
-" <method name='GetSelectionContentHTML'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='html_content' direction='out'/>"
-" </method>"
-" <method name='GetSelectionContentText'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='text_content' direction='out'/>"
-" </method>"
-" <method name='GetSelectionContentMultipart'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='content' direction='out'/>"
-" <arg type='b' name='is_html' direction='out'/>"
-" </method>"
-" <method name='CreateAndAddCSSStyleSheet'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='style_sheet_id' direction='in'/>"
-" </method>"
-" <method name='AddCSSRuleIntoStyleSheet'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='style_sheet_id' direction='in'/>"
-" <arg type='s' name='selector' direction='in'/>"
-" <arg type='s' name='style' direction='in'/>"
-" </method>"
-" <method name='EABContactFormatterBindDOM'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" </method>"
-" <method name='EMailDisplayBindDOM'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" </method>"
-" <method name='ElementExists'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='b' name='element_exists' direction='out'/>"
-" <arg type='t' name='page_id' direction='out'/>"
-" </method>"
-" <method name='GetActiveElementName'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_name' direction='out'/>"
-" </method>"
-" <method name='EMailPartHeadersBindDOMElement'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" </method>"
-" <signal name='VCardInlineDisplayModeToggled'>"
-" <arg type='s' name='button_id' direction='out'/>"
-" </signal>"
-" <signal name='VCardInlineSaveButtonPressed'>"
-" <arg type='s' name='button_value' direction='out'/>"
-" </signal>"
-" <method name='VCardInlineBindDOM'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" </method>"
-" <method name='VCardInlineUpdateButton'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='button_id' direction='in'/>"
-" <arg type='s' name='html_label' direction='in'/>"
-" <arg type='s' name='access_key' direction='in'/>"
-" </method>"
-" <method name='VCardInlineSetIFrameSrc'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='button_id' direction='in'/>"
-" <arg type='s' name='src' direction='in'/>"
-" </method>"
-" <method name='GetDocumentURIFromPoint'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='i' name='x' direction='in'/>"
-" <arg type='i' name='y' direction='in'/>"
-" <arg type='s' name='document_uri' direction='out'/>"
-" </method>"
-" <method name='SetDocumentIFrameSrc'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='document_uri' direction='in'/>"
-" <arg type='s' name='new_iframe_src' direction='in'/>"
-" </method>"
-" <method name='ProcessMagicSpacebar'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='b' name='towards_bottom' direction='in'/>"
-" <arg type='b' name='processed' direction='out'/>"
-" </method>"
-" <method name='EWebViewEnsureBodyClass'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='body_class' direction='in'/>"
-" </method>"
-" <signal name='NeedInputChanged'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='b' name='need_input' direction='out'/>"
-" </signal>"
-" <signal name='ClipboardFlagsChanged'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='u' name='flags' direction='out'/>"
-" </signal>"
-" <signal name='MailPartAppeared'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='s' name='part_id' direction='out'/>"
-" </signal>"
-" <signal name='ItipRecurToggled'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='s' name='part_id' direction='out'/>"
-" </signal>"
-" <signal name='ItipSourceChanged'>"
-" <arg type='t' name='page_id' direction='out'/>"
-" <arg type='s' name='part_id' direction='out'/>"
-" </signal>"
-" <method name='ItipCreateDOMBindings'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" </method>"
-" <method name='ItipShowButton'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='button_id' direction='in'/>"
-" </method>"
-" <method name='ItipElementSetInnerHTML'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='s' name='inner_html' direction='in'/>"
-" </method>"
-" <method name='ItipRemoveElement'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" </method>"
-" <method name='ItipElementRemoveChildNodes'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" </method>"
-" <method name='ItipEnableButton'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='button_id' direction='in'/>"
-" <arg type='b' name='enable' direction='in'/>"
-" </method>"
-" <method name='ItipElementIsHidden'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='b' name='is_hidden' direction='out'/>"
-" </method>"
-" <method name='ItipHideElement'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='b' name='hide' direction='in'/>"
-" </method>"
-" <method name='ItipInputSetChecked'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='input_id' direction='in'/>"
-" <arg type='b' name='checked' direction='in'/>"
-" </method>"
-" <method name='ItipInputIsChecked'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='input_id' direction='in'/>"
-" <arg type='b' name='checked' direction='out'/>"
-" </method>"
-" <method name='ItipShowCheckbox'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='id' direction='in'/>"
-" <arg type='b' name='show' direction='in'/>"
-" <arg type='b' name='update_second' direction='in'/>"
-" </method>"
-" <method name='ItipSetButtonsSensitive'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='b' name='sensitive' direction='in'/>"
-" </method>"
-" <method name='ItipSetAreaText'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='id' direction='in'/>"
-" <arg type='s' name='text' direction='in'/>"
-" </method>"
-" <method name='ItipElementSetAccessKey'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='s' name='access_key' direction='in'/>"
-" </method>"
-" <method name='ItipElementHideChildNodes'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" </method>"
-" <method name='ItipEnableSelect'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='select_id' direction='in'/>"
-" <arg type='b' name='enable' direction='in'/>"
-" </method>"
-" <method name='ItipSelectIsEnabled'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='select_id' direction='in'/>"
-" <arg type='b' name='enable' direction='out'/>"
-" </method>"
-" <method name='ItipSelectGetValue'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='select_id' direction='in'/>"
-" <arg type='s' name='value' direction='out'/>"
-" </method>"
-" <method name='ItipSelectSetSelected'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='select_id' direction='in'/>"
-" <arg type='s' name='option' direction='in'/>"
-" </method>"
-" <method name='ItipUpdateTimes'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='element_id' direction='in'/>"
-" <arg type='s' name='header' direction='in'/>"
-" <arg type='s' name='label' direction='in'/>"
-" </method>"
-" <method name='ItipAppendInfoItemRow'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='table_id' direction='in'/>"
-" <arg type='s' name='row_id' direction='in'/>"
-" <arg type='s' name='icon_name' direction='in'/>"
-" <arg type='s' name='message' direction='in'/>"
-" </method>"
-" <method name='ItipEnableTextArea'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='area_id' direction='in'/>"
-" <arg type='b' name='enable' direction='in'/>"
-" </method>"
-" <method name='ItipTextAreaSetValue'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='area_id' direction='in'/>"
-" <arg type='s' name='value' direction='in'/>"
-" </method>"
-" <method name='ItipTextAreaGetValue'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='area_id' direction='in'/>"
-" <arg type='s' name='value' direction='out'/>"
-" </method>"
-" <method name='ItipRebuildSourceList'>"
-" <arg type='t' name='page_id' direction='in'/>"
-" <arg type='s' name='part_id' direction='in'/>"
-" <arg type='s' name='optgroup_id' direction='in'/>"
-" <arg type='s' name='optgroup_label' direction='in'/>"
-" <arg type='s' name='option_id' direction='in'/>"
-" <arg type='s' name='option_label' direction='in'/>"
-" <arg type='b' name='writable' direction='in'/>"
-" </method>"
-" </interface>"
-"</node>";
-
-G_DEFINE_TYPE_WITH_CODE (EWebExtension, e_web_extension, G_TYPE_OBJECT,
- G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
-
-static WebKitWebPage *
-get_webkit_web_page_or_return_dbus_error (GDBusMethodInvocation *invocation,
- WebKitWebExtension *web_extension,
- guint64 page_id)
-{
- WebKitWebPage *web_page = webkit_web_extension_get_page (web_extension, page_id);
- if (!web_page) {
- g_dbus_method_invocation_return_error (
- invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
- "Invalid page ID: %" G_GUINT64_FORMAT, page_id);
- }
- return web_page;
-}
-
-static WebKitDOMDocument *
-get_webkit_document_or_return_dbus_error (GDBusMethodInvocation *invocation,
- WebKitWebExtension *web_extension,
- guint64 page_id)
-{
- WebKitDOMDocument *document;
- WebKitWebPage *web_page;
-
- web_page = webkit_web_extension_get_page (web_extension, page_id);
- if (!web_page) {
- g_dbus_method_invocation_return_error (
- invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
- "Invalid page ID: %" G_GUINT64_FORMAT, page_id);
- return NULL;
- }
-
- document = webkit_web_page_get_dom_document (web_page);
- if (!document) {
- g_dbus_method_invocation_return_error (
- invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
- "No document for page ID: %" G_GUINT64_FORMAT, page_id);
- return NULL;
- }
-
- return document;
-}
-
-static WebKitDOMDocument *
-find_webkit_document_for_partid_or_return_dbus_error (GDBusMethodInvocation *invocation,
- WebKitDOMDocument *owner,
- const gchar *part_id)
-{
- WebKitDOMElement *element;
-
- g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- g_return_val_if_fail (WEBKIT_DOM_IS_DOCUMENT (owner), NULL);
- g_return_val_if_fail (part_id && *part_id, NULL);
-
- element = e_dom_utils_find_element_by_id (owner, part_id);
- if (element && WEBKIT_DOM_IS_HTML_IFRAME_ELEMENT (element)) {
- WebKitDOMDocument *document = webkit_dom_html_iframe_element_get_content_document
(WEBKIT_DOM_HTML_IFRAME_ELEMENT (element));
- return document;
- }
-
- if (element)
- g_dbus_method_invocation_return_error (
- invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
- "Part ID '%s' is not IFRAME, but %s", part_id, G_OBJECT_TYPE_NAME (element));
- else
- g_dbus_method_invocation_return_error (
- invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
- "Part ID '%s' not found", part_id);
- return NULL;
-}
-
-static void
-element_clicked_cb (WebKitDOMElement *element,
- WebKitDOMEvent *event,
- gpointer user_data)
-{
- EWebExtension *extension = user_data;
- WebKitDOMElement *offset_parent;
- WebKitDOMDOMWindow *dom_window = NULL;
- gchar *attr_class, *attr_value;
- const guint64 *ppage_id;
- gdouble with_parents_left, with_parents_top;
- glong scroll_x = 0, scroll_y = 0;
- GError *error = NULL;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (G_IS_OBJECT (element));
-
- ppage_id = g_object_get_data (G_OBJECT (element), WEB_EXTENSION_PAGE_ID_KEY);
- g_return_if_fail (ppage_id != NULL);
-
- with_parents_left = webkit_dom_element_get_offset_left (element);
- with_parents_top = webkit_dom_element_get_offset_top (element);
-
- offset_parent = element;
- while (offset_parent = webkit_dom_element_get_offset_parent (offset_parent), offset_parent) {
- with_parents_left += webkit_dom_element_get_offset_left (offset_parent);
- with_parents_top += webkit_dom_element_get_offset_top (offset_parent);
- }
-
- dom_window = webkit_dom_document_get_default_view (webkit_dom_node_get_owner_document
(WEBKIT_DOM_NODE (element)));
- while (WEBKIT_DOM_IS_DOM_WINDOW (dom_window)) {
- WebKitDOMDOMWindow *parent_dom_window = webkit_dom_dom_window_get_parent (dom_window);
- WebKitDOMElement *frame_element;
- glong scrll_x = 0, scrll_y = 0;
-
- frame_element = webkit_dom_dom_window_get_frame_element (dom_window);
-
- if (parent_dom_window != dom_window && frame_element) {
- with_parents_left += webkit_dom_element_get_client_left (frame_element);
- with_parents_top += webkit_dom_element_get_client_top (frame_element);
- }
-
- while (frame_element) {
- with_parents_left += webkit_dom_element_get_offset_left (frame_element);
- with_parents_top += webkit_dom_element_get_offset_top (frame_element);
-
- frame_element = webkit_dom_element_get_offset_parent (frame_element);
- }
-
- g_object_get (G_OBJECT (dom_window),
- "scroll-x", &scrll_x,
- "scroll-y", &scrll_y,
- NULL);
-
- scroll_x += scrll_x;
- scroll_y += scrll_y;
-
- if (parent_dom_window == dom_window) {
- g_clear_object (&parent_dom_window);
- break;
- }
-
- g_object_unref (dom_window);
- dom_window = parent_dom_window;
- }
- g_clear_object (&dom_window);
-
- attr_class = webkit_dom_element_get_class_name (element);
- attr_value = webkit_dom_element_get_attribute (element, "value");
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "ElementClicked",
- g_variant_new ("(tssiiii)", *ppage_id, attr_class ? attr_class : "", attr_value ? attr_value
: "",
- (gint) (with_parents_left - scroll_x),
- (gint) (with_parents_top - scroll_y),
- (gint) webkit_dom_element_get_offset_width (element),
- (gint) webkit_dom_element_get_offset_height (element)),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal ElementClicked: %s\n", error->message);
- g_error_free (error);
- }
-
- g_free (attr_class);
- g_free (attr_value);
-}
-
-static void
-web_extension_register_element_clicked_in_document (EWebExtension *extension,
- guint64 page_id,
- WebKitDOMDocument *document,
- const gchar *element_class)
-{
- WebKitDOMHTMLCollection *collection = NULL;
- gulong ii, len;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (WEBKIT_DOM_IS_DOCUMENT (document));
- g_return_if_fail (element_class && *element_class);
-
- collection = webkit_dom_document_get_elements_by_class_name_as_html_collection (document,
element_class);
- if (collection) {
- len = webkit_dom_html_collection_get_length (collection);
- for (ii = 0; ii < len; ii++) {
- WebKitDOMNode *node;
-
- node = webkit_dom_html_collection_item (collection, ii);
- if (WEBKIT_DOM_IS_EVENT_TARGET (node)) {
- guint64 *ppage_id;
-
- ppage_id = g_new0 (guint64, 1);
- *ppage_id = page_id;
-
- g_object_set_data_full (G_OBJECT (node), WEB_EXTENSION_PAGE_ID_KEY, ppage_id,
g_free);
-
- /* Remove first, in case there was a listener already (it's when
- the page is dynamically filled and not all the elements are
- available in time of the first call. */
- webkit_dom_event_target_remove_event_listener (
- WEBKIT_DOM_EVENT_TARGET (node), "click",
- G_CALLBACK (element_clicked_cb), FALSE);
-
- webkit_dom_event_target_add_event_listener (
- WEBKIT_DOM_EVENT_TARGET (node), "click",
- G_CALLBACK (element_clicked_cb), FALSE, extension);
- }
- }
- }
- g_clear_object (&collection);
-
- /* Traverse also iframe-s */
- collection = webkit_dom_document_get_elements_by_tag_name_as_html_collection (document, "iframe");
- if (collection) {
- len = webkit_dom_html_collection_get_length (collection);
- for (ii = 0; ii < len; ii++) {
- WebKitDOMNode *node;
-
- node = webkit_dom_html_collection_item (collection, ii);
- if (WEBKIT_DOM_IS_HTML_IFRAME_ELEMENT (node)) {
- WebKitDOMDocument *content;
-
- content = webkit_dom_html_iframe_element_get_content_document
(WEBKIT_DOM_HTML_IFRAME_ELEMENT (node));
- if (content)
- web_extension_register_element_clicked_in_document (extension,
page_id, content, element_class);
- }
- }
- }
- g_clear_object (&collection);
-}
-
-static guint64
-e_web_extension_find_page_id_from_document (WebKitDOMDocument *document)
-{
- guint64 *ppage_id;
-
- g_return_val_if_fail (WEBKIT_DOM_IS_DOCUMENT (document), 0);
-
- while (document) {
- WebKitDOMDocument *prev_document = document;
-
- ppage_id = g_object_get_data (G_OBJECT (document), WEB_EXTENSION_PAGE_ID_KEY);
- if (ppage_id)
- return *ppage_id;
-
- document = webkit_dom_node_get_owner_document (WEBKIT_DOM_NODE (document));
- if (prev_document == document)
- break;
- }
-
- return 0;
-}
-
-static EWebPageData *
-e_web_extension_get_page_data (EWebExtension *extension,
- guint64 page_id)
-{
- GSList *link;
-
- for (link = extension->priv->pages; link; link = g_slist_next (link)) {
- EWebPageData *page_data = link->data;
-
- if (page_data && webkit_web_page_get_id (page_data->web_page) == page_id)
- return page_data;
- }
-
- return NULL;
-}
-
-static void
-e_web_extension_set_need_input (EWebExtension *extension,
- guint64 page_id,
- gboolean need_input)
-{
- EWebPageData *page_data;
- GError *error = NULL;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (page_id != 0);
-
- page_data = e_web_extension_get_page_data (extension, page_id);
-
- if (!page_data || (!page_data->need_input) == (!need_input))
- return;
-
- page_data->need_input = need_input;
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "NeedInputChanged",
- g_variant_new ("(tb)", page_id, need_input),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal NeedInputChanged: %s\n", error->message);
- g_error_free (error);
- }
-}
-
-static void
-element_focus_cb (WebKitDOMElement *element,
- WebKitDOMEvent *event,
- EWebExtension *extension)
-{
- guint64 *ppage_id;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- ppage_id = g_object_get_data (G_OBJECT (element), WEB_EXTENSION_PAGE_ID_KEY);
- g_return_if_fail (ppage_id != NULL);
-
- e_web_extension_set_need_input (extension, *ppage_id, TRUE);
-}
-
-static void
-element_blur_cb (WebKitDOMElement *element,
- WebKitDOMEvent *event,
- EWebExtension *extension)
-{
- guint64 *ppage_id;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- ppage_id = g_object_get_data (G_OBJECT (element), WEB_EXTENSION_PAGE_ID_KEY);
- g_return_if_fail (ppage_id != NULL);
-
- e_web_extension_set_need_input (extension, *ppage_id, FALSE);
-}
-
-static void
-e_web_extension_bind_focus_and_blur_recursively (EWebExtension *extension,
- WebKitDOMDocument *document,
- const gchar *selector,
- guint64 page_id)
-{
- WebKitDOMNodeList *nodes = NULL;
- WebKitDOMHTMLCollection *frames = NULL;
- gulong ii, length;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- nodes = webkit_dom_document_query_selector_all (document, selector, NULL);
-
- length = webkit_dom_node_list_get_length (nodes);
- for (ii = 0; ii < length; ii++) {
- WebKitDOMNode *node;
- guint64 *ppage_id;
-
- node = webkit_dom_node_list_item (nodes, ii);
-
- ppage_id = g_new (guint64, 1);
- *ppage_id = page_id;
-
- g_object_set_data_full (G_OBJECT (node), WEB_EXTENSION_PAGE_ID_KEY, ppage_id, g_free);
-
- webkit_dom_event_target_add_event_listener (
- WEBKIT_DOM_EVENT_TARGET (node), "focus",
- G_CALLBACK (element_focus_cb), FALSE, extension);
-
- webkit_dom_event_target_add_event_listener (
- WEBKIT_DOM_EVENT_TARGET (node), "blur",
- G_CALLBACK (element_blur_cb), FALSE, extension);
- }
- g_clear_object (&nodes);
-
- frames = webkit_dom_document_get_elements_by_tag_name_as_html_collection (document, "iframe");
- length = webkit_dom_html_collection_get_length (frames);
-
- /* Add rules to every sub document */
- for (ii = 0; ii < length; ii++) {
- WebKitDOMDocument *content_document = NULL;
- WebKitDOMNode *node;
-
- node = webkit_dom_html_collection_item (frames, ii);
- content_document =
- webkit_dom_html_iframe_element_get_content_document (
- WEBKIT_DOM_HTML_IFRAME_ELEMENT (node));
-
- if (!content_document)
- continue;
-
- e_web_extension_bind_focus_and_blur_recursively (
- extension,
- content_document,
- selector,
- page_id);
- }
- g_clear_object (&frames);
-}
-
-static void
-e_web_extension_bind_focus_on_elements (EWebExtension *extension,
- WebKitDOMDocument *document)
-{
- const gchar *elements = "input, textarea, select, button, label";
- guint64 page_id;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (WEBKIT_DOM_IS_DOCUMENT (document));
-
- page_id = e_web_extension_find_page_id_from_document (document);
- g_return_if_fail (page_id != 0);
-
- e_web_extension_bind_focus_and_blur_recursively (
- extension,
- document,
- elements,
- page_id);
-}
-
-typedef struct _MailPartAppearedData {
- GWeakRef *dbus_connection;
- GWeakRef *web_page;
- gchar *element_id;
- GVariant *params;
-} MailPartAppearedData;
-
-static void
-mail_part_appeared_data_free (gpointer ptr)
-{
- MailPartAppearedData *mpad = ptr;
-
- if (mpad) {
- e_weak_ref_free (mpad->dbus_connection);
- e_weak_ref_free (mpad->web_page);
- g_free (mpad->element_id);
- if (mpad->params)
- g_variant_unref (mpad->params);
- g_free (mpad);
- }
-}
-
-static gboolean
-web_extension_can_emit_mail_part_appeared (WebKitWebPage *web_page,
- const gchar *element_id,
- gboolean *out_abort_wait)
-{
- WebKitDOMDocument *document;
- WebKitDOMElement *element;
- WebKitDOMElement *iframe;
- WebKitDOMDocument *iframe_document;
- WebKitDOMHTMLElement *iframe_body;
-
- g_return_val_if_fail (out_abort_wait != NULL, FALSE);
-
- *out_abort_wait = TRUE;
-
- if (!web_page)
- return FALSE;
-
- if (!element_id || !*element_id)
- return FALSE;
-
- document = webkit_web_page_get_dom_document (web_page);
- if (!document)
- return FALSE;
-
- element = e_dom_utils_find_element_by_id (document, element_id);
-
- if (!WEBKIT_DOM_IS_HTML_ELEMENT (element))
- return FALSE;
-
- iframe = webkit_dom_element_query_selector (element, "iframe", NULL);
- if (!iframe)
- return FALSE;
-
- iframe_document = webkit_dom_html_iframe_element_get_content_document (WEBKIT_DOM_HTML_IFRAME_ELEMENT
(iframe));
- if (!iframe_document)
- return FALSE;
-
- iframe_body = webkit_dom_document_get_body (iframe_document);
- if (!iframe_body)
- return FALSE;
-
- *out_abort_wait = FALSE;
-
- return webkit_dom_element_get_first_element_child (WEBKIT_DOM_ELEMENT (iframe_body)) != NULL;
-}
-
-static gboolean
-web_extension_emit_mail_part_appeared_cb (gpointer user_data)
-{
- MailPartAppearedData *mpad = user_data;
- GDBusConnection *dbus_connection;
- WebKitWebPage *web_page;
- gboolean abort_wait = TRUE;
-
- g_return_val_if_fail (mpad != NULL, FALSE);
-
- dbus_connection = g_weak_ref_get (mpad->dbus_connection);
- web_page = g_weak_ref_get (mpad->web_page);
-
- if (dbus_connection && web_page &&
- web_extension_can_emit_mail_part_appeared (web_page, mpad->element_id, &abort_wait)) {
- GError *error = NULL;
-
- g_dbus_connection_emit_signal (
- dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "MailPartAppeared",
- mpad->params,
- &error);
-
- if (error) {
- g_warning ("Error emitting signal MailPartAppeared: %s", error->message);
- g_error_free (error);
- }
-
- abort_wait = TRUE;
- mpad->params = NULL;
- }
-
- if (abort_wait)
- mail_part_appeared_data_free (mpad);
-
- g_clear_object (&dbus_connection);
- g_clear_object (&web_page);
-
- return !abort_wait;
-}
-
-static void
-handle_method_call (GDBusConnection *connection,
- const char *sender,
- const char *object_path,
- const char *interface_name,
- const char *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data)
-{
- guint64 page_id;
- EWebExtension *extension = E_WEB_EXTENSION (user_data);
- WebKitDOMDocument *document;
- WebKitWebExtension *web_extension = extension->priv->wk_extension;
- WebKitWebPage *web_page;
-
- if (g_strcmp0 (interface_name, E_WEB_EXTENSION_INTERFACE) != 0)
- return;
-
- if (camel_debug ("webkit:preview"))
- printf ("EWebExtension - %s - %s\n", G_STRFUNC, method_name);
-
- if (g_strcmp0 (method_name, "GetExtensionHandlesPages") == 0) {
- GVariantBuilder *builder;
- GSList *link;
-
- builder = g_variant_builder_new (G_VARIANT_TYPE ("at"));
-
- for (link = extension->priv->pages; link; link = g_slist_next (link)) {
- EWebPageData *page_data = link->data;
-
- if (page_data) {
- g_variant_builder_add (builder, "t", webkit_web_page_get_id
(page_data->web_page));
- g_variant_builder_add (builder, "t", (guint64) page_data->stamp);
- }
- }
-
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("(at)", builder));
-
- g_variant_builder_unref (builder);
- } else if (g_strcmp0 (method_name, "RegisterElementClicked") == 0) {
- const gchar *element_class = NULL;
-
- g_variant_get (parameters, "(t&s)", &page_id, &element_class);
-
- web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
- if (!web_page)
- return;
-
- if (!element_class || !*element_class) {
- g_warn_if_fail (element_class && *element_class);
- } else {
- document = webkit_web_page_get_dom_document (web_page);
- web_extension_register_element_clicked_in_document (extension, page_id, document,
element_class);
- }
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "SetElementHidden") == 0) {
- const gchar *element_id = NULL;
- gboolean hidden = FALSE;
-
- g_variant_get (parameters, "(t&sb)", &page_id, &element_id, &hidden);
-
- web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
- if (!web_page)
- return;
-
- if (!element_id || !*element_id) {
- g_warn_if_fail (element_id && *element_id);
- } else {
- gboolean expand_inner_data = FALSE;
-
- document = webkit_web_page_get_dom_document (web_page);
- /* A secret short-cut, to not have two functions for basically the same thing ("hide
attachment" and "hide element") */
- if (!hidden && g_str_has_prefix (element_id, "attachment-wrapper-")) {
- WebKitDOMElement *element;
-
- element = e_dom_utils_find_element_by_id (document, element_id);
-
- if (WEBKIT_DOM_IS_HTML_ELEMENT (element) &&
- webkit_dom_element_get_child_element_count (element) == 0) {
- gchar *inner_html_data;
-
- expand_inner_data = TRUE;
-
- inner_html_data = webkit_dom_element_get_attribute (element,
"inner-html-data");
- if (inner_html_data && *inner_html_data) {
- gchar *related_part_id;
-
- webkit_dom_element_set_inner_html (element, inner_html_data,
NULL);
- webkit_dom_element_remove_attribute (element,
"inner-html-data");
-
- related_part_id = webkit_dom_element_get_attribute (element,
"related-part-id");
- webkit_dom_element_remove_attribute (element,
"related-part-id");
-
- if (related_part_id && *related_part_id) {
- GVariant *params = g_variant_new ("(ts)", page_id,
related_part_id);
- WebKitDOMElement *iframe;
-
- iframe = webkit_dom_element_query_selector (element,
"iframe", NULL);
- if (iframe) {
- WebKitDOMDocument *iframe_document;
-
- iframe_document =
webkit_dom_html_iframe_element_get_content_document (WEBKIT_DOM_HTML_IFRAME_ELEMENT (iframe));
- if (iframe_document) {
- WebKitDOMHTMLElement *iframe_body;
-
- iframe_body =
webkit_dom_document_get_body (iframe_document);
- if (iframe_body &&
!webkit_dom_element_get_first_element_child (WEBKIT_DOM_ELEMENT (iframe_body))) {
- /* The iframe document is
still empty, wait until it's loaded;
- wish being there something
better than this busy-wait... */
- MailPartAppearedData *mpad;
-
- mpad = g_new0
(MailPartAppearedData, 1);
- mpad->dbus_connection =
e_weak_ref_new (extension->priv->dbus_connection);
- mpad->web_page =
e_weak_ref_new (web_page);
- mpad->element_id = g_strdup
(element_id);
- mpad->params = params;
-
- /* Try 10 times per second */
- g_timeout_add (100,
web_extension_emit_mail_part_appeared_cb, mpad);
-
- /* To not emit the signal
below */
- params = NULL;
- }
- }
- }
-
- if (params) {
- GError *error = NULL;
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "MailPartAppeared",
- params,
- &error);
-
- if (error) {
- g_warning ("Error emitting signal
MailPartAppeared: %s", error->message);
- g_error_free (error);
- }
- }
- }
-
- g_free (related_part_id);
- }
-
- g_free (inner_html_data);
- }
- }
-
- e_dom_utils_hide_element (document, element_id, hidden);
-
- if (expand_inner_data)
- e_dom_resize_document_content_to_preview_width (document);
- }
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "SetElementStyleProperty") == 0) {
- const gchar *element_id = NULL, *property_name = NULL, *value = NULL, *priority = NULL;
-
- g_variant_get (parameters, "(t&s&s&s&s)", &page_id, &element_id, &property_name, &value,
&priority);
-
- web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
- if (!web_page)
- return;
-
- if (!element_id || !*element_id || !property_name || !*property_name) {
- g_warn_if_fail (element_id && *element_id);
- g_warn_if_fail (property_name && *property_name);
- } else {
- WebKitDOMElement *element;
- gboolean use_child = FALSE;
- gchar *tmp = NULL;
-
- /* element_id can be also of the form: "id::child", where the change will
- be done on the first child of it */
- use_child = g_str_has_suffix (element_id, "::child");
- if (use_child) {
- tmp = g_strdup (element_id);
- tmp[strlen (tmp) - 7] = '\0';
-
- element_id = tmp;
- }
-
- document = webkit_web_page_get_dom_document (web_page);
- element = e_dom_utils_find_element_by_id (document, element_id);
-
- if (use_child && element)
- element = webkit_dom_element_get_first_element_child (element);
-
- if (element) {
- WebKitDOMCSSStyleDeclaration *css;
-
- css = webkit_dom_element_get_style (element);
-
- if (value && *value)
- webkit_dom_css_style_declaration_set_property (css, property_name,
value, priority, NULL);
- else
- g_free (webkit_dom_css_style_declaration_remove_property (css,
property_name, NULL));
-
- g_clear_object (&css);
- }
-
- g_free (tmp);
- }
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "SetElementAttribute") == 0) {
- const gchar *element_id = NULL, *namespace_uri = NULL, *qualified_name = NULL, *value = NULL;
-
- g_variant_get (parameters, "(t&s&s&s&s)", &page_id, &element_id, &namespace_uri,
&qualified_name, &value);
-
- web_page = get_webkit_web_page_or_return_dbus_error (invocation, web_extension, page_id);
- if (!web_page)
- return;
-
- if (!element_id || !*element_id || !qualified_name || !*qualified_name) {
- g_warn_if_fail (element_id && *element_id);
- g_warn_if_fail (qualified_name && *qualified_name);
- } else {
- WebKitDOMElement *element;
- gboolean use_child = FALSE;
- gchar *tmp = NULL;
-
- /* element_id can be also of the form: "id::child", where the change will
- be done on the first child of it */
- use_child = g_str_has_suffix (element_id, "::child");
- if (use_child) {
- tmp = g_strdup (element_id);
- tmp[strlen (tmp) - 7] = '\0';
-
- element_id = tmp;
- }
-
- if (namespace_uri && !*namespace_uri)
- namespace_uri = NULL;
-
- document = webkit_web_page_get_dom_document (web_page);
- element = e_dom_utils_find_element_by_id (document, element_id);
-
- if (use_child && element)
- element = webkit_dom_element_get_first_element_child (element);
-
- if (element) {
- if (value && *value)
- webkit_dom_element_set_attribute_ns (element, namespace_uri,
qualified_name, value, NULL);
- else
- webkit_dom_element_remove_attribute_ns (element, namespace_uri,
qualified_name);
- }
-
- g_free (tmp);
- }
-
- 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;
-
- 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);
- html_content = e_dom_utils_get_document_content_html (document);
-
- g_dbus_method_invocation_return_value (
- 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;
-
- 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);
- html_content = e_dom_utils_get_selection_content_html (document);
-
- g_dbus_method_invocation_return_value (
- invocation,
- g_variant_new (
- "(@s)",
- g_variant_new_take_string (
- html_content ? html_content : g_strdup (""))));
- } else if (g_strcmp0 (method_name, "GetSelectionContentMultipart") == 0) {
- gchar *text_content;
- gboolean is_html = FALSE;
-
- 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);
- text_content = e_dom_utils_get_selection_content_multipart (document, &is_html);
-
- g_dbus_method_invocation_return_value (
- invocation,
- g_variant_new (
- "(@sb)",
- g_variant_new_take_string (
- text_content ? text_content : g_strdup ("")),
- is_html));
- } else if (g_strcmp0 (method_name, "GetSelectionContentText") == 0) {
- gchar *text_content;
-
- 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);
- text_content = e_dom_utils_get_selection_content_text (document);
-
- g_dbus_method_invocation_return_value (
- invocation,
- g_variant_new (
- "(@s)",
- g_variant_new_take_string (
- text_content ? text_content : g_strdup (""))));
- } else if (g_strcmp0 (method_name, "AddCSSRuleIntoStyleSheet") == 0) {
- const gchar *style_sheet_id, *selector, *style;
-
- g_variant_get (
- parameters,
- "(t&s&s&s)",
- &page_id, &style_sheet_id, &selector, &style);
-
- 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);
- e_dom_utils_add_css_rule_into_style_sheet (document, style_sheet_id, selector, style);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "CreateAndAddCSSStyleSheet") == 0) {
- const gchar *style_sheet_id;
-
- g_variant_get (parameters, "(t&s)", &page_id, &style_sheet_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);
- e_dom_utils_create_and_add_css_style_sheet (document, style_sheet_id);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "EABContactFormatterBindDOM") == 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;
-
- document = webkit_web_page_get_dom_document (web_page);
- e_dom_utils_eab_contact_formatter_bind_dom (document);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "EMailDisplayBindDOM") == 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;
-
- document = webkit_web_page_get_dom_document (web_page);
- e_dom_utils_e_mail_display_unstyle_blockquotes (document);
- e_dom_utils_e_mail_display_bind_dom (document, connection);
- e_web_extension_bind_focus_on_elements (extension, document);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "ElementExists") == 0) {
- const gchar *element_id;
- gboolean element_exists;
-
- g_variant_get (parameters, "(t&s)", &page_id, &element_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);
- element_exists = e_dom_utils_element_exists (document, element_id);
-
- g_dbus_method_invocation_return_value (
- invocation, g_variant_new ("(bt)", element_exists, page_id));
- } else if (g_strcmp0 (method_name, "GetActiveElementName") == 0) {
- gchar *element_name;
-
- 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);
- element_name = e_dom_utils_get_active_element_name (document);
-
- g_dbus_method_invocation_return_value (
- 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;
-
- g_variant_get (parameters, "(t&s)", &page_id, &element_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);
- e_dom_utils_e_mail_part_headers_bind_dom_element (document, element_id);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "VCardInlineBindDOM") == 0) {
- const gchar *element_id;
-
- g_variant_get (parameters, "(t&s)", &page_id, &element_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);
- e_dom_utils_module_vcard_inline_bind_dom (
- document, element_id, connection);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "VCardInlineUpdateButton") == 0) {
- const gchar *button_id, *html_label, *access_key;
-
- g_variant_get (
- parameters,
- "(t&s&s&s)",
- &page_id, &button_id, &html_label, &access_key);
-
- 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);
- e_dom_utils_module_vcard_inline_update_button (
- document, button_id, html_label, access_key);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "VCardInlineSetIFrameSrc") == 0) {
- const gchar *src, *button_id;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &button_id, &src);
- 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);
- e_dom_utils_module_vcard_inline_set_iframe_src (document, button_id, src);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "GetDocumentURIFromPoint") == 0) {
- WebKitDOMDocument *document_at_point;
- gchar *document_uri = NULL;
- gint32 xx = 0, yy = 0;
-
- g_variant_get (parameters, "(tii)", &page_id, &xx, &yy);
- 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);
- document_at_point = e_dom_utils_get_document_from_point (document, xx, yy);
-
- if (document_at_point)
- document_uri = webkit_dom_document_get_document_uri (document_at_point);
-
- g_dbus_method_invocation_return_value (
- invocation,
- g_variant_new ("(@s)", g_variant_new_take_string (document_uri ? document_uri :
g_strdup (""))));
- } else if (g_strcmp0 (method_name, "SetDocumentIFrameSrc") == 0) {
- const gchar *document_uri = NULL, *new_iframe_src = NULL;
- WebKitDOMDocument *iframe_document;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &document_uri, &new_iframe_src);
- 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);
- iframe_document = e_dom_utils_find_document_with_uri (document, document_uri);
-
- if (iframe_document) {
- WebKitDOMDOMWindow *dom_window;
- WebKitDOMElement *frame_element;
-
- /* Get frame's window and from the window the actual <iframe> element */
- dom_window = webkit_dom_document_get_default_view (iframe_document);
- frame_element = webkit_dom_dom_window_get_frame_element (dom_window);
- webkit_dom_html_iframe_element_set_src (
- WEBKIT_DOM_HTML_IFRAME_ELEMENT (frame_element), new_iframe_src);
- g_clear_object (&dom_window);
- }
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "ProcessMagicSpacebar") == 0) {
- gboolean towards_bottom = FALSE, processed = FALSE;
- WebKitDOMDOMWindow *dom_window;
- glong inner_height = -1, scroll_y_before = -1, scroll_y_after = -1;
-
- g_variant_get (parameters, "(tb)", &page_id, &towards_bottom);
- 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);
- dom_window = webkit_dom_document_get_default_view (document);
-
- g_object_get (G_OBJECT (dom_window),
- "inner-height", &inner_height,
- "scroll-y", &scroll_y_before,
- NULL);
-
- if (inner_height) {
- webkit_dom_dom_window_scroll_by (dom_window, 0, towards_bottom ? inner_height :
-inner_height);
-
- g_object_get (G_OBJECT (dom_window),
- "scroll-y", &scroll_y_after,
- NULL);
-
- processed = scroll_y_before != scroll_y_after;
- }
-
- g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", processed));
- } else if (g_strcmp0 (method_name, "EWebViewEnsureBodyClass") == 0) {
- const gchar *body_class = NULL;
- WebKitDOMHTMLElement *body;
-
- g_variant_get (parameters, "(t&s)", &page_id, &body_class);
- 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);
-
- body = webkit_dom_document_get_body (document);
- if (body && !webkit_dom_element_has_attribute (WEBKIT_DOM_ELEMENT (body), "class"))
- webkit_dom_element_set_class_name (WEBKIT_DOM_ELEMENT (body), body_class);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- } else if (g_strcmp0 (method_name, "ItipCreateDOMBindings") == 0) {
- const gchar *part_id = NULL;
-
- g_variant_get (parameters, "(t&s)", &page_id, &part_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_create_dom_bindings (document, page_id, part_id,
connection);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipShowButton") == 0) {
- const gchar *button_id, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &button_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_show_button (document, button_id);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipEnableButton") == 0) {
- const gchar *button_id, *part_id = NULL;
- gboolean enable;
-
- g_variant_get (parameters, "(t&s&sb)", &page_id, &part_id, &button_id, &enable);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_enable_button (document, button_id, enable);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipElementSetInnerHTML") == 0) {
- const gchar *element_id, *inner_html, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s)", &page_id, &part_id, &element_id, &inner_html);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_dom_utils_element_set_inner_html (document, element_id, inner_html);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipRemoveElement") == 0) {
- const gchar *element_id, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &element_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_dom_utils_remove_element (document, element_id);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipElementRemoveChildNodes") == 0) {
- const gchar *element_id, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &element_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_dom_utils_element_remove_child_nodes (document, element_id);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipHideElement") == 0) {
- const gchar *element_id, *part_id = NULL;
- gboolean hide;
-
- g_variant_get (parameters, "(t&s&sb)", &page_id, &part_id, &element_id, &hide);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_dom_utils_hide_element (document, element_id, hide);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipElementIsHidden") == 0) {
- const gchar *element_id, *part_id = NULL;
- gboolean hidden;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &element_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- hidden = e_dom_utils_element_is_hidden (document, element_id);
- g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", hidden));
- }
- } else if (g_strcmp0 (method_name, "ItipInputSetChecked") == 0) {
- const gchar *input_id, *part_id = NULL;
- gboolean checked;
-
- g_variant_get (parameters, "(t&s&sb)", &page_id, &part_id, &input_id, &checked);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_input_set_checked (document, input_id, checked);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipInputIsChecked") == 0) {
- const gchar *input_id, *part_id = NULL;
- gboolean checked;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &input_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- checked = e_itip_formatter_dom_utils_input_is_checked (document, input_id);
- g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", checked));
- }
- } else if (g_strcmp0 (method_name, "ItipShowCheckbox") == 0) {
- const gchar *id, *part_id = NULL;
- gboolean show, update_second;
-
- g_variant_get (parameters, "(t&s&sbb)", &page_id, &part_id, &id, &show, &update_second);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_show_checkbox (document, id, show, update_second);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipSetButtonsSensitive") == 0) {
- const gchar *part_id = NULL;
- gboolean sensitive;
-
- g_variant_get (parameters, "(t&sb)", &page_id, &part_id, &sensitive);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_set_buttons_sensitive (document, sensitive);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipSetAreaText") == 0) {
- const gchar *id, *text, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s)", &page_id, &part_id, &id, &text);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_set_area_text (document, id, text);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipElementSetAccessKey") == 0) {
- const gchar *element_id, *access_key, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s)", &page_id, &part_id, &element_id, &access_key);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_element_set_access_key (document, element_id, access_key);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipElementHideChildNodes") == 0) {
- const gchar *element_id, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &element_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_element_hide_child_nodes (document, element_id);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipEnableSelect") == 0) {
- const gchar *select_id, *part_id = NULL;
- gboolean enable;
-
- g_variant_get (parameters, "(t&s&sb)", &page_id, &part_id, &select_id, &enable);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_enable_select (document, select_id, enable);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipSelectIsEnabled") == 0) {
- const gchar *select_id, *part_id = NULL;
- gboolean enabled;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &select_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- enabled = e_itip_formatter_dom_utils_select_is_enabled (document, select_id);
- g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", enabled));
- }
- } else if (g_strcmp0 (method_name, "ItipSelectGetValue") == 0) {
- const gchar *select_id, *part_id = NULL;
- gchar *value;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &select_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- value = e_itip_formatter_dom_utils_select_get_value (document, select_id);
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new (
- "(@s)",
- g_variant_new_take_string (value ? value : g_strdup (""))));
- }
- } else if (g_strcmp0 (method_name, "ItipSelectSetSelected") == 0) {
- const gchar *select_id, *option, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s)", &page_id, &part_id, &select_id, &option);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_select_set_selected (document, select_id, option);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipUpdateTimes") == 0) {
- const gchar *element_id, *header, *label, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s&s)", &page_id, &part_id, &element_id, &header, &label);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_update_times (document, element_id, header, label);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipAppendInfoItemRow") == 0) {
- const gchar *table_id, *row_id, *icon_name, *message, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s&s&s)", &page_id, &part_id, &table_id, &row_id,
&icon_name, &message);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_append_info_item_row (document, table_id, row_id,
icon_name, message);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipEnableTextArea") == 0) {
- const gchar *area_id, *part_id = NULL;
- gboolean enable;
-
- g_variant_get (parameters, "(t&s&sb)", &page_id, &part_id, &area_id, &enable);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_enable_text_area (document, area_id, enable);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipTextAreaSetValue") == 0) {
- const gchar *area_id, *value, *part_id = NULL;
-
- g_variant_get (parameters, "(t&s&s&s)", &page_id, &part_id, &area_id, &value);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_text_area_set_value (document, area_id, value);
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- } else if (g_strcmp0 (method_name, "ItipTextAreaGetValue") == 0) {
- const gchar *area_id, *part_id = NULL;
- gchar *value;
-
- g_variant_get (parameters, "(t&s&s)", &page_id, &part_id, &area_id);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- value = e_itip_formatter_dom_utils_text_area_get_value (document, area_id);
- g_dbus_method_invocation_return_value (invocation,
- g_variant_new (
- "(@s)",
- g_variant_new_take_string (value ? value : g_strdup (""))));
- }
- } else if (g_strcmp0 (method_name, "ItipRebuildSourceList") == 0) {
- const gchar *optgroup_id, *optgroup_label, *option_id, *option_label, *part_id = NULL;
- gboolean writable;
-
- g_variant_get (parameters,"(t&s&s&s&s&sb)", &page_id, &part_id, &optgroup_id,
&optgroup_label, &option_id, &option_label, &writable);
-
- document = get_webkit_document_or_return_dbus_error (invocation, web_extension, page_id);
- if (document)
- document = find_webkit_document_for_partid_or_return_dbus_error (invocation,
document, part_id);
- if (document) {
- e_itip_formatter_dom_utils_rebuild_source_list (
- document,
- optgroup_id,
- optgroup_label,
- option_id,
- option_label,
- writable);
-
- g_dbus_method_invocation_return_value (invocation, NULL);
- }
- }
-}
-
-static GVariant *
-handle_get_property (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *property_name,
- GError **error,
- gpointer user_data)
-{
- /* EWebExtension *extension = E_WEB_EXTENSION (user_data); */
- GVariant *variant = NULL;
-
- g_warn_if_reached ();
-
- return variant;
-}
-
-static gboolean
-handle_set_property (GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *property_name,
- GVariant *variant,
- GError **error,
- gpointer user_data)
-{
- /* EWebExtension *extension = E_WEB_EXTENSION (user_data); */
+#include <webkitdom/webkitdom.h>
- g_warn_if_reached ();
+#include "e-web-extension.h"
- return TRUE;
-}
+struct _EWebExtensionPrivate {
+ WebKitWebExtension *wk_extension;
-static const GDBusInterfaceVTable interface_vtable = {
- handle_method_call,
- handle_get_property,
- handle_set_property
+ gboolean initialized;
};
-static void
-web_page_gone_cb (gpointer user_data,
- GObject *gone_web_page)
-{
- EWebExtension *extension = user_data;
- GSList *link;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- for (link = extension->priv->pages; link; link = g_slist_next (link)) {
- EWebPageData *page_data = link->data;
-
- if (page_data && page_data->web_page == (gpointer) gone_web_page) {
- extension->priv->pages = g_slist_remove (extension->priv->pages, page_data);
- g_free (page_data);
- break;
- }
- }
-}
+G_DEFINE_TYPE_WITH_CODE (EWebExtension, e_web_extension, G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (E_TYPE_EXTENSIBLE, NULL))
static void
e_web_extension_constructed (GObject *object)
@@ -1882,17 +53,6 @@ e_web_extension_dispose (GObject *object)
{
EWebExtension *extension = E_WEB_EXTENSION (object);
- if (extension->priv->dbus_connection) {
- g_dbus_connection_unregister_object (
- extension->priv->dbus_connection,
- extension->priv->registration_id);
- extension->priv->registration_id = 0;
- g_clear_object (&extension->priv->dbus_connection);
- }
-
- g_slist_free_full (extension->priv->pages, g_free);
- extension->priv->pages = NULL;
-
g_clear_object (&extension->priv->wk_extension);
G_OBJECT_CLASS (e_web_extension_parent_class)->dispose (object);
@@ -1907,15 +67,6 @@ e_web_extension_class_init (EWebExtensionClass *class)
object_class->constructed = e_web_extension_constructed;
object_class->dispose = e_web_extension_dispose;
-
- signals[REGISTER_DBUS_CONNECTION] = g_signal_new (
- "register-dbus-connection",
- G_TYPE_FROM_CLASS (class),
- G_SIGNAL_RUN_LAST,
- 0,
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 1, G_TYPE_DBUS_CONNECTION);
}
static void
@@ -1927,7 +78,7 @@ e_web_extension_init (EWebExtension *extension)
}
static gpointer
-e_web_extension_create_instance(gpointer data)
+e_web_extension_create_instance (gpointer data)
{
return g_object_new (E_TYPE_WEB_EXTENSION, NULL);
}
@@ -1936,6 +87,7 @@ EWebExtension *
e_web_extension_get (void)
{
static GOnce once_init = G_ONCE_INIT;
+
return E_WEB_EXTENSION (g_once (&once_init, e_web_extension_create_instance, NULL));
}
@@ -1972,213 +124,15 @@ web_page_send_request_cb (WebKitWebPage *web_page,
return FALSE;
}
-static void
-e_web_extension_store_page_id_on_document (WebKitWebPage *web_page)
-{
- WebKitDOMDocument *document;
- guint64 *ppage_id;
-
- g_return_if_fail (WEBKIT_IS_WEB_PAGE (web_page));
-
- ppage_id = g_new (guint64, 1);
- *ppage_id = webkit_web_page_get_id (web_page);
-
- document = webkit_web_page_get_dom_document (web_page);
-
- g_object_set_data_full (G_OBJECT (document), WEB_EXTENSION_PAGE_ID_KEY, ppage_id, g_free);
-}
-
-static void
-web_page_document_loaded_cb (WebKitWebPage *web_page,
- gpointer user_data)
-{
- WebKitDOMDocument *document;
-
- e_web_extension_store_page_id_on_document (web_page);
-
- document = webkit_web_page_get_dom_document (web_page);
-
- e_dom_utils_replace_local_image_links (document);
-
- if ((webkit_dom_document_query_selector (
- document, "[data-evo-signature-plain-text-mode]", NULL))) {
-
- WebKitDOMHTMLElement *body;
-
- body = webkit_dom_document_get_body (document);
-
- webkit_dom_element_set_attribute (
- WEBKIT_DOM_ELEMENT (body),
- "style",
- "font-family: Monospace;",
- NULL);
- }
-}
-
-static void
-e_web_extension_set_clipboard_flags (EWebExtension *extension,
- WebKitDOMDocument *document,
- guint32 clipboard_flags)
-{
- EWebPageData *page_data = NULL;
- guint64 page_id;
- GError *error = NULL;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (WEBKIT_DOM_IS_DOCUMENT (document));
-
- page_id = e_web_extension_find_page_id_from_document (document);
- g_return_if_fail (page_id != 0);
-
- page_data = e_web_extension_get_page_data (extension, page_id);
-
- if (!page_data || page_data->clipboard_flags == clipboard_flags)
- return;
-
- page_data->clipboard_flags = clipboard_flags;
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "ClipboardFlagsChanged",
- g_variant_new ("(tu)", page_id, clipboard_flags),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal ClipboardFlagsChanged: %s\n", error->message);
- g_error_free (error);
- }
-}
-
-static void
-web_editor_selection_changed_cb (WebKitWebEditor *web_editor,
- EWebExtension *extension)
-{
- WebKitWebPage *web_page;
- WebKitDOMDocument *document;
- guint32 clipboard_flags = 0;
-
- web_page = webkit_web_editor_get_page (web_editor);
-
- document = webkit_web_page_get_dom_document (web_page);
-
- if (e_dom_utils_document_has_selection (document))
- clipboard_flags |= E_CLIPBOARD_CAN_COPY;
-
- e_web_extension_set_clipboard_flags (extension, document, clipboard_flags);
-}
-
-static void
-web_page_notify_uri_cb (GObject *object,
- GParamSpec *param,
- gpointer user_data)
-{
- EWebExtension *extension = user_data;
- WebKitWebPage *web_page;
- GSList *link;
- const gchar *uri;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
-
- web_page = WEBKIT_WEB_PAGE (object);
- uri = webkit_web_page_get_uri (web_page);
-
- for (link = extension->priv->pages; link; link = g_slist_next (link)) {
- EWebPageData *page_data = link->data;
-
- if (page_data && page_data->web_page == web_page) {
- gint new_stamp = 0;
-
- if (uri && *uri) {
- SoupURI *suri;
-
- suri = soup_uri_new (uri);
- if (suri) {
- if (soup_uri_get_query (suri)) {
- GHashTable *form;
-
- form = soup_form_decode (soup_uri_get_query (suri));
- if (form) {
- const gchar *evo_stamp;
-
- evo_stamp = g_hash_table_lookup (form, "evo-stamp");
- if (evo_stamp)
- new_stamp = (gint) g_ascii_strtoll
(evo_stamp, NULL, 10);
-
- g_hash_table_destroy (form);
- }
- }
-
- soup_uri_free (suri);
- }
- }
-
- if (extension->priv->dbus_connection) {
- GError *error = NULL;
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "ExtensionHandlesPage",
- g_variant_new ("(ti)", webkit_web_page_get_id (web_page), new_stamp),
- &error);
-
- if (error) {
- g_warning ("Error emitting signal ExtensionHandlesPage: %s",
error->message);
- g_error_free (error);
- }
- }
-
- page_data->stamp = new_stamp;
- return;
- }
- }
-
- g_warning ("%s: Cannot find web_page %p\n", G_STRFUNC, web_page);
-}
-
static void
web_page_created_cb (WebKitWebExtension *wk_extension,
WebKitWebPage *web_page,
EWebExtension *extension)
{
- EWebPageData *page_data;
-
- page_data = g_new0 (EWebPageData, 1);
- page_data->web_page = web_page;
- page_data->need_input = FALSE;
- page_data->clipboard_flags = 0;
- page_data->stamp = 0;
-
- e_web_extension_store_page_id_on_document (web_page);
-
- extension->priv->pages = g_slist_prepend (extension->priv->pages, page_data);
-
- g_object_weak_ref (G_OBJECT (web_page), web_page_gone_cb, extension);
-
g_signal_connect_object (
web_page, "send-request",
G_CALLBACK (web_page_send_request_cb),
extension, 0);
-
- g_signal_connect_object (
- web_page, "document-loaded",
- G_CALLBACK (web_page_document_loaded_cb),
- extension, 0);
-
- g_signal_connect_object (
- web_page, "notify::uri",
- G_CALLBACK (web_page_notify_uri_cb),
- extension, 0);
-
- g_signal_connect_object (
- webkit_web_page_get_editor (web_page), "selection-changed",
- G_CALLBACK (web_editor_selection_changed_cb),
- extension, 0);
}
static void
@@ -2194,13 +148,13 @@ window_object_cleared_cb (WebKitScriptWorld *world,
gsize data_size = 0;
GError *error = NULL;
- /* Load the ext-utils.js only to the main frame, not to the subframes */
+ /* Load the evolution-utils.js only to the main frame, not to the subframes */
if (!webkit_frame_is_main_frame (frame))
return;
- bytes = g_resources_lookup_data ("/org/gnome/evolution-web-process-extension/js/ext-utils.js",
G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
+ bytes = g_resources_lookup_data ("/org/gnome/evolution-web-process-extension/js/evolution-utils.js",
G_RESOURCE_LOOKUP_FLAGS_NONE, &error);
if (!bytes) {
- g_warning ("Failed to load ext-utils.js: %s", error ? error->message : "Unknown error");
+ g_warning ("Failed to load evolution-utils.js: %s", error ? error->message : "Unknown error");
g_clear_error (&error);
return;
}
@@ -2209,7 +163,7 @@ window_object_cleared_cb (WebKitScriptWorld *world,
data = g_bytes_get_data (bytes, &data_size);
/* Preload utility functions */
- result = jsc_context_evaluate_with_source_uri (jsc_context, data, data_size,
"resource:///org/gnome/evolution-web-process-extension/js/ext-utils.js", 1);
+ result = jsc_context_evaluate_with_source_uri (jsc_context, data, data_size,
"resource:///evolution-utils.js", 1);
if (result) {
JSCException *exception;
@@ -2255,55 +209,6 @@ e_web_extension_initialize (EWebExtension *extension,
G_CALLBACK (window_object_cleared_cb), NULL);
}
-void
-e_web_extension_dbus_register (EWebExtension *extension,
- GDBusConnection *connection)
-{
- GError *error = NULL;
- static GDBusNodeInfo *introspection_data = NULL;
-
- g_return_if_fail (E_IS_WEB_EXTENSION (extension));
- g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
-
- if (!introspection_data) {
- introspection_data =
- g_dbus_node_info_new_for_xml (introspection_xml, NULL);
-
- extension->priv->registration_id =
- g_dbus_connection_register_object (
- connection,
- E_WEB_EXTENSION_OBJECT_PATH,
- introspection_data->interfaces[0],
- &interface_vtable,
- extension,
- NULL,
- &error);
-
- if (!extension->priv->registration_id) {
- g_warning ("Failed to register object: %s\n", error->message);
- g_error_free (error);
- } else {
- extension->priv->dbus_connection = g_object_ref (connection);
-
- g_signal_emit (extension, signals[REGISTER_DBUS_CONNECTION], 0, connection);
-
- g_dbus_connection_emit_signal (
- extension->priv->dbus_connection,
- NULL,
- E_WEB_EXTENSION_OBJECT_PATH,
- E_WEB_EXTENSION_INTERFACE,
- "ExtensionObjectReady",
- NULL,
- &error);
-
- if (error) {
- g_warning ("Error emitting signal ExtensionObjectReady: %s", error->message);
- g_error_free (error);
- }
- }
- }
-}
-
WebKitWebExtension *
e_web_extension_get_webkit_extension (EWebExtension *extension)
{
@@ -2311,11 +216,3 @@ e_web_extension_get_webkit_extension (EWebExtension *extension)
return extension->priv->wk_extension;
}
-
-GDBusConnection *
-e_web_extension_get_dbus_connection (EWebExtension *extension)
-{
- g_return_val_if_fail (E_IS_WEB_EXTENSION (extension), NULL);
-
- return extension->priv->dbus_connection;
-}
diff --git a/src/web-extensions/e-web-extension.h b/src/web-extensions/e-web-extension.h
index 834b63c7fd..b3f15eeda3 100644
--- a/src/web-extensions/e-web-extension.h
+++ b/src/web-extensions/e-web-extension.h
@@ -65,14 +65,9 @@ EWebExtension * e_web_extension_get (void);
void e_web_extension_initialize (EWebExtension *extension,
WebKitWebExtension *wk_extension);
-void e_web_extension_dbus_register (EWebExtension *extension,
- GDBusConnection *connection);
WebKitWebExtension *
e_web_extension_get_webkit_extension
(EWebExtension *extension);
-GDBusConnection *
- e_web_extension_get_dbus_connection
- (EWebExtension *extension);
G_END_DECLS
#endif /* E_WEB_EXTENSION_H */
diff --git a/src/web-extensions/ext-utils.js b/src/web-extensions/evolution-utils.js
similarity index 77%
rename from src/web-extensions/ext-utils.js
rename to src/web-extensions/evolution-utils.js
index b2a102bfbd..8a484e48ae 100644
--- a/src/web-extensions/ext-utils.js
+++ b/src/web-extensions/evolution-utils.js
@@ -516,7 +516,7 @@ Evo.findElementFromPoint = function(doc, xx, yy, parent_elem)
} else {
var left_offset = 0, top_offset = 0, offset_parent, use_parent;
- for (use_parent = parent_elem; use_parent; use_parent =
use_parent.ownerDocument.defaultView.window.frameElement) {
+ for (use_parent = parent_elem; use_parent; use_parent =
use_parent.ownerDocument.defaultView.frameElement) {
offset_parent = use_parent;
do {
left_offset += offset_parent.offsetLeft - offset_parent.scrollLeft;
@@ -526,11 +526,12 @@ Evo.findElementFromPoint = function(doc, xx, yy, parent_elem)
} while (offset_parent);
}
- elem = doc.elementFromPoint(xx - left_offset, yy - top_offset);
+ elem = doc.elementFromPoint(xx - left_offset + window.scrollX, yy - top_offset +
window.scrollY);
}
- if (!elem)
+ if (!elem) {
return parent_elem;
+ }
if (/* !(elem instanceof HTMLIFrameElement) */ elem.tagName.toUpperCase() != "IFRAME") {
return elem;
@@ -607,6 +608,16 @@ Evo.initialize = function(elem)
elems[ii].onblur = function() {
window.webkit.messageHandlers.needInputChanged.postMessage(false); };
}
+ elems = doc.querySelectorAll("img[src^=\"file://\"]");
+
+ for (ii = 0; ii < elems.length; ii++) {
+ elems[ii].src = "evo-" + elems[ii].src;
+ }
+
+ if (doc.body && doc.querySelector("[data-evo-signature-plain-text-mode]")) {
+ doc.body.setAttribute("style", "font-family: Monospace;");
+ }
+
doc.onselectionchange = Evo.selectionChanged;
}
@@ -1077,3 +1088,355 @@ Evo.MailDisplayProcessMagicSpacebar = function(towards_bottom)
Evo.mailDisplayUpdateMagicSpacebarState();
}
+
+var EvoItip = {
+ SELECT_ESOURCE : "select_esource",
+ TEXTAREA_RSVP_COMMENT : "textarea_rsvp_comment",
+ CHECKBOX_RSVP : "checkbox_rsvp",
+ CHECKBOX_RECUR : "checkbox_recur",
+ CHECKBOX_KEEP_ALARM : "checkbox_keep_alarm",
+ CHECKBOX_INHERIT_ALARM : "checkbox_inherit_alarm",
+ CHECKBOX_UPDATE : "checkbox_update",
+ CHECKBOX_FREE_TIME : "checkbox_free_time",
+ TABLE_ROW_BUTTONS : "table_row_buttons"
+};
+
+EvoItip.alarmCheckClickedCb = function(check1)
+{
+ var check2;
+
+ if (check1.id == EvoItip.CHECKBOX_KEEP_ALARM) {
+ check2 = check1.ownerDocument.getElementById(EvoItip.CHECKBOX_INHERIT_ALARM);
+ } else {
+ check2 = check1.ownerDocument.getElementById(EvoItip.CHECKBOX_KEEP_ALARM);
+ }
+
+ if (check2) {
+ check2.disabled = check1.hidden && check1.checked;
+ }
+}
+
+EvoItip.selectedSourceChanged = function(elem)
+{
+ var data = {};
+
+ data["iframe-id"] = elem.ownerDocument.defaultView.frameElement.id;
+ data["source-uid"] = elem.value;
+
+ window.webkit.messageHandlers.itipSourceChanged.postMessage(data);
+}
+
+EvoItip.Initialize = function(iframe_id)
+{
+ var doc = Evo.findIFrameDocument(iframe_id);
+
+ if (!doc) {
+ return;
+ }
+
+ var elem;
+
+ elem = doc.getElementById(EvoItip.SELECT_ESOURCE);
+ if (elem) {
+ elem.onchange = function() { EvoItip.selectedSourceChanged(this); };
+ }
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RECUR);
+ if (elem) {
+ elem.onclick = function() {
window.webkit.messageHandlers.itipRecurToggled.postMessage(this.ownerDocument.defaultView.frameElement.id); };
+ }
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RSVP);
+ if (elem) {
+ elem.onclick = function() {
+ var elem = this.ownerDocument.getElementById(EvoItip.TEXTAREA_RSVP_COMMENT);
+ if (elem) {
+ elem.disabled = !this.checked;
+ }
+ };
+ }
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_INHERIT_ALARM);
+ if (elem) {
+ elem.onclick = function() { EvoItip.alarmCheckClickedCb(this); };
+ }
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_KEEP_ALARM);
+ if (elem) {
+ elem.onclick = function() { EvoItip.alarmCheckClickedCb(this); };
+ }
+}
+
+EvoItip.SetElementInnerHTML = function(iframe_id, element_id, html_content)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem)
+ elem.innerHTML = html_content;
+}
+
+EvoItip.SetShowCheckbox = function(iframe_id, element_id, show, update_second)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ elem.hidden = !show;
+
+ if (elem.nextElementSibling) {
+ elem.nextElementSibling.hidden = !show;
+ }
+
+ if (!show) {
+ elem.checked = false;
+ }
+
+ if (update_second) {
+ EvoItip.alarmCheckClickedCb(elem);
+ }
+
+ elem = elem.ownerDocument.getElementById("table_row_" + element_id);
+ if (elem) {
+ elem.hidden = !show;
+ }
+ }
+}
+
+EvoItip.SetAreaText = function(iframe_id, element_id, text)
+{
+ var row = Evo.findElement(iframe_id, element_id);
+
+ if (row) {
+ row.hidden = text == "";
+
+ if (row.lastElementChild) {
+ row.lastElementChild.innerHTML = text;
+ }
+ }
+}
+
+EvoItip.UpdateTimes = function(iframe_id, element_id, header, label)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ elem.hidden = false;
+
+ if (elem.firstElementChild) {
+ elem.firstElementChild.innerHTML = header;
+ }
+
+ if (elem.lastElementChild) {
+ elem.lastElementChild.innerHTML = label;
+ }
+ }
+}
+
+EvoItip.AppendInfoRow = function(iframe_id, table_id, row_id, icon_name, message)
+{
+ var cell, row, table = Evo.findElement(iframe_id, table_id);
+
+ if (!table) {
+ return;
+ }
+
+ row = table.insertRow(-1);
+ row.id = row_id;
+
+ cell = row.insertCell(-1);
+
+ if (icon_name && icon_name != "") {
+ var img;
+
+ img = table.ownerDocument.createElement("img");
+ img.src = "gtk-stock://" + icon_name;
+
+ cell.appendChild(img);
+ }
+
+ cell = row.insertCell(-1);
+ cell.innerHTML = message;
+}
+
+EvoItip.RemoveInfoRow = function(iframe_id, row_id)
+{
+ var row = Evo.findElement(iframe_id, row_id);
+
+ if (row && row.parentNode) {
+ row.parentNode.removeChild(row);
+ }
+}
+
+EvoItip.RemoveChildNodes = function(iframe_id, element_id)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ while (elem.lastChild) {
+ elem.removeChild(elem.lastChild);
+ }
+ }
+}
+
+EvoItip.AddToSourceList = function(iframe_id, optgroup_id, optgroup_label, option_id, option_label, writable)
+{
+ var doc, select_elem;
+
+ doc = Evo.findIFrameDocument(iframe_id);
+ select_elem = doc ? doc.getElementById(EvoItip.SELECT_ESOURCE) : null;
+
+ if (!select_elem) {
+ return;
+ }
+
+ var option, optgroup;
+
+ optgroup = doc.getElementById (optgroup_id);
+
+ if (!optgroup) {
+ optgroup = doc.createElement("optgroup");
+ optgroup.id = optgroup_id;
+ optgroup.label = optgroup_label;
+
+ select_elem.appendChild(optgroup);
+ }
+
+ option = doc.createElement("option");
+ option.value = option_id;
+ option.label = option_label;
+ option.innerHTML = option_label;
+ option.className = "calendar";
+
+ if (!writable) {
+ option.disabled = true;
+ }
+
+ optgroup.appendChild(option);
+}
+
+EvoItip.HideButtons = function(iframe_id, element_id)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ var child;
+
+ for (child = elem.firstElementChild; child; child = child.nextElementSibling) {
+ var button = child.firstElementChild;
+
+ if (button)
+ button.hidden = true;
+ }
+ }
+}
+
+EvoItip.SetElementAccessKey = function(iframe_id, element_id, access_key)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ elem.accessKey = access_key;
+ }
+}
+
+EvoItip.SetSelectSelected = function(iframe_id, element_id, option_value)
+{
+ var elem = Evo.findElement(iframe_id, element_id);
+
+ if (elem) {
+ var ii;
+
+ for (ii = 0; ii < elem.length; ii++) {
+ if (elem.item(ii).value == option_value) {
+ elem.item(ii).selected = true;
+ break;
+ }
+ }
+ }
+}
+
+EvoItip.SetButtonsDisabled = function(iframe_id, disabled)
+{
+ var doc = Evo.findIFrameDocument(iframe_id);
+
+ if (!doc) {
+ return;
+ }
+
+ var elem, cell;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_UPDATE);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RECUR);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_FREE_TIME);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_KEEP_ALARM);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_INHERIT_ALARM);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RSVP);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.TEXTAREA_RSVP_COMMENT);
+ if (elem)
+ elem.disabled = disabled;
+
+ elem = doc.getElementById(EvoItip.TABLE_ROW_BUTTONS);
+ if (!elem)
+ return;
+
+ for (cell = elem.firstElementChild; cell; cell = cell.nextElementSibling) {
+ var btn = cell.firstElementChild;
+
+ if (btn && !btn.hidden) {
+ btn.disabled = disabled;
+ }
+ }
+}
+
+EvoItip.GetState = function(iframe_id)
+{
+ var doc;
+
+ doc = Evo.findIFrameDocument(iframe_id);
+
+ if (!doc) {
+ return null;
+ }
+
+ var elem, res = {};
+
+ elem = doc.getElementById(EvoItip.TEXTAREA_RSVP_COMMENT);
+ res["rsvp-comment"] = elem ? elem.value : null;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RSVP);
+ res["rsvp-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_UPDATE);
+ res["update-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_RECUR);
+ res["recur-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_FREE_TIME);
+ res["free-time-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_KEEP_ALARM);
+ res["keep-alarm-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ elem = doc.getElementById(EvoItip.CHECKBOX_INHERIT_ALARM);
+ res["inherit-alarm-check"] = elem && elem.checked && !elem.hidden && !elem.disabled;
+
+ return res;
+}
diff --git a/src/web-extensions/evolution-web-process-extension.gresource.xml
b/src/web-extensions/evolution-web-process-extension.gresource.xml
index 0bb6335b7b..9f67996121 100644
--- a/src/web-extensions/evolution-web-process-extension.gresource.xml
+++ b/src/web-extensions/evolution-web-process-extension.gresource.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/evolution-web-process-extension/js">
- <file compressed="true">ext-utils.js</file>
+ <file compressed="true">evolution-utils.js</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]