Always show the icon in the Web Search entry

This commit is contained in:
Arnaud Renevier 2008-08-26 01:59:02 +02:00 committed by Christian Dywan
parent bf28e1097b
commit db599a99d5
2 changed files with 21 additions and 21 deletions

View file

@ -3534,7 +3534,7 @@ midori_browser_init (MidoriBrowser* browser)
gtk_label_new_with_mnemonic (_("_Inline find:"))); gtk_label_new_with_mnemonic (_("_Inline find:")));
gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1); gtk_toolbar_insert (GTK_TOOLBAR (browser->find), toolitem, -1);
browser->find_text = gtk_icon_entry_new (); 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_ICON_ENTRY_PRIMARY,
GTK_STOCK_FIND); GTK_STOCK_FIND);
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),
@ -3549,7 +3549,7 @@ midori_browser_init (MidoriBrowser* browser)
toolitem = gtk_tool_item_new (); toolitem = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (toolitem), browser->find_text); gtk_container_add (GTK_CONTAINER (toolitem), browser->find_text);
gtk_tool_item_set_expand (GTK_TOOL_ITEM (toolitem), TRUE); 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 toolitem = (GtkToolItem*)gtk_action_create_tool_item
(_action_by_name (browser, "FindPrevious")); (_action_by_name (browser, "FindPrevious"));
gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), NULL); gtk_tool_button_set_label (GTK_TOOL_BUTTON (toolitem), NULL);
@ -3875,8 +3875,7 @@ midori_browser_set_property (GObject* object,
&last_web_search, NULL); &last_web_search, NULL);
item = katze_array_get_nth_item (browser->search_engines, item = katze_array_get_nth_item (browser->search_engines,
last_web_search); last_web_search);
if (item) g_object_set (browser->search, "current-item", item, NULL);
g_object_set (browser->search, "current-item", item, NULL);
} }
break; break;
default: default:

View file

@ -234,17 +234,7 @@ midori_search_entry_engines_remove_item_cb (KatzeArray* list,
if (search_entry->current_item == item) if (search_entry->current_item == item)
{ {
found_item = katze_array_get_nth_item (list, 0); found_item = katze_array_get_nth_item (list, 0);
if (found_item) midori_search_entry_set_current_item (search_entry, 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");
}
} }
} }
@ -394,11 +384,13 @@ midori_search_entry_set_search_engines (MidoriSearchEntry* search_entry,
/** /**
* midori_search_entry_set_current_item: * midori_search_entry_set_current_item:
* @search_entry: a #MidoriSearchEntry * @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 * Looks up the specified item in the list of search engines and makes
* it the currently selected item. * 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. * This function fails if @item is not in the current list.
**/ **/
void void
@ -408,18 +400,27 @@ midori_search_entry_set_current_item (MidoriSearchEntry* search_entry,
GdkPixbuf* pixbuf; GdkPixbuf* pixbuf;
g_return_if_fail (MIDORI_IS_SEARCH_ENTRY (search_entry)); 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_SIZE_MENU, GTK_WIDGET (search_entry));
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry), gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (search_entry),
GTK_ICON_ENTRY_PRIMARY, GTK_ICON_ENTRY_PRIMARY,
pixbuf); pixbuf);
g_object_unref (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"); g_object_notify (G_OBJECT (search_entry), "current-item");
} }