[epiphany] ephy-web-view: Move get_title_from_address to ephy-embed-utils



commit 0c6c6bcef6d6f0bbd0f20659ea9bec94a59cc658
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Tue Mar 4 11:50:13 2014 +0100

    ephy-web-view: Move get_title_from_address to ephy-embed-utils
    
    https://bugzilla.gnome.org/show_bug.cgi?id=725649

 embed/ephy-embed-utils.c |   13 +++++++++++++
 embed/ephy-embed-utils.h |    1 +
 embed/ephy-web-view.c    |   18 +++---------------
 3 files changed, 17 insertions(+), 15 deletions(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 30c3085..6f39907 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -289,6 +289,19 @@ ephy_embed_utils_is_no_show_address (const char *address)
   return FALSE;
 }
 
+char *
+ephy_embed_utils_get_title_from_address (const char *address)
+{
+  if (g_str_has_prefix (address, "file://"))
+    return g_strdup (address + 7);
+
+  if (!strcmp (address, EPHY_ABOUT_SCHEME":overview") ||
+      !strcmp (address, "about:overview"))
+    return g_strdup (_("Most Visited"));
+
+  return ephy_string_get_host_name (address);
+}
+
 void
 ephy_embed_utils_shutdown (void)
 {
diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h
index c5d0342..355575c 100644
--- a/embed/ephy-embed-utils.h
+++ b/embed/ephy-embed-utils.h
@@ -45,6 +45,7 @@ char*    ephy_embed_utils_normalize_address                     (const char *add
 char *   ephy_embed_utils_normalize_or_autosearch_address       (const char *address);
 gboolean ephy_embed_utils_url_is_empty                          (const char *location);
 gboolean ephy_embed_utils_is_no_show_address                    (const char *address);
+char    *ephy_embed_utils_get_title_from_address                (const char *address);
 void     ephy_embed_utils_shutdown                              (void);
 
 G_END_DECLS
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 1dfbf93..404b6e4 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -769,18 +769,6 @@ ephy_web_view_finalize (GObject *object)
   G_OBJECT_CLASS (ephy_web_view_parent_class)->finalize (object);
 }
 
-static char*
-get_title_from_address (const char *address)
-{
-  if (g_str_has_prefix (address, "file://"))
-    return g_strdup (address + 7);
-  else if (!strcmp (address, EPHY_ABOUT_SCHEME":overview") ||
-           !strcmp (address, "about:overview"))
-    return g_strdup (_("Most Visited"));
-  else
-    return ephy_string_get_host_name (address);
-}
-
 static void
 _ephy_web_view_set_is_blank (EphyWebView *view,
                              gboolean is_blank)
@@ -802,7 +790,7 @@ ephy_web_view_set_title (EphyWebView *view,
 
   if (title == NULL || g_strstrip (title)[0] == '\0') {
     g_free (title);
-    title = priv->address ? get_title_from_address (priv->address) : NULL;
+    title = priv->address ? ephy_embed_utils_get_title_from_address (priv->address) : NULL;
 
     if (title == NULL || title[0] == '\0') {
       g_free (title);
@@ -833,7 +821,7 @@ title_changed_cb (WebKitWebView *web_view,
   ephy_web_view_set_title (webview, title);
   
   if (!title && uri)
-    title = get_title_from_address (uri);
+    title = ephy_embed_utils_get_title_from_address (uri);
 
   if (uri && title && !ephy_web_view_is_history_frozen (webview))
     ephy_history_service_set_url_title (history, uri, title, NULL, NULL, NULL);
@@ -1528,7 +1516,7 @@ ephy_web_view_set_loading_message (EphyWebView *view,
   if (address) {
     char *title;
 
-    title = get_title_from_address (address);
+    title = ephy_embed_utils_get_title_from_address (address);
 
     if (title != NULL && title[0] != '\0') {
       /* translators: %s here is the address of the web page */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]