diff --git a/midori/midori-browser.c b/midori/midori-browser.c index cba3ddfb..29f7e649 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -3534,7 +3534,7 @@ midori_browser_init (MidoriBrowser* browser) gtk_label_new_with_mnemonic (_("_Inline find:"))); gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1); browser->find_text = gtk_icon_entry_new (); - gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY(browser->find_text), + gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (browser->find_text), GTK_ICON_ENTRY_PRIMARY, GTK_STOCK_FIND); gtk_icon_entry_set_icon_from_stock (GTK_ICON_ENTRY (browser->find_text), @@ -3549,7 +3549,7 @@ midori_browser_init (MidoriBrowser* browser) toolitem = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (toolitem), browser->find_text); gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem), TRUE); - gtk_toolbar_insert (GTK_TOOLBAR(browser->find), toolitem, -1); + gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1); toolitem = (GtkToolItem*)gtk_action_create_tool_item (_action_by_name (browser, "FindPrevious")); gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), NULL); @@ -3875,8 +3875,7 @@ midori_browser_set_property (GObject* object, &last_web_search, NULL); item = katze_array_get_nth_item (browser->search_engines, last_web_search); - if (item) - g_object_set (browser->search, "current-item", item, NULL); + g_object_set (browser->search, "current-item", item, NULL); } break; default: diff --git a/midori/midori-searchentry.c b/midori/midori-searchentry.c index 790dbdb9..a480d58c 100644 --- a/midori/midori-searchentry.c +++ b/midori/midori-searchentry.c @@ -234,17 +234,7 @@ midori_search_entry_engines_remove_item_cb (KatzeArray* list, if (search_entry->current_item == item) { found_item = katze_array_get_nth_item (list, 0); - if (found_item) - midori_search_entry_set_current_item (search_entry, found_item); - else - { - gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), - GTK_ICON_ENTRY_PRIMARY, NULL); - sokoke_entry_set_default_text (GTK_ENTRY (search_entry), ""); - - katze_object_assign (search_entry->current_item, NULL); - g_object_notify (G_OBJECT (search_entry), "current-item"); - } + midori_search_entry_set_current_item (search_entry, found_item); } } @@ -394,11 +384,13 @@ midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry, /** * midori_search_entry_set_current_item: * @search_entry: a #MidoriSearchEntry - * @item: a #KatzeItem + * @item: a #KatzeItem, or %NULL * * Looks up the specified item in the list of search engines and makes * it the currently selected item. * + * Pass %NULL for @item in order to unset the item. + * * This function fails if @item is not in the current list. **/ void @@ -408,18 +400,27 @@ midori_search_entry_set_current_item (MidoriSearchEntry* search_entry, GdkPixbuf* pixbuf; g_return_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry)); - g_return_if_fail (KATZE_IS_ITEM (item)); + g_return_if_fail (!item || KATZE_IS_ITEM (item)); - pixbuf = sokoke_web_icon (katze_item_get_icon (item), + pixbuf = sokoke_web_icon (item ? katze_item_get_icon (item) : NULL, GTK_ICON_SIZE_MENU, GTK_WIDGET (search_entry)); gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), GTK_ICON_ENTRY_PRIMARY, pixbuf); g_object_unref (pixbuf); - sokoke_entry_set_default_text (GTK_ENTRY (search_entry), - katze_item_get_name (item)); - katze_object_assign (search_entry->current_item, g_object_ref (item)); + if (item) + { + katze_object_assign (search_entry->current_item, g_object_ref (item)); + sokoke_entry_set_default_text (GTK_ENTRY (search_entry), + katze_item_get_name (item)); + } + else + { + katze_object_assign (search_entry->current_item, NULL); + sokoke_entry_set_default_text (GTK_ENTRY (search_entry), ""); + } + g_object_notify (G_OBJECT (search_entry), "current-item"); }