[epiphany] ephy-embed-utils: add ephy_embed_utils_is_no_show_address()



commit fcb0f328cfb8977dd5ba4a15dc1ed239af8267a2
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Thu Sep 13 18:31:14 2012 +0300

    ephy-embed-utils: add ephy_embed_utils_is_no_show_address()
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683796

 embed/ephy-embed-utils.c |   18 ++++++++++++++++++
 embed/ephy-embed-utils.h |    1 +
 src/ephy-window.c        |   19 +------------------
 3 files changed, 20 insertions(+), 18 deletions(-)
---
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index 5ffa4f0..1622afc 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -163,3 +163,21 @@ ephy_embed_utils_url_is_empty (const char *location)
   return is_empty;
 }
 
+/* This is the list of addresses that should never be shown in the
+ * window's location entry. */
+static const char * do_not_show_address[] = {
+  "about:blank",
+  "ephy-about:overview",
+  NULL
+};
+
+gboolean
+ephy_embed_utils_is_no_show_address (const char *address)
+{
+  int i;
+  for (i = 0; do_not_show_address[i]; i++)
+    if (g_str_equal (address, do_not_show_address[i]))
+      return TRUE;
+
+  return FALSE;
+}
diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h
index 8a65b26..5575c1a 100644
--- a/embed/ephy-embed-utils.h
+++ b/embed/ephy-embed-utils.h
@@ -47,6 +47,7 @@ gboolean ephy_embed_utils_address_has_web_scheme                (const char *add
 gboolean ephy_embed_utils_address_is_existing_absolute_filename (const char *address);
 char*    ephy_embed_utils_normalize_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);
 
 G_END_DECLS
 
diff --git a/src/ephy-window.c b/src/ephy-window.c
index a40f13f..898c7d7 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1479,32 +1479,15 @@ setup_ui_manager (EphyWindow *window)
 				    gtk_ui_manager_get_accel_group (manager));
 }
 
-/* This is the list of addresses that should never be shown in the
- * window's location entry. */
-static const char * do_not_show_address[] = {
-	"about:blank",
-	"ephy-about:overview",
-	NULL
-};
-
 static char *
 calculate_location (const char *typed_address, const char *address)
 {
-	int i;
 	const char *location;
 
 	/* If there's a typed address, use that over address. Never
 	 * show URIs in the 'do_not_show_address' array. */
 	location = typed_address ? typed_address : address;
-	
-	for (i = 0; do_not_show_address[i]; i++)
-	{
-		if (g_str_equal (location, do_not_show_address[i]))
-		{
-			location = NULL;
-			break;
-		}
-	}
+	location = ephy_embed_utils_is_no_show_address (location) ? NULL : location;
 
 	return g_strdup (location);
 }



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