]> spindle.queued.net Git - midori/commitdiff
Delete completion actions by list position, not index
authorEnrico Tröger <enrico.troeger@uvena.de>
Sun, 19 Apr 2009 00:35:24 +0000 (02:35 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 19 Apr 2009 00:35:24 +0000 (02:35 +0200)
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.

midori/midori-locationaction.c
midori/midori-websettings.c

index 5036ba64cfd3445fa84b71486fc067aa3b3a1789..7d4ae7332ab7a3dc298bdef10b68fe079cd32cbe 100644 (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);
     }
 
index 29cf757c83fce9cc0910ace59723ceef9a9ea68c..eda71aaef42e46d8d9662dc1bcbc42a18410b2c8 100644 (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,