From c44f76abb95d0e61248244f657f5eeee2b7e8ece Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Wed, 7 Dec 2011 23:19:32 +0100 Subject: [PATCH] Avoid setting the same URI on the item given --- midori/midori-browser.c | 10 ++++------ midori/midori-view.c | 11 ++++++----- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index b82bd2b4..71a54760 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -7080,16 +7080,14 @@ gint midori_browser_add_uri (MidoriBrowser* browser, const gchar* uri) { - GtkWidget* view; - gint n; + KatzeItem* item; g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1); g_return_val_if_fail (uri != NULL, -1); - view = midori_view_new_with_title (NULL, browser->settings, FALSE); - n = midori_browser_add_tab (browser, view); - midori_view_set_uri (MIDORI_VIEW (view), uri); - return n; + item = katze_item_new (); + item->uri = g_strdup (uri); + return midori_browser_add_item (browser, item); } /** diff --git a/midori/midori-view.c b/midori/midori-view.c index f55910dc..7be958a8 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -3841,7 +3841,6 @@ midori_view_set_uri (MidoriView* view, #endif katze_assign (view->uri, g_strdup ("")); - katze_item_set_uri (view->item, ""); if (speeddial_markup == NULL) speeddial_markup = prepare_speed_dial_html (view, TRUE); @@ -3955,9 +3954,9 @@ midori_view_set_uri (MidoriView* view, webkit_web_view_load_html_string ( WEBKIT_WEB_VIEW (view->web_view), data, view->uri); g_free (data); - katze_item_set_uri (view->item, uri); + if (strcmp (view->item->uri, view->uri)) + katze_item_set_uri (view->item, view->uri); g_object_notify (G_OBJECT (view), "uri"); - return; } else if (katze_item_get_meta_integer (view->item, "delay") > 0) { @@ -3969,7 +3968,8 @@ midori_view_set_uri (MidoriView* view, _("Loading delayed either due to a recent crash or startup preferences."), _("Load Page"), NULL); - katze_item_set_uri (view->item, uri); + if (strcmp (view->item->uri, uri)) + katze_item_set_uri (view->item, uri); g_object_notify (G_OBJECT (view), "uri"); } else if (g_str_has_prefix (uri, "javascript:")) @@ -3992,7 +3992,8 @@ midori_view_set_uri (MidoriView* view, else { katze_assign (view->uri, midori_uri_format_for_display (uri)); - katze_item_set_uri (view->item, uri); + if (strcmp (view->item->uri, view->uri)) + katze_item_set_uri (view->item, view->uri); g_object_notify (G_OBJECT (view), "uri"); webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), uri); } -- 2.39.5