]> spindle.queued.net Git - midori/commitdiff
Always show the icon in the Web Search entry
authorArnaud Renevier <arenevier@fdn.fr>
Mon, 25 Aug 2008 23:59:02 +0000 (01:59 +0200)
committerChristian Dywan <christian@twotoasts.de>
Mon, 25 Aug 2008 23:59:02 +0000 (01:59 +0200)
midori/midori-browser.c
midori/midori-searchentry.c

index cba3ddfb091642fcc4c97ddc0449f98fc209fa4c..29f7e649f2946fb644390319b7a52f1423bcfc32 100644 (file)
@@ -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:
index 790dbdb9590bde750ed4b5bf91da5317e97a877d..a480d58c3ac9912be0faf60bbbb612f645bdbace 100644 (file)
@@ -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");
 }