From 4bab11061c9094f066d906d821ebce9ac5261db3 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 1 May 2011 18:49:09 +0200 Subject: [PATCH] Render search engine icons via the action --- midori/midori-browser.c | 5 ----- midori/midori-locationaction.c | 5 ++++- midori/midori-searchaction.c | 3 +-- midori/midori-searchaction.h | 6 ++++++ midori/midori-view.c | 8 ++------ 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 9f528279..3b01e880 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -215,11 +215,6 @@ static void midori_browser_set_bookmarks (MidoriBrowser* browser, KatzeArray* bookmarks); -GdkPixbuf* -midori_search_action_get_icon (KatzeItem* item, - GtkWidget* widget, - const gchar** icon_name); - static void midori_browser_add_speed_dial (MidoriBrowser* browser); diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index 8e796c55..b56fb77b 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -16,6 +16,7 @@ #include "marshal.h" #include "sokoke.h" #include "midori-browser.h" +#include "midori-searchaction.h" #include #include @@ -497,13 +498,15 @@ midori_location_action_popup_timeout_cb (gpointer data) { gchar* uri; gchar* title; + GdkPixbuf* icon; uri = sokoke_search_uri (katze_item_get_uri (item), action->key); title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item)); + icon = midori_search_action_get_icon (item, action->treeview, NULL, FALSE); gtk_list_store_insert_with_values (store, NULL, matches + i, URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL, - STYLE_COL, 1, FAVICON_COL, NULL, -1); + STYLE_COL, 1, FAVICON_COL, icon, -1); g_free (uri); g_free (title); i++; diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index 279ddb0d..e55fb774 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -399,8 +399,7 @@ midori_search_action_manage_activate_cb (GtkWidget* menuitem, gtk_widget_show (dialog); } -/* Private function, used by MidoriView */ -/* static */ GdkPixbuf* +GdkPixbuf* midori_search_action_get_icon (KatzeItem* item, GtkWidget* widget, const gchar** icon_name, diff --git a/midori/midori-searchaction.h b/midori/midori-searchaction.h index 9eb269f4..c8d0ed88 100644 --- a/midori/midori-searchaction.h +++ b/midori/midori-searchaction.h @@ -59,6 +59,12 @@ midori_search_action_set_current_item (MidoriSearchAction* search_action, KatzeItem* midori_search_action_get_default_item (MidoriSearchAction* search_action); +GdkPixbuf* +midori_search_action_get_icon (KatzeItem* item, + GtkWidget* widget, + const gchar** icon_name, + gboolean in_entry); + void midori_search_action_set_default_item (MidoriSearchAction* search_action, KatzeItem* item); diff --git a/midori/midori-view.c b/midori/midori-view.c index b96377ed..9b26ec75 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -17,6 +17,7 @@ #include "midori-view.h" #include "midori-stock.h" #include "midori-browser.h" +#include "midori-searchaction.h" #include "marshal.h" #include "sokoke.h" @@ -46,11 +47,6 @@ void webkit_web_frame_print (WebKitWebFrame* web_frame); #endif -GdkPixbuf* -midori_search_action_get_icon (KatzeItem* item, - GtkWidget* widget, - const gchar** icon_name); - static void midori_view_construct_web_view (MidoriView* view); @@ -2624,7 +2620,7 @@ midori_view_populate_popup (MidoriView* view, menuitem = gtk_image_menu_item_new_with_mnemonic (katze_item_get_name (item)); pixbuf = midori_search_action_get_icon (item, - GTK_WIDGET (web_view), &icon_name); + GTK_WIDGET (web_view), &icon_name, FALSE); if (pixbuf) { icon = gtk_image_new_from_pixbuf (pixbuf);