GtkAboutDialog: fixed calling gtk_about_dialog_set_logo_icon_name()

with a NULL icon_name. Now it will actually use the default
window icon set as mention in the docs
This commit is contained in:
Juan Pablo Ugarte 2013-11-28 17:01:18 -03:00
parent b5dff5e417
commit bbd0035625

View File

@ -1778,8 +1778,7 @@ gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,
const gchar *icon_name)
{
GtkAboutDialogPrivate *priv;
gint *sizes;
gint i, best_size;
GList *icons;
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
@ -1790,33 +1789,48 @@ 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 (icon_name)
{
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);
gint *sizes = gtk_icon_theme_get_icon_sizes (gtk_icon_theme_get_default (),
icon_name);
gint i, best_size = 0;
gtk_image_set_from_icon_name (GTK_IMAGE (priv->logo_image), icon_name,
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);
gtk_image_set_pixel_size (GTK_IMAGE (priv->logo_image), best_size);
}
else if ((icons = gtk_window_get_default_icon_list ()))
{
gtk_image_set_from_pixbuf (GTK_IMAGE (priv->logo_image), icons->data);
g_list_free (icons);
}
else
{
gtk_image_clear (GTK_IMAGE (priv->logo_image));
}
g_object_notify (G_OBJECT (about), "logo-icon-name");
g_object_thaw_notify (G_OBJECT (about));