mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-08 11:40:16 +00:00
iconhelper: Fold function into only caller
This commit is contained in:
parent
b8dd24b4fb
commit
3c54a49633
@ -395,23 +395,37 @@ G_GNUC_END_IGNORE_DEPRECATIONS;
|
|||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *
|
static cairo_surface_t *
|
||||||
ensure_stated_surface_from_info (GtkIconHelper *self,
|
ensure_surface_for_gicon (GtkIconHelper *self,
|
||||||
GtkStyleContext *context,
|
GtkStyleContext *context,
|
||||||
GtkIconInfo *info,
|
gint scale,
|
||||||
int scale)
|
GIcon *gicon)
|
||||||
{
|
{
|
||||||
GdkPixbuf *destination = NULL;
|
GtkIconTheme *icon_theme;
|
||||||
|
gint width, height;
|
||||||
|
GtkIconInfo *info;
|
||||||
|
GtkIconLookupFlags flags;
|
||||||
cairo_surface_t *surface;
|
cairo_surface_t *surface;
|
||||||
|
GdkPixbuf *destination;
|
||||||
gboolean symbolic;
|
gboolean symbolic;
|
||||||
|
|
||||||
symbolic = FALSE;
|
icon_theme = gtk_css_icon_theme_value_get_icon_theme
|
||||||
|
(_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_THEME));
|
||||||
|
flags = get_icon_lookup_flags (self, context);
|
||||||
|
|
||||||
|
ensure_icon_size (self, &width, &height);
|
||||||
|
|
||||||
|
info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme,
|
||||||
|
gicon,
|
||||||
|
MIN (width, height),
|
||||||
|
scale, flags);
|
||||||
if (info)
|
if (info)
|
||||||
destination =
|
destination =
|
||||||
gtk_icon_info_load_symbolic_for_context (info,
|
gtk_icon_info_load_symbolic_for_context (info,
|
||||||
context,
|
context,
|
||||||
&symbolic,
|
&symbolic,
|
||||||
NULL);
|
NULL);
|
||||||
|
else
|
||||||
|
destination = NULL;
|
||||||
|
|
||||||
if (destination == NULL)
|
if (destination == NULL)
|
||||||
{
|
{
|
||||||
@ -443,34 +457,6 @@ ensure_stated_surface_from_info (GtkIconHelper *self,
|
|||||||
g_object_unref (destination);
|
g_object_unref (destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
return surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
static cairo_surface_t *
|
|
||||||
ensure_surface_for_gicon (GtkIconHelper *self,
|
|
||||||
GtkStyleContext *context,
|
|
||||||
gint scale,
|
|
||||||
GIcon *gicon)
|
|
||||||
{
|
|
||||||
GtkIconTheme *icon_theme;
|
|
||||||
gint width, height;
|
|
||||||
GtkIconInfo *info;
|
|
||||||
GtkIconLookupFlags flags;
|
|
||||||
cairo_surface_t *surface;
|
|
||||||
|
|
||||||
icon_theme = gtk_css_icon_theme_value_get_icon_theme
|
|
||||||
(_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_ICON_THEME));
|
|
||||||
flags = get_icon_lookup_flags (self, context);
|
|
||||||
|
|
||||||
ensure_icon_size (self, &width, &height);
|
|
||||||
|
|
||||||
info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme,
|
|
||||||
gicon,
|
|
||||||
MIN (width, height),
|
|
||||||
scale, flags);
|
|
||||||
|
|
||||||
surface = ensure_stated_surface_from_info (self, context, info, scale);
|
|
||||||
|
|
||||||
if (info)
|
if (info)
|
||||||
g_object_unref (info);
|
g_object_unref (info);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user