Don't implicitly change the URI when adding to LocationAction

This commit is contained in:
Christian Dywan 2008-08-21 21:49:16 +02:00
parent f6bf2f568d
commit e62ca7a8c0
3 changed files with 5 additions and 29 deletions

View file

@ -483,8 +483,9 @@ midori_web_view_news_feed_ready_cb (MidoriWebView* web_view,
const gchar* title, const gchar* title,
MidoriBrowser* browser) MidoriBrowser* browser)
{ {
midori_location_action_set_secondary_icon (MIDORI_LOCATION_ACTION ( if (web_view == (MidoriWebView*)midori_browser_get_current_web_view (browser))
_action_by_name (browser, "Location")), STOCK_NEWS_FEED); midori_location_action_set_secondary_icon (MIDORI_LOCATION_ACTION (
_action_by_name (browser, "Location")), STOCK_NEWS_FEED);
} }
static gboolean static gboolean

View file

@ -398,8 +398,6 @@ midori_location_action_add_uri (MidoriLocationAction* location_action,
alignment = gtk_bin_get_child (GTK_BIN (proxies->data)); alignment = gtk_bin_get_child (GTK_BIN (proxies->data));
entry = gtk_bin_get_child (GTK_BIN (alignment)); entry = gtk_bin_get_child (GTK_BIN (alignment));
midori_location_entry_set_text (MIDORI_LOCATION_ENTRY (entry), uri);
item.favicon = NULL; item.favicon = NULL;
item.uri = uri; item.uri = uri;
item.title = NULL; item.title = NULL;

View file

@ -377,15 +377,11 @@ void
midori_location_entry_set_item_from_uri (MidoriLocationEntry* location_entry, midori_location_entry_set_item_from_uri (MidoriLocationEntry* location_entry,
const gchar* uri) const gchar* uri)
{ {
gboolean found;
GtkTreeIter iter; GtkTreeIter iter;
g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry)); g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry));
found = midori_location_entry_item_iter (MIDORI_LOCATION_ENTRY (location_entry), if (midori_location_entry_item_iter (location_entry, uri, &iter))
uri,
&iter);
if (found)
midori_location_entry_set_active_iter (location_entry, &iter); midori_location_entry_set_active_iter (location_entry, &iter);
else else
midori_location_entry_clear (location_entry); midori_location_entry_clear (location_entry);
@ -405,34 +401,15 @@ midori_location_entry_add_item (MidoriLocationEntry* location_entry,
{ {
GtkTreeModel* model; GtkTreeModel* model;
GtkTreeIter iter; GtkTreeIter iter;
gboolean item_exists = FALSE;
gchar* uri;
g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry)); g_return_if_fail (MIDORI_IS_LOCATION_ENTRY (location_entry));
g_return_if_fail (item->uri != NULL); g_return_if_fail (item->uri != NULL);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (location_entry)); 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); gtk_list_store_prepend (GTK_LIST_STORE (model), &iter);
midori_location_entry_set_item (location_entry, &iter, item); midori_location_entry_set_item (location_entry, &iter, item);
/*midori_location_entry_set_active_iter (location_entry, &iter);*/
} }