Do not load icons other than in tabs

This commit is contained in:
Christian Dywan 2008-11-20 01:41:58 +01:00
parent 72f39b0f82
commit 03ffd05e0a
3 changed files with 10 additions and 36 deletions

View file

@ -213,20 +213,6 @@ katze_array_action_menu_item_activate_cb (GtkWidget* proxy,
g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item); g_signal_emit (array_action, signals[ACTIVATE_ITEM], 0, item);
} }
static void
katze_array_action_icon_cb (GdkPixbuf* icon,
GtkWidget* widget)
{
GtkWidget* image = gtk_image_new_from_pixbuf (icon);
g_object_unref (icon);
gtk_widget_show (image);
if (GTK_IS_IMAGE_MENU_ITEM (widget))
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (widget), image);
else
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (widget), image);
g_object_unref (widget);
}
static void static void
katze_array_action_menu_item_select_cb (GtkWidget* proxy, katze_array_action_menu_item_select_cb (GtkWidget* proxy,
KatzeArrayAction* array_action); KatzeArrayAction* array_action);
@ -264,9 +250,7 @@ katze_array_action_generate_menu (KatzeArrayAction* array_action,
GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL); GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
else else
icon = katze_net_load_icon (array_action->net, icon = katze_net_load_icon (array_action->net,
katze_item_get_uri (item), katze_item_get_uri (item), NULL, proxy, NULL);
(KatzeNetIconCb)katze_array_action_icon_cb,
proxy, g_object_ref (menuitem));
image = gtk_image_new_from_pixbuf (icon); image = gtk_image_new_from_pixbuf (icon);
g_object_unref (icon); g_object_unref (icon);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -415,8 +399,7 @@ katze_array_action_item_notify_cb (KatzeItem* item,
else if (!KATZE_IS_ARRAY (item) && !strcmp (property, "uri")) else if (!KATZE_IS_ARRAY (item) && !strcmp (property, "uri"))
{ {
icon = katze_net_load_icon (array_action->net, katze_item_get_uri (item), icon = katze_net_load_icon (array_action->net, katze_item_get_uri (item),
(KatzeNetIconCb)katze_array_action_icon_cb, NULL, GTK_WIDGET (toolitem), NULL);
GTK_WIDGET (toolitem), g_object_ref (toolitem));
image = gtk_image_new_from_pixbuf (icon); image = gtk_image_new_from_pixbuf (icon);
g_object_unref (icon); g_object_unref (icon);
gtk_widget_show (image); gtk_widget_show (image);
@ -464,8 +447,7 @@ katze_array_action_create_tool_item_for (KatzeArrayAction* array_action,
GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL); GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU, NULL);
else else
icon = katze_net_load_icon (array_action->net, uri, icon = katze_net_load_icon (array_action->net, uri,
(KatzeNetIconCb)katze_array_action_icon_cb, NULL, GTK_WIDGET (toolitem), NULL);
GTK_WIDGET (toolitem), g_object_ref (toolitem));
image = gtk_image_new_from_pixbuf (icon); image = gtk_image_new_from_pixbuf (icon);
g_object_unref (icon); g_object_unref (icon);
gtk_widget_show (image); gtk_widget_show (image);

View file

@ -2598,10 +2598,9 @@ midori_browser_bookmarks_item_render_icon_cb (GtkTreeViewColumn* column,
pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY, pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY,
GTK_ICON_SIZE_MENU, NULL); GTK_ICON_SIZE_MENU, NULL);
else if (katze_item_get_uri (item)) else if (katze_item_get_uri (item))
/* FIXME: Implement icon_cb */
pixbuf = katze_net_load_icon ( pixbuf = katze_net_load_icon (
MIDORI_BROWSER (gtk_widget_get_toplevel (treeview))->net, MIDORI_BROWSER (gtk_widget_get_toplevel (treeview))->net,
katze_item_get_uri (item), NULL, treeview, treeview); katze_item_get_uri (item), NULL, treeview, NULL);
g_object_set (renderer, "pixbuf", pixbuf, NULL); g_object_set (renderer, "pixbuf", pixbuf, NULL);
if (pixbuf) if (pixbuf)
g_object_unref (pixbuf); g_object_unref (pixbuf);
@ -2694,10 +2693,9 @@ midori_browser_history_render_icon_cb (GtkTreeViewColumn* column,
pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY, pixbuf = gtk_widget_render_icon (treeview, GTK_STOCK_DIRECTORY,
GTK_ICON_SIZE_MENU, NULL); GTK_ICON_SIZE_MENU, NULL);
else else
/* FIXME: Implement icon_cb */
pixbuf = katze_net_load_icon ( pixbuf = katze_net_load_icon (
MIDORI_BROWSER (gtk_widget_get_toplevel (treeview))->net, MIDORI_BROWSER (gtk_widget_get_toplevel (treeview))->net,
katze_item_get_uri (item), NULL, treeview, treeview); katze_item_get_uri (item), NULL, treeview, NULL);
g_object_set (renderer, "pixbuf", pixbuf, NULL); g_object_set (renderer, "pixbuf", pixbuf, NULL);
@ -3610,7 +3608,8 @@ _location_action_insert_history_item (MidoriLocationAction* action,
uri = katze_item_get_uri (item); uri = katze_item_get_uri (item);
pixbuf = katze_net_load_icon (browser->net, katze_item_get_uri (item), pixbuf = katze_net_load_icon (browser->net, katze_item_get_uri (item),
NULL, GTK_WIDGET (browser), NULL); NULL, GTK_WIDGET (browser), NULL);
midori_location_action_add_item (action, uri, pixbuf, katze_item_get_name (item)); midori_location_action_add_item (action, uri,
pixbuf, katze_item_get_name (item));
} }
} }

