Render search engine icons via the action

This commit is contained in:
Christian Dywan 2011-05-01 18:49:09 +02:00
parent 1636644829
commit 4bab11061c
5 changed files with 13 additions and 14 deletions

View file

@ -215,11 +215,6 @@ static void
midori_browser_set_bookmarks (MidoriBrowser* browser, midori_browser_set_bookmarks (MidoriBrowser* browser,
KatzeArray* bookmarks); KatzeArray* bookmarks);
GdkPixbuf*
midori_search_action_get_icon (KatzeItem* item,
GtkWidget* widget,
const gchar** icon_name);
static void static void
midori_browser_add_speed_dial (MidoriBrowser* browser); midori_browser_add_speed_dial (MidoriBrowser* browser);

View file

@ -16,6 +16,7 @@
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "midori-searchaction.h"
#include <string.h> #include <string.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -497,13 +498,15 @@ midori_location_action_popup_timeout_cb (gpointer data)
{ {
gchar* uri; gchar* uri;
gchar* title; gchar* title;
GdkPixbuf* icon;
uri = sokoke_search_uri (katze_item_get_uri (item), action->key); uri = sokoke_search_uri (katze_item_get_uri (item), action->key);
title = g_strdup_printf (_("Search with %s"), katze_item_get_name (item)); 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, gtk_list_store_insert_with_values (store, NULL, matches + i,
URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25, URI_COL, uri, TITLE_COL, title, YALIGN_COL, 0.25,
BACKGROUND_COL, style ? &style->bg[GTK_STATE_NORMAL] : NULL, 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 (uri);
g_free (title); g_free (title);
i++; i++;

View file

@ -399,8 +399,7 @@ midori_search_action_manage_activate_cb (GtkWidget* menuitem,
gtk_widget_show (dialog); gtk_widget_show (dialog);
} }
/* Private function, used by MidoriView */ GdkPixbuf*
/* static */ GdkPixbuf*
midori_search_action_get_icon (KatzeItem* item, midori_search_action_get_icon (KatzeItem* item,
GtkWidget* widget, GtkWidget* widget,
const gchar** icon_name, const gchar** icon_name,

View file

@ -59,6 +59,12 @@ midori_search_action_set_current_item (MidoriSearchAction* search_action,
KatzeItem* KatzeItem*
midori_search_action_get_default_item (MidoriSearchAction* search_action); 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 void
midori_search_action_set_default_item (MidoriSearchAction* search_action, midori_search_action_set_default_item (MidoriSearchAction* search_action,
KatzeItem* item); KatzeItem* item);

View file

@ -17,6 +17,7 @@
#include "midori-view.h" #include "midori-view.h"
#include "midori-stock.h" #include "midori-stock.h"
#include "midori-browser.h" #include "midori-browser.h"
#include "midori-searchaction.h"
#include "marshal.h" #include "marshal.h"
#include "sokoke.h" #include "sokoke.h"
@ -46,11 +47,6 @@ void
webkit_web_frame_print (WebKitWebFrame* web_frame); webkit_web_frame_print (WebKitWebFrame* web_frame);
#endif #endif
GdkPixbuf*
midori_search_action_get_icon (KatzeItem* item,
GtkWidget* widget,
const gchar** icon_name);
static void static void
midori_view_construct_web_view (MidoriView* view); 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)); menuitem = gtk_image_menu_item_new_with_mnemonic (katze_item_get_name (item));
pixbuf = midori_search_action_get_icon (item, pixbuf = midori_search_action_get_icon (item,
GTK_WIDGET (web_view), &icon_name); GTK_WIDGET (web_view), &icon_name, FALSE);
if (pixbuf) if (pixbuf)
{ {
icon = gtk_image_new_from_pixbuf (pixbuf); icon = gtk_image_new_from_pixbuf (pixbuf);