From 42ccd4ec827aed6f2145c2a3bf5613d7c521fa77 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Sun, 4 Nov 2007 23:00:35 +0000 Subject: Move "address_has_web_scheme" to ephy-embed-utils. svn path=/trunk/; revision=7622 --- embed/ephy-embed-utils.c | 17 +++++++++++++++++ embed/ephy-embed-utils.h | 1 + src/ephy-window.c | 22 ++-------------------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index 4a9c44c85..5fe226309 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -119,3 +119,20 @@ ephy_embed_utils_get_title_composite (EphyEmbed *embed) return title != NULL ? title : ""; } +gboolean +ephy_embed_utils_address_has_web_scheme (const char *address) +{ + gboolean has_web_scheme; + + if (address == NULL) return FALSE; + + has_web_scheme = (g_str_has_prefix (address, "http:") || + g_str_has_prefix (address, "https:") || + g_str_has_prefix (address, "ftp:") || + g_str_has_prefix (address, "file:") || + g_str_has_prefix (address, "data:") || + g_str_has_prefix (address, "about:") || + g_str_has_prefix (address, "gopher:")); + + return has_web_scheme; +} diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h index 861231e0f..cb36073e6 100644 --- a/embed/ephy-embed-utils.h +++ b/embed/ephy-embed-utils.h @@ -31,6 +31,7 @@ G_BEGIN_DECLS char * ephy_embed_utils_link_message_parse (char *message); const char * ephy_embed_utils_get_title_composite (EphyEmbed *embed); +gboolean ephy_embed_utils_address_has_web_scheme (const char *address); G_END_DECLS diff --git a/src/ephy-window.c b/src/ephy-window.c index 2b97ef41e..c2d529588 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -2135,24 +2135,6 @@ tab_size_to_cb (EphyEmbed *embed, } } -static gboolean -address_has_web_scheme (const char *address) -{ - gboolean has_web_scheme; - - if (address == NULL) return FALSE; - - has_web_scheme = (g_str_has_prefix (address, "http:") || - g_str_has_prefix (address, "https:") || - g_str_has_prefix (address, "ftp:") || - g_str_has_prefix (address, "file:") || - g_str_has_prefix (address, "data:") || - g_str_has_prefix (address, "about:") || - g_str_has_prefix (address, "gopher:")); - - return has_web_scheme; -} - static gboolean open_link_in_new (EphyWindow *window, const char *link_address, @@ -2161,7 +2143,7 @@ open_link_in_new (EphyWindow *window, { EphyEmbed *dest; - if (!address_has_web_scheme (link_address)) return FALSE; + if (!ephy_embed_utils_address_has_web_scheme (link_address)) return FALSE; dest = ephy_link_open (EPHY_LINK (window), link_address, embed, state & GDK_SHIFT_MASK ? EPHY_LINK_NEW_WINDOW @@ -2193,7 +2175,7 @@ save_property_url (EphyEmbed *embed, value = ephy_embed_event_get_property (event, property); location = g_value_get_string (value); - if (!address_has_web_scheme (location)) return FALSE; + if (!ephy_embed_utils_address_has_web_scheme (location)) return FALSE; persist = EPHY_EMBED_PERSIST (ephy_embed_factory_new_object (EPHY_TYPE_EMBED_PERSIST)); -- cgit v1.2.3