]> spindle.queued.net Git - midori/commitdiff
Add a preference Search engines in location completion
authorChristian Dywan <christian@twotoasts.de>
Sat, 18 Apr 2009 21:26:54 +0000 (23:26 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sat, 18 Apr 2009 21:26:54 +0000 (23:26 +0200)
It seems that deletion of completion actions can fail, which means
that the actions remain until the next restart. It is not clear
how to fix this.

midori/midori-browser.c
midori/midori-locationaction.c
midori/midori-preferences.c
midori/midori-websettings.c

index f329c896ea9e48128c3e40cfe9001e44c42cac73..d37eb49d5de5e0f2b8d107d09a070559572995da 100644 (file)
@@ -4569,6 +4569,15 @@ midori_browser_settings_notify (MidoriWebSettings* web_settings,
         browser->show_statusbar = g_value_get_boolean (&value);
     else if (name == g_intern_string ("progress-in-location"))
         browser->progress_in_location = g_value_get_boolean (&value);
+    else if (name == g_intern_string ("search-engines-in-completion"))
+    {
+        if (g_value_get_boolean (&value))
+            midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
+                _action_by_name (browser, "Location")), browser->search_engines);
+        else
+            midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
+                _action_by_name (browser, "Location")), NULL);
+    }
     else if (name == g_intern_string ("location-entry-search"))
     {
         katze_assign (browser->location_entry_search, g_value_dup_string (&value));
@@ -4727,8 +4736,16 @@ midori_browser_set_property (GObject*      object,
     case PROP_SEARCH_ENGINES:
         /* FIXME: Disconnect handlers */
         katze_object_assign (browser->search_engines, g_value_dup_object (value));
-        midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
-            _action_by_name (browser, "Location")), browser->search_engines);
+        if (browser->settings)
+        {
+            if (katze_object_get_boolean (browser->settings,
+                                          "search-engines-in-completion"))
+                midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
+                    _action_by_name (browser, "Location")), browser->search_engines);
+            else
+                midori_location_action_set_search_engines (MIDORI_LOCATION_ACTION (
+                    _action_by_name (browser, "Location")), NULL);
+        }
         midori_search_action_set_search_engines (MIDORI_SEARCH_ACTION (
             _action_by_name (browser, "Search")), browser->search_engines);
         /* FIXME: Connect to updates */
index 030f83d94764cd4f6c678385b7c9a592e4da1ce6..5036ba64cfd3445fa84b71486fc067aa3b3a1789 100644 (file)
@@ -1246,9 +1246,10 @@ 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++);
+        while ((item = katze_array_get_nth_item (location_action->search_engines, i++)))
+            gtk_entry_completion_delete_action (completion, i);
         midori_location_action_add_actions (completion, search_engines);
     }
 
index 3c492e1a6e4d79ddfb26aa77875b62d580429df2..0ca3ea3d240186980f22bd9ca534f307f9425d32 100644 (file)
@@ -553,6 +553,8 @@ midori_preferences_set_settings (MidoriPreferences* preferences,
     FILLED_ADD (button, 1, 2, 0, 1);
     #endif
     button = katze_property_proxy (settings, "progress-in-location", NULL);
+    FILLED_ADD (button, 0, 1, 1, 2);
+    button = katze_property_proxy (settings, "search-engines-in-completion", NULL);
     FILLED_ADD (button, 1, 2, 1, 2);
     FRAME_NEW (_("Browsing"));
     TABLE_NEW (5, 2);
index 40e42fbc557292b9d74764f1c5f3af9d8d18243c..29cf757c83fce9cc0910ace59723ceef9a9ea68c 100644 (file)
@@ -41,6 +41,7 @@ struct _MidoriWebSettings
 
     MidoriToolbarStyle toolbar_style;
     gboolean progress_in_location;
+    gboolean search_engines_in_completion;
     gchar* toolbar_items;
     gboolean compact_sidepanel;
     gboolean right_align_sidepanel;
@@ -110,6 +111,7 @@ enum
 
     PROP_TOOLBAR_STYLE,
     PROP_PROGRESS_IN_LOCATION,
+    PROP_SEARCH_ENGINES_IN_COMPLETION,
     PROP_TOOLBAR_ITEMS,
     PROP_COMPACT_SIDEPANEL,
     PROP_RIGHT_ALIGN_SIDEPANEL,
@@ -481,6 +483,22 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class)
                                      TRUE,
                                      flags));
 
+    /**
+    * MidoriWebSettings:search-engines-in-completion:
+    *
+    * Whether to show search engines in the location completion.
+    *
+    * Since: 0.1.3
+    */
+    g_object_class_install_property (gobject_class,
+                                     PROP_SEARCH_ENGINES_IN_COMPLETION,
+                                     g_param_spec_boolean (
+                                     "search-engines-in-completion",
+                                     _("Search engines in location completion"),
+                                     _("Whether to show search engines in the location completion"),
+                                     TRUE,
+                                     flags));
+
     g_object_class_install_property (gobject_class,
                                      PROP_TOOLBAR_ITEMS,
                                      g_param_spec_string (
@@ -1036,6 +1054,9 @@ midori_web_settings_set_property (GObject*      object,
     case PROP_PROGRESS_IN_LOCATION:
         web_settings->progress_in_location = g_value_get_boolean (value);
         break;
+    case PROP_SEARCH_ENGINES_IN_COMPLETION:
+        web_settings->search_engines_in_completion = g_value_get_boolean (value);
+        break;
     case PROP_TOOLBAR_ITEMS:
         katze_assign (web_settings->toolbar_items, g_value_dup_string (value));
         break;
@@ -1232,6 +1253,9 @@ midori_web_settings_get_property (GObject*    object,
     case PROP_PROGRESS_IN_LOCATION:
         g_value_set_boolean (value, web_settings->progress_in_location);
         break;
+    case PROP_SEARCH_ENGINES_IN_COMPLETION:
+        g_value_set_boolean (value, web_settings->search_engines_in_completion);
+        break;
     case PROP_TOOLBAR_ITEMS:
         g_value_set_string (value, web_settings->toolbar_items);
         break;