+<<<<<<< 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.
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.
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.
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.
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.
GtkIconTheme *icon_theme;
GtkSettings *settings;
gint width, height, pixel_size;
+ gint *sizes, *s, dist;
GError *error = NULL;
if (widget && gtk_widget_has_screen (widget))
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);
{
GList *l, *d;
GHashTable *sizes;
- gint *result;
+ gint *result, *r;
guint suffix;
GtkIconThemePrivate *priv;
}
}
- 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;
* @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