diff options
author | Diego Escalante Urrelo <descalante@igalia.com> | 2011-10-12 10:51:23 +0800 |
---|---|---|
committer | Diego Escalante Urrelo <descalante@igalia.com> | 2011-12-21 02:22:20 +0800 |
commit | 00c82e603752cd1a8a51b929b44ef62ee26073f1 (patch) | |
tree | c0108edbd011ea5369f23711418ddfe75edd3dcc | |
parent | 89c1e042193df2a76eb9aecb2c6b5b25e6e6e1a2 (diff) | |
download | gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar.gz gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar.bz2 gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar.lz gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar.xz gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.tar.zst gsoc2013-epiphany-00c82e603752cd1a8a51b929b44ef62ee26073f1.zip |
e-download-widget: use GIcon instead of GdkPixbuf
GtkImage works fine with GIcon, this saves us some lines of code and
allocating a GdkPixbuf.
Bug #662059
-rw-r--r-- | lib/widgets/ephy-download-widget.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/widgets/ephy-download-widget.c b/lib/widgets/ephy-download-widget.c index a8d3403d0..940eda3b7 100644 --- a/lib/widgets/ephy-download-widget.c +++ b/lib/widgets/ephy-download-widget.c @@ -53,12 +53,11 @@ enum PROP_DOWNLOAD }; -static GdkPixbuf * -get_icon_from_download (EphyDownload *ephy_download) +static GIcon * +get_gicon_from_download (EphyDownload *ephy_download) { char *content_type = NULL; GIcon *gicon; - GtkIconInfo *icon_info; content_type = ephy_download_get_content_type (ephy_download); @@ -69,16 +68,7 @@ get_icon_from_download (EphyDownload *ephy_download) gicon = g_icon_new_for_string ("package-x-generic", NULL); } - icon_info = gtk_icon_theme_lookup_by_gicon (gtk_icon_theme_get_default (), - gicon, 32, - GTK_ICON_LOOKUP_GENERIC_FALLBACK); - - if (icon_info == NULL) - icon_info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), - "package-x-generic", 32, - GTK_ICON_LOOKUP_GENERIC_FALLBACK); - - return gtk_icon_info_load_icon (icon_info, NULL); + return gicon; } static char * @@ -437,7 +427,6 @@ ephy_download_widget_new (EphyDownload *ephy_download) GtkWidget *remain; char *dest, *basename; - GdkPixbuf *pixbuf = NULL; WebKitDownload *download; g_return_val_if_fail (EPHY_IS_DOWNLOAD (ephy_download), NULL); @@ -446,7 +435,6 @@ ephy_download_widget_new (EphyDownload *ephy_download) "download", ephy_download, NULL); download = ephy_download_get_webkit_download (ephy_download); - pixbuf = get_icon_from_download (ephy_download); basename = g_filename_display_basename (webkit_download_get_destination_uri (download)); dest = g_uri_unescape_string (basename, NULL); @@ -455,7 +443,8 @@ ephy_download_widget_new (EphyDownload *ephy_download) button = totem_glow_button_new (); menu = gtk_button_new (); - icon = gtk_image_new_from_pixbuf (pixbuf); + icon = gtk_image_new_from_gicon (get_gicon_from_download (ephy_download), + GTK_ICON_SIZE_LARGE_TOOLBAR); text = gtk_label_new (dest); gtk_misc_set_alignment (GTK_MISC (text), 0, 0.5); gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ELLIPSIZE_END); @@ -470,9 +459,6 @@ ephy_download_widget_new (EphyDownload *ephy_download) gtk_widget_set_tooltip_text (GTK_WIDGET (widget), dest); - if (pixbuf) - g_object_unref (pixbuf); - g_free (basename); g_free (dest); |