aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-21 21:46:06 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-10-21 21:46:06 +0200
commit99649c51f2c197c1223a204aa9c30b3f6b9c930d (patch)
treef475322a12ef79083935c9145fd021828f051cb9
parent1904f33e7cada3bad46cf2c559f12b6302f3336f (diff)
parent7e02a15a27dcec0806c2d30db8ec2960483e8c3a (diff)
downloadlibayatana-indicator-99649c51f2c197c1223a204aa9c30b3f6b9c930d.tar.gz
libayatana-indicator-99649c51f2c197c1223a204aa9c30b3f6b9c930d.tar.bz2
libayatana-indicator-99649c51f2c197c1223a204aa9c30b3f6b9c930d.zip
Merge branch 'diddledani-icon-scaling'
Attributes GH PR #54: https://github.com/AyatanaIndicators/libayatana-indicator/pull/54
-rw-r--r--src/indicator-image-helper.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/indicator-image-helper.c b/src/indicator-image-helper.c
index 2c0e244..4a22539 100644
--- a/src/indicator-image-helper.c
+++ b/src/indicator-image-helper.c
@@ -79,13 +79,15 @@ refresh_image (GtkImage * image)
}
g_object_unref (pixbuf);
} else if (icon_filename != NULL) {
- gtk_image_set_from_file(image, icon_filename);
-
- gint height;
- gdk_pixbuf_get_file_info(icon_filename, NULL, &height);
-
- if (height > ICON_SIZE) {
- gtk_image_set_pixel_size(image, ICON_SIZE);
+ GError* error = NULL;
+ GdkPixbuf* pixbuf = gdk_pixbuf_new_from_file_at_scale(icon_filename, ICON_SIZE, ICON_SIZE, TRUE, &error);
+ if (pixbuf != NULL) {
+ /* Put the pixbuf on the image */
+ gtk_image_set_from_pixbuf(image, pixbuf);
+ g_object_unref(G_OBJECT(pixbuf));
+ } else {
+ g_error_free(error);
+ gtk_image_set_from_icon_name(image, "image-missing", ICON_SIZE);
}
} else if (G_IS_LOADABLE_ICON(icon_names)) {
/* Build a pixbuf if needed */