From 4b8da0f21ae7ea5a47dbf4a0afce79b1437c3bf2 Mon Sep 17 00:00:00 2001 From: Manuel Rego Casasnovas Date: Mon, 25 Feb 2013 13:13:59 +0100 Subject: Move code to get application title from DOM to ephy-dom-utils https://bugzilla.gnome.org/show_bug.cgi?id=694144 --- src/window-commands.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src/window-commands.c') diff --git a/src/window-commands.c b/src/window-commands.c index 7356b83fd..04b1e29b2 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -48,6 +48,7 @@ #include "ephy-shell.h" #include "ephy-string.h" #include "ephy-web-app-utils.h" +#include "ephy-web-dom-utils.h" #include "ephy-zoom.h" #include "pdm-dialog.h" @@ -701,30 +702,8 @@ fill_default_application_title (EphyApplicationDialogData *data) #ifdef HAVE_WEBKIT2 /* TODO: DOM Bindindgs */ #else - WebKitDOMDocument *document; - WebKitDOMNodeList *metas; - gulong length, i; - - document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (data->view)); - metas = webkit_dom_document_get_elements_by_tag_name (document, "meta"); - length = webkit_dom_node_list_get_length (metas); - - for (i = 0; i < length && title == NULL; i++) - { - char *name; - char *property; - WebKitDOMNode *node = webkit_dom_node_list_item (metas, i); - - name = webkit_dom_html_meta_element_get_name (WEBKIT_DOM_HTML_META_ELEMENT (node)); - property = webkit_dom_element_get_attribute (WEBKIT_DOM_ELEMENT (node), "property"); - if (g_strcmp0 (name, "application-name") == 0 - || g_strcmp0 (property, "og:site_name") == 0) - { - title = webkit_dom_html_meta_element_get_content (WEBKIT_DOM_HTML_META_ELEMENT (node)); - } - g_free (property); - g_free (name); - } + WebKitDOMDocument *document = webkit_web_view_get_dom_document (WEBKIT_WEB_VIEW (data->view)); + title = ephy_web_dom_utils_get_application_title (document); #endif if (title == NULL) -- cgit v1.2.3