Delete completion actions by list position, not index

The completion actions are not actually indiced but merely added
to a list by their relative position. So instead of deleting by
their presumed index we just delete the first one often enough.

Also fix a wrong Since tag in a new setting.
This commit is contained in:
Enrico Tröger 2009-04-19 02:35:24 +02:00 committed by Christian Dywan
parent d7d6edbff3
commit 3b0ce548a5
2 changed files with 7 additions and 7 deletions

View file

@ -208,8 +208,9 @@ midori_location_action_set_model (MidoriLocationAction* location_action,
entry = gtk_bin_get_child (GTK_BIN (location_entry));
g_object_set (location_entry, "model", model, NULL);
g_object_set (gtk_entry_get_completion (GTK_ENTRY (entry)),
"model", model ? location_action->sort_model : NULL, NULL);
gtk_entry_completion_set_model (
gtk_entry_get_completion (GTK_ENTRY (entry)),
model ? location_action->filter_model : NULL);
}
}
@ -770,11 +771,11 @@ midori_location_action_add_actions (GtkEntryCompletion* completion,
return;
i = 0;
while ((item = katze_array_get_nth_item (search_engines, i++)))
while ((item = katze_array_get_nth_item (search_engines, i)))
{
gchar* text = g_strdup_printf (_("Search with %s"),
katze_item_get_name (item));
gtk_entry_completion_insert_action_text (completion, i, text);
gtk_entry_completion_insert_action_text (completion, i++, text);
g_free (text);
}
}
@ -1246,10 +1247,9 @@ midori_location_action_set_search_engines (MidoriLocationAction* location_action
completion = gtk_entry_get_completion (GTK_ENTRY (child));
i = 0;
/* FIXME: Apparently deleting doesn't always work, but why? */
if (location_action->search_engines)
while ((item = katze_array_get_nth_item (location_action->search_engines, i++)))
gtk_entry_completion_delete_action (completion, i);
gtk_entry_completion_delete_action (completion, 0);
midori_location_action_add_actions (completion, search_engines);
}

View file

@ -488,7 +488,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
*
* Whether to show search engines in the location completion.
*
* Since: 0.1.3
* Since: 0.1.6
*/
g_object_class_install_property (gobject_class,
PROP_SEARCH_ENGINES_IN_COMPLETION,