From e62ca7a8c008b2bd194ddaa71a8cb2df3b9a4962 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Thu, 21 Aug 2008 21:49:16 +0200 Subject: [PATCH] Don't implicitly change the URI when adding to LocationAction --- midori/midori-browser.c | 5 +++-- midori/midori-locationaction.c | 2 -- midori/midori-locationentry.c | 27 ++------------------------- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index f59b53f0..a182774e 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -483,8 +483,9 @@ midori_web_view_news_feed_ready_cb (MidoriWebView* web_view, const gchar* title, MidoriBrowser* browser) { - midori_location_action_set_secondary_icon (MIDORI_LOCATION_ACTION ( - _action_by_name (browser, "Location")), STOCK_NEWS_FEED); + if (web_view == (MidoriWebView*)midori_browser_get_current_web_view (browser)) + midori_location_action_set_secondary_icon (MIDORI_LOCATION_ACTION ( + _action_by_name (browser, "Location")), STOCK_NEWS_FEED); } static gboolean diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index bf4de194..d8d285ac 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -398,8 +398,6 @@ midori_location_action_add_uri (MidoriLocationAction* location_action, alignment = gtk_bin_get_child (GTK_BIN (proxies->data)); entry = gtk_bin_get_child (GTK_BIN (alignment)); - midori_location_entry_set_text (MIDORI_LOCATION_ENTRY (entry), uri); - item.favicon = NULL; item.uri = uri; item.title = NULL; diff --git a/midori/midori-locationentry.c b/midori/midori-locationentry.c index bebbac9c..24508505 100644 --- a/midori/midori-locationentry.c +++ b/midori/midori-locationentry.c @@ -377,15 +377,11 @@ void midori_location_entry_set_item_from_uri (MidoriLocationEntry* location_entry, const gchar* uri) { - gboolean found; GtkTreeIter iter; g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry)); - found = midori_location_entry_item_iter (MIDORI_LOCATION_ENTRY (location_entry), - uri, - &iter); - if (found) + if (midori_location_entry_item_iter (location_entry, uri, &iter)) midori_location_entry_set_active_iter (location_entry, &iter); else midori_location_entry_clear (location_entry); @@ -405,34 +401,15 @@ midori_location_entry_add_item (MidoriLocationEntry* location_entry, { GtkTreeModel* model; GtkTreeIter iter; - gboolean item_exists = FALSE; - gchar* uri; g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry)); g_return_if_fail (item->uri != NULL); model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry)); - if (gtk_tree_model_get_iter_first (model, &iter)) - { - uri = NULL; - do - { - gtk_tree_model_get (model, &iter, URI_COL, &uri, -1); - if (g_ascii_strcasecmp (item->uri, uri) == 0) - { - item_exists = TRUE; - g_free (uri); - break; - } - g_free (uri); - } - while (gtk_tree_model_iter_next (model, &iter)); - } - if (!item_exists) + if (!midori_location_entry_item_iter (location_entry, item->uri, &iter)) gtk_list_store_prepend (GTK_LIST_STORE (model), &iter); midori_location_entry_set_item (location_entry, &iter, item); - /*midori_location_entry_set_active_iter (location_entry, &iter);*/ }