svnno****@sourc*****
svnno****@sourc*****
Tue Sep 1 19:30:02 JST 2009
Revision: 3809 http://sourceforge.jp/projects/kazehakase/svn/view?view=rev&revision=3809 Author: ikezoe Date: 2009-09-01 19:30:02 +0900 (Tue, 01 Sep 2009) Log Message: ----------- * src/actions/kz-actions.c: Cleanup in combine_favicon. Modified Paths: -------------- kazehakase/trunk/ChangeLog kazehakase/trunk/src/actions/kz-actions.c Modified: kazehakase/trunk/ChangeLog =================================================================== --- kazehakase/trunk/ChangeLog 2009-09-01 10:22:10 UTC (rev 3808) +++ kazehakase/trunk/ChangeLog 2009-09-01 10:30:02 UTC (rev 3809) @@ -6,6 +6,7 @@ * etc/kz-ui-*.xml.in: Remove "undo" and "redo" actions. * src/actions/kz-actions.c: Remove "undo" and "redo" actions. cleanup in kz_actions_set_sensitive(). + * src/actions/kz-actions.c: Cleanup in combine_favicon. 2009-08-31 Hiroyuki Ikezoe <poinc****@ikezo*****> Modified: kazehakase/trunk/src/actions/kz-actions.c =================================================================== --- kazehakase/trunk/src/actions/kz-actions.c 2009-09-01 10:22:10 UTC (rev 3808) +++ kazehakase/trunk/src/actions/kz-actions.c 2009-09-01 10:30:02 UTC (rev 3809) @@ -1923,55 +1923,44 @@ static void combine_favicon(GtkAction *action, const gchar *uri, KzWindow *kz) { - GtkWidget *widget; GSList *node, *proxies; - KzFavicon *kzfav = KZ_GET_FAVICON; proxies = gtk_action_get_proxies(action); for (node = proxies; node; node = g_slist_next(node)) { - GtkWidget *image; + GtkWidget *image = NULL; + gchar *stock_id; + GtkIconSize size = GTK_ICON_SIZE_MENU; + KzFavicon *kzfav = KZ_GET_FAVICON; GdkPixbuf *favicon = NULL; - if (!GTK_IS_WIDGET(node->data)) - continue; - widget = GTK_WIDGET(node->data); - - if (!GTK_IS_IMAGE_MENU_ITEM(widget) && - !GTK_IS_TOOL_BUTTON(widget)) + if (!GTK_IS_WIDGET(node->data) || + (!GTK_IS_IMAGE_MENU_ITEM(node->data) && + !GTK_IS_TOOL_BUTTON(node->data))) + { continue; + } - if (GTK_IS_IMAGE_MENU_ITEM(widget)) + g_object_get(action, + "stock_id", &stock_id, + NULL); + if (GTK_IS_IMAGE_MENU_ITEM(node->data)) { - gchar *stock_id; - favicon = kz_favicon_get_pixbuf(kzfav, uri, - GTK_ICON_SIZE_MENU); - image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(widget)); - g_object_get(action, - "stock_id", &stock_id, - NULL); - gtkutil_superpose_pixbuf(image, favicon, - stock_id, - GTK_ICON_SIZE_MENU); - g_free(stock_id); + size = GTK_ICON_SIZE_MENU; + image = gtk_image_menu_item_get_image(GTK_IMAGE_MENU_ITEM(node->data)); } - else if (GTK_IS_TOOL_BUTTON(widget)) + else if (GTK_IS_TOOL_BUTTON(node->data)) { - gchar *stock_id; - favicon = kz_favicon_get_pixbuf(kzfav, uri, - GTK_ICON_SIZE_BUTTON); + size = GTK_ICON_SIZE_BUTTON; image = gtk_image_new(); - gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(widget), - image); + gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(node->data), image); gtk_widget_show(image); - g_object_get(action, - "stock_id", &stock_id, - NULL); - gtkutil_superpose_pixbuf(image, favicon, - stock_id, - GTK_ICON_SIZE_BUTTON); - g_free(stock_id); } + favicon = kz_favicon_get_pixbuf(kzfav, uri, size); + gtkutil_superpose_pixbuf(image, favicon, + stock_id, size); + g_free(stock_id); + if (favicon) g_object_unref(favicon); }