diff options
author | Bastien Nocera <hadess@hadess.net> | 2014-07-18 12:50:12 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2014-07-18 18:28:36 +0200 |
commit | cf26e6ca937f465421fa5a6401bbe4984afbdcbe (patch) | |
tree | 340b97cd28e901873fc9b0b883604a60d9bf8c05 /panels/background | |
parent | c3fc12893a531b7335b179e3117bb9a520c41ba9 (diff) | |
download | gnome-control-center-cf26e6ca937f465421fa5a6401bbe4984afbdcbe.tar.gz |
background: Make placeholder the same size as thumbnails
Otherwise they look tiny and compacted.
https://bugzilla.gnome.org/show_bug.cgi?id=689351
Diffstat (limited to 'panels/background')
-rw-r--r-- | panels/background/bg-pictures-source.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/panels/background/bg-pictures-source.c b/panels/background/bg-pictures-source.c index 94b1e6850..d6e275b55 100644 --- a/panels/background/bg-pictures-source.c +++ b/panels/background/bg-pictures-source.c @@ -331,10 +331,12 @@ get_content_loading_icon (BgSource *source) { GtkIconTheme *theme; GtkIconInfo *icon_info; - GdkPixbuf *pixbuf; + GdkPixbuf *pixbuf, *ret; GError *error = NULL; int scale_factor; cairo_surface_t *surface; + int thumbnail_height; + int thumbnail_width; theme = gtk_icon_theme_get_default (); icon_info = gtk_icon_theme_lookup_icon (theme, @@ -356,9 +358,24 @@ get_content_loading_icon (BgSource *source) return NULL; } - scale_factor = bg_source_get_scale_factor (source); - surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale_factor, NULL); + thumbnail_height = bg_source_get_thumbnail_height (source); + thumbnail_width = bg_source_get_thumbnail_width (source); + ret = gdk_pixbuf_new (GDK_COLORSPACE_RGB, + TRUE, + 8, thumbnail_width, thumbnail_height); + gdk_pixbuf_fill (ret, 0x00000000); + + /* Put the icon in the middle */ + gdk_pixbuf_copy_area (pixbuf, 0, 0, + gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), + ret, + (thumbnail_width - gdk_pixbuf_get_width (pixbuf)) / 2, + (thumbnail_height - gdk_pixbuf_get_height (pixbuf)) / 2); g_object_unref (pixbuf); + + scale_factor = bg_source_get_scale_factor (source); + surface = gdk_cairo_surface_create_from_pixbuf (ret, scale_factor, NULL); + g_object_unref (ret); g_clear_object (&icon_info); return surface; |