diff options
author | Matthias Clasen <mclasen@redhat.com> | 2013-09-10 22:45:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2013-09-10 22:45:06 -0400 |
commit | 096f2db4b00ffabd90faab7c4d2a8a8749b87c09 (patch) | |
tree | 4f2ec0f9561dcb50cd8dff1ce41d97f9512211c1 /gtk/gtkaboutdialog.c | |
parent | 59c4fb9d6af4b39b258c1abc0e6ed0d2d2c9780f (diff) | |
download | gtk+-096f2db4b00ffabd90faab7c4d2a8a8749b87c09.tar.gz |
Make logos in GtkAboutDialog bigger
When available, choose a size of up to 128 in GtkAboutDialog.
A 48x48 icon just looks too small in there.
Diffstat (limited to 'gtk/gtkaboutdialog.c')
-rw-r--r-- | gtk/gtkaboutdialog.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkaboutdialog.c b/gtk/gtkaboutdialog.c index 7f05f314b9..467123ea8f 100644 --- a/gtk/gtkaboutdialog.c +++ b/gtk/gtkaboutdialog.c @@ -36,6 +36,7 @@ #include "gtkdialog.h" #include "gtkgrid.h" #include "gtkbox.h" +#include "gtkicontheme.h" #include "gtkimage.h" #include "gtklabel.h" #include "gtklinkbutton.h" @@ -1773,6 +1774,8 @@ gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about, const gchar *icon_name) { GtkAboutDialogPrivate *priv; + gint *sizes; + gint i, best_size; g_return_if_fail (GTK_IS_ABOUT_DIALOG (about)); @@ -1783,8 +1786,33 @@ gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about, if (gtk_image_get_storage_type (GTK_IMAGE (priv->logo_image)) == GTK_IMAGE_PIXBUF) g_object_notify (G_OBJECT (about), "logo"); + sizes = gtk_icon_theme_get_icon_sizes (gtk_icon_theme_get_default (), icon_name); + best_size = 0; + for (i = 0; sizes[i]; i++) + { + if (sizes[i] >= 128 || sizes[i] == -1) + { + best_size = 128; + break; + } + else if (sizes[i] >= 96) + { + best_size = MAX (96, best_size); + } + else if (sizes[i] >= 64) + { + best_size = MAX (64, best_size); + } + else + { + best_size = MAX (48, best_size); + } + } + g_free (sizes); + gtk_image_set_from_icon_name (GTK_IMAGE (priv->logo_image), icon_name, GTK_ICON_SIZE_DIALOG); + gtk_image_set_pixel_size (GTK_IMAGE (priv->logo_image), best_size); g_object_notify (G_OBJECT (about), "logo-icon-name"); g_object_thaw_notify (G_OBJECT (about)); |