[evolution] I#985 - Ensure 16px online/offline icon height in the status bar
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#985 - Ensure 16px online/offline icon height in the status bar
- Date: Mon, 29 Jun 2020 10:09:26 +0000 (UTC)
commit 6a90592f1a3186135ec718fb7c7f5c8760e2a99a
Author: Milan Crha <mcrha redhat com>
Date: Mon Jun 29 12:08:51 2020 +0200
I#985 - Ensure 16px online/offline icon height in the status bar
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/985
src/e-util/e-online-button.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/src/e-util/e-online-button.c b/src/e-util/e-online-button.c
index 36fc5a4bba..448a47cee5 100644
--- a/src/e-util/e-online-button.c
+++ b/src/e-util/e-online-button.c
@@ -65,6 +65,27 @@ online_button_update_tooltip (EOnlineButton *button)
gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
}
+static void
+online_button_update_icon (GtkImage *image,
+ const gchar *filename)
+{
+ GdkPixbuf *pixbuf = NULL;
+ gint height = -1;
+
+ if (!filename)
+ return;
+
+ if (gdk_pixbuf_get_file_info (filename, NULL, &height) && height > 16)
+ pixbuf = gdk_pixbuf_new_from_file_at_scale (filename, -1, 16, TRUE, NULL);
+
+ if (pixbuf) {
+ gtk_image_set_from_pixbuf (image, pixbuf);
+ g_object_unref (pixbuf);
+ } else {
+ gtk_image_set_from_file (image, filename);
+ }
+}
+
static void
online_button_set_property (GObject *object,
guint property_id,
@@ -202,7 +223,7 @@ e_online_button_set_online (EOnlineButton *button,
icon_info = gtk_icon_theme_lookup_icon (
icon_theme, icon_name, GTK_ICON_SIZE_BUTTON, 0);
filename = gtk_icon_info_get_filename (icon_info);
- gtk_image_set_from_file (image, filename);
+ online_button_update_icon (image, filename);
gtk_icon_info_free (icon_info);
g_object_notify (G_OBJECT (button), "online");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]