diff options
author | Carlos Garnacho <carlos@lanedo.com> | 2012-07-13 15:57:45 +0200 |
---|---|---|
committer | Carlos Garnacho <carlos@lanedo.com> | 2012-07-13 16:56:37 +0200 |
commit | 37262f9725511d26c2e177d85c2b0ba3e3f09e77 (patch) | |
tree | 40936a9af567b20737a9e8e439cad034abd99c26 /gtk/gtkstatusicon.c | |
parent | 77221c18a3e41d8ebd0754987359738b5bf6ab5d (diff) | |
download | gtk+-37262f9725511d26c2e177d85c2b0ba3e3f09e77.tar.gz |
statusicon: Rely on GtkIconHelper for pixbuf resizes
The same is now achieved by forcing pixbuf rescaling on the icon helper
Diffstat (limited to 'gtk/gtkstatusicon.c')
-rw-r--r-- | gtk/gtkstatusicon.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index 5c8a591fb8..7e53df0856 100644 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -836,6 +836,7 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) status_icon->priv = priv; priv->icon_helper = _gtk_icon_helper_new (); + _gtk_icon_helper_set_force_scale_pixbuf (priv->icon_helper, TRUE); priv->visible = TRUE; #ifdef GDK_WINDOWING_X11 @@ -1352,7 +1353,6 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon) #endif GtkStyleContext *context; GtkWidget *widget; - GtkImageType storage_type = _gtk_icon_helper_get_storage_type (priv->icon_helper); GdkPixbuf *pixbuf; gint round_size; @@ -1365,32 +1365,8 @@ gtk_status_icon_update_image (GtkStatusIcon *status_icon) context = gtk_widget_get_style_context (widget); round_size = round_pixel_size (widget, priv->size); - if (storage_type == GTK_IMAGE_PIXBUF) - { - GdkPixbuf *scaled; - gint width; - gint height; - - pixbuf = _gtk_icon_helper_ensure_pixbuf (priv->icon_helper, context); - - width = gdk_pixbuf_get_width (pixbuf); - height = gdk_pixbuf_get_height (pixbuf); - - if (width > round_size || height > round_size) - { - scaled = gdk_pixbuf_scale_simple (pixbuf, - MIN (round_size, width), - MIN (round_size, height), - GDK_INTERP_BILINEAR); - g_object_unref (pixbuf); - pixbuf = scaled; - } - } - else - { - _gtk_icon_helper_set_pixel_size (priv->icon_helper, round_size); - pixbuf = _gtk_icon_helper_ensure_pixbuf (priv->icon_helper, context); - } + _gtk_icon_helper_set_pixel_size (priv->icon_helper, round_size); + pixbuf = _gtk_icon_helper_ensure_pixbuf (priv->icon_helper, context); if (pixbuf != NULL) { |