Commit 517c3c9d authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Doc update.

2004-08-16  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.

	* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
	use the available size closest to 48.  (#150147)

	* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
	a pointer to the beginning of the sizes array, not the end.
parent 7a3114d7
<<<<<<< ChangeLog
2004-08-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
use the available size closest to 48. (#150147)
* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
a pointer to the beginning of the sizes array, not the end.
2004-08-16 Morten Welinder <terra@gnome.org>
* gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
......@@ -8,7 +19,6 @@
Mon Aug 16 01:35:25 2004 Matthias Clasen <maclas@gmx.de>
Fix #150125:
* gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
change the default behaviour to focus on click.
......
<<<<<<< ChangeLog
2004-08-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
use the available size closest to 48. (#150147)
* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
a pointer to the beginning of the sizes array, not the end.
2004-08-16 Morten Welinder <terra@gnome.org>
* gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
......@@ -8,7 +19,6 @@
Mon Aug 16 01:35:25 2004 Matthias Clasen <maclas@gmx.de>
Fix #150125:
* gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
change the default behaviour to focus on click.
......
<<<<<<< ChangeLog
2004-08-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
use the available size closest to 48. (#150147)
* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
a pointer to the beginning of the sizes array, not the end.
2004-08-16 Morten Welinder <terra@gnome.org>
* gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
......@@ -8,7 +19,6 @@
Mon Aug 16 01:35:25 2004 Matthias Clasen <maclas@gmx.de>
Fix #150125:
* gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
change the default behaviour to focus on click.
......
<<<<<<< ChangeLog
2004-08-16 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkwidget.c (gtk_widget_render_icon): Doc update.
* gtk/gtkiconfactory.c (render_icon_name_pixbuf): When the size is -1,
use the available size closest to 48. (#150147)
* gtk/gtkicontheme.c (gtk_icon_theme_get_icon_sizes): Actually return
a pointer to the beginning of the sizes array, not the end.
2004-08-16 Morten Welinder <terra@gnome.org>
* gtk/gtksequence.c (_gtk_sequence_set): Fix C99ism.
......@@ -8,7 +19,6 @@
Mon Aug 16 01:35:25 2004 Matthias Clasen <maclas@gmx.de>
Fix #150125:
* gtk/gtkcombobox.[hc]: Add a ::focus-on-click property and
change the default behaviour to focus on click.
......
......@@ -1649,6 +1649,7 @@ render_icon_name_pixbuf (GtkIconSource *icon_source,
GtkIconTheme *icon_theme;
GtkSettings *settings;
gint width, height, pixel_size;
gint *sizes, *s, dist;
GError *error = NULL;
if (widget && gtk_widget_has_screen (widget))
......@@ -1667,8 +1668,45 @@ render_icon_name_pixbuf (GtkIconSource *icon_source,
if (!gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
{
g_warning ("Invalid icon size %d\n", size);
width = height = 24;
if (size == -1)
{
/* Find an available size close to 48
*/
sizes = gtk_icon_theme_get_icon_sizes (icon_theme, icon_source->source.icon_name);
dist = 1000;
width = height = 48;
for (s = sizes; *s; s++)
{
if (*s == -1)
{
width = height = 48;
break;
}
if (*s < 48)
{
if (48 - *s < dist)
{
width = height = *s;
dist = 48 - *s;
}
}
else
{
if (*s - 48 < dist)
{
width = height = *s;
dist = *s - 48;
}
}
}
g_free (sizes);
}
else
{
g_warning ("Invalid icon size %d\n", size);
width = height = 24;
}
}
pixel_size = MIN (width, height);
......
......@@ -1331,7 +1331,7 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
{
GList *l, *d;
GHashTable *sizes;
gint *result;
gint *result, *r;
guint suffix;
GtkIconThemePrivate *priv;
......@@ -1362,9 +1362,9 @@ gtk_icon_theme_get_icon_sizes (GtkIconTheme *icon_theme,
}
}
result = g_new0 (gint, g_hash_table_size (sizes) + 1);
r = result = g_new0 (gint, g_hash_table_size (sizes) + 1);
g_hash_table_foreach (sizes, add_size, &result);
g_hash_table_foreach (sizes, add_size, &r);
g_hash_table_destroy (sizes);
return result;
......
......@@ -5041,7 +5041,8 @@ gtk_widget_create_pango_layout (GtkWidget *widget,
* @widget: a #GtkWidget
* @stock_id: a stock ID
* @size: a stock size. A size of (GtkIconSize)-1 means render at
the size of the source and don't scale.
* the size of the source and don't scale (if there are multiple
* source sizes, GTK+ picks one of the available sizes).
* @detail: render detail to pass to theme engine
*
* A convenience function that uses the theme engine and RC file
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment