mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 17:30:10 +00:00
Don't get settings unless we need them
Pointed out in bug 613028.
This commit is contained in:
parent
996541d096
commit
590ceded96
@ -2296,32 +2296,16 @@ scale_or_ref (GdkPixbuf *src,
|
||||
}
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
gtk_default_render_icon (GtkStyle *style,
|
||||
const GtkIconSource *source,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size,
|
||||
static gboolean
|
||||
lookup_icon_size (GtkStyle *style,
|
||||
GtkWidget *widget,
|
||||
const gchar *detail)
|
||||
GtkIconSize size,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
gint width = 1;
|
||||
gint height = 1;
|
||||
GdkPixbuf *scaled;
|
||||
GdkPixbuf *stated;
|
||||
GdkPixbuf *base_pixbuf;
|
||||
GdkScreen *screen;
|
||||
GtkSettings *settings;
|
||||
|
||||
/* Oddly, style can be NULL in this function, because
|
||||
* GtkIconSet can be used without a style and if so
|
||||
* it uses this function.
|
||||
*/
|
||||
|
||||
base_pixbuf = gtk_icon_source_get_pixbuf (source);
|
||||
|
||||
g_return_val_if_fail (base_pixbuf != NULL, NULL);
|
||||
|
||||
if (widget && gtk_widget_has_screen (widget))
|
||||
{
|
||||
screen = gtk_widget_get_screen (widget);
|
||||
@ -2339,8 +2323,34 @@ gtk_default_render_icon (GtkStyle *style,
|
||||
g_warning ("Using the default screen for gtk_default_render_icon()"));
|
||||
}
|
||||
|
||||
return gtk_icon_size_lookup_for_settings (settings, size, width, height);
|
||||
}
|
||||
|
||||
if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
|
||||
static GdkPixbuf *
|
||||
gtk_default_render_icon (GtkStyle *style,
|
||||
const GtkIconSource *source,
|
||||
GtkTextDirection direction,
|
||||
GtkStateType state,
|
||||
GtkIconSize size,
|
||||
GtkWidget *widget,
|
||||
const gchar *detail)
|
||||
{
|
||||
gint width = 1;
|
||||
gint height = 1;
|
||||
GdkPixbuf *scaled;
|
||||
GdkPixbuf *stated;
|
||||
GdkPixbuf *base_pixbuf;
|
||||
|
||||
/* Oddly, style can be NULL in this function, because
|
||||
* GtkIconSet can be used without a style and if so
|
||||
* it uses this function.
|
||||
*/
|
||||
|
||||
base_pixbuf = gtk_icon_source_get_pixbuf (source);
|
||||
|
||||
g_return_val_if_fail (base_pixbuf != NULL, NULL);
|
||||
|
||||
if (size != (GtkIconSize) -1 && !lookup_icon_size(style, widget, size, &width, &height))
|
||||
{
|
||||
g_warning (G_STRLOC ": invalid icon size '%d'", size);
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user