From baca12963da2829f2208fef44587d2f8780643dc Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Mon, 3 May 2010 12:18:02 +0200 Subject: Move helper function into ephy-embed-utils.c Make url_is_empty a helper function in embed/, since we'll be moving code from EphyShell into EphyEmbed that uses it and we don't want to duplicate it. --- embed/ephy-embed-utils.c | 15 +++++++++++++++ embed/ephy-embed-utils.h | 1 + src/ephy-shell.c | 18 ++---------------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c index e163680be..d0e369052 100644 --- a/embed/ephy-embed-utils.c +++ b/embed/ephy-embed-utils.c @@ -116,3 +116,18 @@ ephy_embed_utils_normalize_address (const char *address) return effective_address; } + +gboolean +ephy_embed_utils_url_is_empty (const char *location) +{ + gboolean is_empty = FALSE; + + if (location == NULL || location[0] == '\0' || + strcmp (location, "about:blank") == 0) + { + is_empty = TRUE; + } + + return is_empty; +} + diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h index 3b6d1b609..28ba0a96c 100644 --- a/embed/ephy-embed-utils.h +++ b/embed/ephy-embed-utils.h @@ -43,6 +43,7 @@ G_BEGIN_DECLS char* ephy_embed_utils_link_message_parse (char *message); gboolean ephy_embed_utils_address_has_web_scheme (const char *address); char* ephy_embed_utils_normalize_address (const char *address); +gboolean ephy_embed_utils_url_is_empty (const char *location); G_END_DECLS diff --git a/src/ephy-shell.c b/src/ephy-shell.c index fc4caf9d1..5e830dcdb 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -367,20 +367,6 @@ ephy_shell_get_default (void) return ephy_shell; } -static gboolean -url_is_empty (const char *location) -{ - gboolean is_empty = FALSE; - - if (location == NULL || location[0] == '\0' || - strcmp (location, "about:blank") == 0) - { - is_empty = TRUE; - } - - return is_empty; -} - static gboolean load_homepage (EphyEmbed *embed) { @@ -396,7 +382,7 @@ load_homepage (EphyEmbed *embed) home = g_strdup ("about:blank"); } - is_empty = url_is_empty (home); + is_empty = ephy_embed_utils_url_is_empty (home); ephy_web_view_load_url (ephy_embed_get_web_view (embed), home); g_free (home); @@ -525,7 +511,7 @@ ephy_shell_new_tab_full (EphyShell *shell, ephy_web_view_load_request (ephy_embed_get_web_view (embed), request); - is_empty = url_is_empty (webkit_network_request_get_uri (request)); + is_empty = ephy_embed_utils_url_is_empty (webkit_network_request_get_uri (request)); } /* Make sure the initial focus is somewhere sensible and not, for -- cgit v1.2.3