]> spindle.queued.net Git - midori/commitdiff
The URI of blank tabs is "", the title is "about:blank".
authorChristian Dywan <christian@twotoasts.de>
Tue, 7 Oct 2008 20:30:09 +0000 (22:30 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 7 Oct 2008 20:30:09 +0000 (22:30 +0200)
Something in the stack seems to magically turn
empty strings into about:blank, which is a problem
if we want to be able to start typing right away
when opening blank tabs.

We simply enforce the desired behaviour now.

midori/midori-app.c
midori/midori-view.c

index 4c77f0c8089a315c2b6783db4c3c895cda78093f..4d2ebb1f2d7878205eb29c3796a900ce4a1ccd79 100644 (file)
@@ -228,7 +228,7 @@ midori_browser_message_received_cb (UniqueApp*         instance,
                               "history", app->history,
                               NULL);
       /* FIXME: Should open the homepage according to settings */
-      midori_browser_add_uri (browser, "about:blank");
+      midori_browser_add_uri (browser, "");
       midori_app_add_browser (app, browser);
       gtk_window_set_screen (GTK_WINDOW (app->browser),
                              unique_message_data_get_screen (message));
index 32181953f1c350aedb69576edbd2cafa3ca4855f..a061c144f5543e8716b201fb0d4fecbd4e4dd4d5 100644 (file)
@@ -2191,8 +2191,9 @@ midori_view_get_icon (MidoriView* view)
  * midori_view_get_display_uri:
  * @view: a #MidoriView
  *
- * Retrieves a string that is suitable for displaying,
- * particularly an empty URI is represented as "about:blank".
+ * Retrieves a string that is suitable for displaying.
+ *
+ * Note that "about:blank" is represented as "".
  *
  * You can assume that the string is not %NULL.
  *
@@ -2201,11 +2202,16 @@ midori_view_get_icon (MidoriView* view)
 const gchar*
 midori_view_get_display_uri (MidoriView* view)
 {
-    g_return_val_if_fail (MIDORI_IS_VIEW (view), "about:blank");
+    g_return_val_if_fail (MIDORI_IS_VIEW (view), "");
+
+    /* Something in the stack tends to turn "" into "about:blank".
+       Yet for practical purposes we prefer "".  */
+    if (view->uri && !strcmp (view->uri, "about:blank"))
+        return "";
 
     if (view->uri && *view->uri)
         return view->uri;
-    return "about:blank";
+    return "";
 }
 
 /**
@@ -2216,6 +2222,8 @@ midori_view_get_display_uri (MidoriView* view)
  * as a title. Most of the time this will be the title
  * or the current URI.
  *
+ * An empty page is represented as "about:blank".
+ *
  * You can assume that the string is not %NULL.
  *
  * Return value: a title string
@@ -2225,6 +2233,9 @@ midori_view_get_display_title (MidoriView* view)
 {
     g_return_val_if_fail (MIDORI_IS_VIEW (view), "about:blank");
 
+    if (view->title && !strcmp (view->title, ""))
+        return "about:blank";
+
     if (view->title && *view->title)
         return view->title;
     return midori_view_get_display_uri (view);