Avoid setting the same URI on the item given

This commit is contained in:
Christian Dywan 2011-12-07 23:19:32 +01:00
parent 64f9028eea
commit c44f76abb9
2 changed files with 10 additions and 11 deletions

View file

@ -7080,16 +7080,14 @@ gint
midori_browser_add_uri (MidoriBrowser* browser, midori_browser_add_uri (MidoriBrowser* browser,
const gchar* uri) const gchar* uri)
{ {
GtkWidget* view; KatzeItem* item;
gint n;
g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1); g_return_val_if_fail (MIDORI_IS_BROWSER (browser), -1);
g_return_val_if_fail (uri != NULL, -1); g_return_val_if_fail (uri != NULL, -1);
view = midori_view_new_with_title (NULL, browser->settings, FALSE); item = katze_item_new ();
n = midori_browser_add_tab (browser, view); item->uri = g_strdup (uri);
midori_view_set_uri (MIDORI_VIEW (view), uri); return midori_browser_add_item (browser, item);
return n;
} }
/** /**

View file

@ -3841,7 +3841,6 @@ midori_view_set_uri (MidoriView* view,
#endif #endif
katze_assign (view->uri, g_strdup ("")); katze_assign (view->uri, g_strdup (""));
katze_item_set_uri (view->item, "");
if (speeddial_markup == NULL) if (speeddial_markup == NULL)
speeddial_markup = prepare_speed_dial_html (view, TRUE); 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_load_html_string (
WEBKIT_WEB_VIEW (view->web_view), data, view->uri); WEBKIT_WEB_VIEW (view->web_view), data, view->uri);
g_free (data); 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"); g_object_notify (G_OBJECT (view), "uri");
return;
} }
else if (katze_item_get_meta_integer (view->item, "delay") > 0) 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."), _("Loading delayed either due to a recent crash or startup preferences."),
_("Load Page"), _("Load Page"),
NULL); 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"); g_object_notify (G_OBJECT (view), "uri");
} }
else if (g_str_has_prefix (uri, "javascript:")) else if (g_str_has_prefix (uri, "javascript:"))
@ -3992,7 +3992,8 @@ midori_view_set_uri (MidoriView* view,
else else
{ {
katze_assign (view->uri, midori_uri_format_for_display (uri)); 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"); g_object_notify (G_OBJECT (view), "uri");
webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), uri); webkit_web_view_open (WEBKIT_WEB_VIEW (view->web_view), uri);
} }