[evolution/wip-webkit2: 8/11] Port Contacts to WK2
- From: Tomas Popela <tpopela src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip-webkit2: 8/11] Port Contacts to WK2
- Date: Fri, 18 Oct 2013 06:31:47 +0000 (UTC)
commit 98d45de4042de5c20e37872b83457cdb91c79b51
Author: Tomas Popela <tpopela redhat com>
Date: Fri Oct 18 08:25:39 2013 +0200
Port Contacts to WK2
addressbook/gui/widgets/eab-contact-display.c | 34 +++++++++----
addressbook/gui/widgets/eab-contact-formatter.c | 60 -----------------------
addressbook/gui/widgets/eab-contact-formatter.h | 1 -
3 files changed, 23 insertions(+), 72 deletions(-)
---
diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c
index 6586ac6..987beed 100644
--- a/addressbook/gui/widgets/eab-contact-display.c
+++ b/addressbook/gui/widgets/eab-contact-display.c
@@ -387,19 +387,31 @@ contact_display_object_requested (WebKitWebView *web_view,
#endif
static void
-contact_display_load_status_changed (WebKitWebView *web_view,
- GParamSpec *pspec,
- gpointer user_data)
+contact_display_load_changed (WebKitWebView *web_view,
+ WebKitLoadEvent load_event,
+ gpointer user_data)
{
- WebKitLoadStatus load_status;
- WebKitDOMDocument *document;
+ GDBusProxy *web_extension;
+ GVariant* result;
- load_status = webkit_web_view_get_load_status (web_view);
- if (load_status != WEBKIT_LOAD_FINISHED)
+ if (load_event != WEBKIT_LOAD_FINISHED)
return;
- document = webkit_web_view_get_dom_document (web_view);
- eab_contact_formatter_bind_dom (document);
+ web_extension = e_web_view_get_web_extension_proxy (E_WEB_VIEW (web_view));
+ if (web_extension) {
+ result = g_dbus_proxy_call_sync (
+ web_extension,
+ "EABContactFormatterBindDOM",
+ g_variant_new (
+ "(t)",
+ webkit_web_view_get_page_id (web_view)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, //cancellable
+ NULL);
+ if (result)
+ g_variant_unref (result);
+ }
}
static void
@@ -515,8 +527,8 @@ eab_contact_display_init (EABContactDisplay *display)
G_CALLBACK (contact_display_object_requested), display);
#endif
g_signal_connect (
- web_view, "notify::load-status",
- G_CALLBACK (contact_display_load_status_changed), NULL);
+ web_view, "notify::load-changed",
+ G_CALLBACK (contact_display_load_changed), NULL);
g_signal_connect (
web_view, "style-set",
G_CALLBACK (load_contact), NULL);
diff --git a/addressbook/gui/widgets/eab-contact-formatter.c b/addressbook/gui/widgets/eab-contact-formatter.c
index 71f7275..7152902 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.c
+++ b/addressbook/gui/widgets/eab-contact-formatter.c
@@ -1145,63 +1145,3 @@ eab_contact_formatter_format_contact (EABContactFormatter *formatter,
else
render_compact (formatter, contact, output_buffer);
}
-
-static void
-collapse_contacts_list (WebKitDOMEventTarget *event_target,
- WebKitDOMEvent *event,
- gpointer user_data)
-{
- WebKitDOMDocument *document;
- WebKitDOMElement *list;
- gchar *id, *list_id;
- gchar *imagesdir, *src;
- gboolean hidden;
-
- document = user_data;
- id = webkit_dom_html_element_get_id (WEBKIT_DOM_HTML_ELEMENT (event_target));
-
- list_id = g_strconcat ("list-", id, NULL);
- list = webkit_dom_document_get_element_by_id (document, list_id);
- g_free (id);
- g_free (list_id);
-
- if (list == NULL)
- return;
-
- imagesdir = g_filename_to_uri (EVOLUTION_IMAGESDIR, NULL, NULL);
- hidden = webkit_dom_html_element_get_hidden (WEBKIT_DOM_HTML_ELEMENT (list));
-
- if (hidden)
- src = g_strdup_printf ("evo-file://%s/minus.png", imagesdir);
- else
- src = g_strdup_printf ("evo-file://%s/plus.png", imagesdir);
-
- webkit_dom_html_element_set_hidden (
- WEBKIT_DOM_HTML_ELEMENT (list), !hidden);
- webkit_dom_html_image_element_set_src (
- WEBKIT_DOM_HTML_IMAGE_ELEMENT (event_target), src);
-
- g_free (src);
- g_free (imagesdir);
-}
-
-void
-eab_contact_formatter_bind_dom (WebKitDOMDocument *document)
-{
- WebKitDOMNodeList *nodes;
- gulong ii, length;
-
- nodes = webkit_dom_document_get_elements_by_class_name (
- document, "_evo_collapse_button");
-
- length = webkit_dom_node_list_get_length (nodes);
- for (ii = 0; ii < length; ii++) {
-
- WebKitDOMNode *node;
-
- node = webkit_dom_node_list_item (nodes, ii);
- webkit_dom_event_target_add_event_listener (
- WEBKIT_DOM_EVENT_TARGET (node), "click",
- G_CALLBACK (collapse_contacts_list), FALSE, document);
- }
-}
diff --git a/addressbook/gui/widgets/eab-contact-formatter.h b/addressbook/gui/widgets/eab-contact-formatter.h
index 4dc1427..104ba3f 100644
--- a/addressbook/gui/widgets/eab-contact-formatter.h
+++ b/addressbook/gui/widgets/eab-contact-formatter.h
@@ -76,7 +76,6 @@ void eab_contact_formatter_format_contact
(EABContactFormatter *formatter,
EContact *contact,
GString *output_buffer);
-void eab_contact_formatter_bind_dom (WebKitDOMDocument *document);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]