View file

@ -439,11 +439,8 @@ midori_search_action_icon_released_cb (GtkWidget* entry,
menuitem = gtk_image_menu_item_new_with_label ( menuitem = gtk_image_menu_item_new_with_label (
katze_item_get_name (item)); katze_item_get_name (item));
image = gtk_image_new (); image = gtk_image_new ();
/* FIXME: Implement icon_cb */
icon = katze_net_load_icon (MIDORI_SEARCH_ACTION (action)->net, icon = katze_net_load_icon (MIDORI_SEARCH_ACTION (action)->net,
katze_item_get_uri (item), katze_item_get_uri (item), NULL, entry, NULL);
NULL /*(KatzeNetIconCb)midori_browser_bookmark_icon_cb*/,
entry, NULL /*g_object_ref (image)*/);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon); gtk_image_set_from_pixbuf (GTK_IMAGE (image), icon);
g_object_unref (icon); g_object_unref (icon);
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image); gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
@ -496,11 +493,9 @@ midori_search_action_set_entry_icon (MidoriSearchAction* search_action,
if (search_action->current_item) if (search_action->current_item)
{ {
/* FIXME: Implement icon_cb */
icon = katze_net_load_icon (search_action->net, icon = katze_net_load_icon (search_action->net,
katze_item_get_uri (search_action->current_item), katze_item_get_uri (search_action->current_item),
NULL /*(KatzeNetIconCb)midori_browser_bookmark_icon_cb*/, NULL, entry, NULL);
entry, NULL /*g_object_ref (entry)*/);
gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry), gtk_icon_entry_set_icon_from_pixbuf (GTK_ICON_ENTRY (entry),
GTK_ICON_ENTRY_PRIMARY, icon); GTK_ICON_ENTRY_PRIMARY, icon);
g_object_unref (icon); g_object_unref (icon);
@ -736,10 +731,8 @@ midori_search_action_dialog_render_icon_cb (GtkTreeViewColumn* column,
/* FIXME: Use the net of the MidoriSearchAction */ /* FIXME: Use the net of the MidoriSearchAction */
net = katze_net_new (); net = katze_net_new ();
/* FIXME: Implement icon_cb */
icon = katze_net_load_icon (net, katze_item_get_uri (item), icon = katze_net_load_icon (net, katze_item_get_uri (item),
NULL /*(KatzeNetIconCb)midori_search_action_dialog_icon_cb*/, NULL, treeview, NULL);
treeview, NULL /*g_object_ref (treeview)*/);
g_object_set (renderer, "pixbuf", icon, NULL); g_object_set (renderer, "pixbuf", icon, NULL);
g_object_unref (icon); g_object_unref (icon);
g_object_unref (net); g_object_unref (net);