Commit 71339225 authored by Timm Bäder's avatar Timm Bäder 🤔

icontheme: Remove gtk_icon_info_load_texture

It's the same as load_icon now.
parent 590e70d4
......@@ -110,7 +110,7 @@ get_image_paintable (GtkImage *image)
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
return NULL;
return GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info, NULL));
return gtk_icon_info_load_icon (icon_info, NULL);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
......
......@@ -79,7 +79,7 @@ gtk_css_image_icon_theme_snapshot (GtkCssImage *image,
g_assert (icon_info != NULL);
symbolic = gtk_icon_info_is_symbolic (icon_info);
texture = gtk_icon_info_load_texture (icon_info, NULL);
texture = GDK_TEXTURE (gtk_icon_info_load_icon (icon_info, NULL));
g_clear_object (&icon_theme->cached_texture);
......
......@@ -224,7 +224,7 @@ _gtk_header_bar_update_window_icon (GtkHeaderBar *bar,
GtkWindow *window)
{
GtkHeaderBarPrivate *priv = gtk_header_bar_get_instance_private (bar);
GdkTexture *texture;
GdkPaintable *paintable;
gint scale;
if (priv->titlebar_icon == NULL)
......@@ -232,15 +232,14 @@ _gtk_header_bar_update_window_icon (GtkHeaderBar *bar,
scale = gtk_widget_get_scale_factor (priv->titlebar_icon);
if (GTK_IS_BUTTON (gtk_widget_get_parent (priv->titlebar_icon)))
texture = gtk_window_get_icon_for_size (window, 16 * scale);
paintable = gtk_window_get_icon_for_size (window, 16 * scale);
else
texture = gtk_window_get_icon_for_size (window, 20 * scale);
paintable = gtk_window_get_icon_for_size (window, 20 * scale);
if (texture)
if (paintable)
{
gtk_image_set_from_paintable (GTK_IMAGE (priv->titlebar_icon),
GDK_PAINTABLE (texture));
g_object_unref (texture);
gtk_image_set_from_paintable (GTK_IMAGE (priv->titlebar_icon), paintable);
g_object_unref (paintable);
gtk_widget_show (priv->titlebar_icon);
return TRUE;
......
......@@ -122,7 +122,7 @@ ensure_paintable_for_gicon (GtkIconHelper *self,
flags | GTK_ICON_LOOKUP_USE_BUILTIN | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
*symbolic = gtk_icon_info_is_symbolic (info);
paintable = GDK_PAINTABLE (gtk_icon_info_load_texture (info, NULL));
paintable = gtk_icon_info_load_icon (info, NULL);
g_object_unref (info);
if (paintable && scale != 1)
......
......@@ -2320,7 +2320,7 @@ gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
GError **error)
{
GtkIconInfo *icon_info;
GdkTexture *texture = NULL;
GdkPaintable *paintable = NULL;
g_return_val_if_fail (GTK_IS_ICON_THEME (icon_theme), NULL);
g_return_val_if_fail (icon_name != NULL, NULL);
......@@ -2338,11 +2338,11 @@ gtk_icon_theme_load_icon_for_scale (GtkIconTheme *icon_theme,
return NULL;
}
texture = gtk_icon_info_load_texture (icon_info, error);
paintable = gtk_icon_info_load_icon (icon_info, error);
g_prefix_error (error, "Failed to load %s: ", icon_info->filename);
g_object_unref (icon_info);
return GDK_PAINTABLE (texture);
return paintable;
}
/**
......@@ -3803,11 +3803,8 @@ icon_info_load_pixbuf (GtkIconInfo *icon_info,
* the #GtkIconInfo. If this flag has been specified, the pixbuf
* returned by this function will be scaled to the exact size.
*
* Returns: (transfer full) (nullable): the rendered icon; this may be a newly
* created icon or a new reference to an internal icon, so you must
* not modify the icon. Use g_object_unref() to release your reference
* to the icon.
* If the icon could not be loaded, %NULL is returned and @error is set.
* Returns: (transfer full) (nullable): the rendered icon.
* Use g_object_unref() to release your reference to the icon.
*/
GdkPaintable *
gtk_icon_info_load_icon (GtkIconInfo *icon_info,
......@@ -3816,30 +3813,6 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
g_return_val_if_fail (icon_info != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
return (GdkPaintable *)gtk_icon_info_load_texture (icon_info, error);
}
/**
* gtk_icon_info_load_texture:
* @icon_info: a #GtkIconInfo
* @error: (nullable): location to store error information on failure,
* or %NULL.
*
* Returns a texture object that can be used to render the icon
* with GSK.
*
* Returns: (transfer full) (nullable): the icon texture; this may be a newly
* created texture or a new reference to an exiting texture. Use
* g_object_unref() to release your reference.
* In case of failure, %NULL is returned and @error is set
*/
GdkTexture *
gtk_icon_info_load_texture (GtkIconInfo *icon_info,
GError **error)
{
g_return_val_if_fail (icon_info != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!icon_info->texture)
{
GdkPixbuf *pixbuf;
......@@ -3875,7 +3848,7 @@ gtk_icon_info_load_texture (GtkIconInfo *icon_info,
if (icon_info->in_cache != NULL)
ensure_in_lru_cache (icon_info->in_cache, icon_info);
return g_object_ref (icon_info->texture);
return GDK_PAINTABLE (g_object_ref (icon_info->texture));
}
static void
......@@ -3956,7 +3929,6 @@ gtk_icon_info_load_icon_finish (GtkIconInfo *icon_info,
{
GTask *task = G_TASK (result);
GtkIconInfo *dup;
GdkTexture *texture;
g_return_val_if_fail (g_task_is_valid (result, icon_info), NULL);
......@@ -3982,12 +3954,7 @@ gtk_icon_info_load_icon_finish (GtkIconInfo *icon_info,
g_assert (icon_info_get_pixbuf_ready (icon_info));
/* This is now guaranteed to not block */
texture = gtk_icon_info_load_texture (icon_info, error);
if (texture)
return GDK_PAINTABLE (texture);
return NULL;
return gtk_icon_info_load_icon (icon_info, error);
}
static void
......@@ -4416,7 +4383,7 @@ gtk_icon_info_load_symbolic (GtkIconInfo *icon_info,
*was_symbolic = is_symbolic;
if (!is_symbolic)
return (GdkPaintable *)gtk_icon_info_load_texture (icon_info, error);
return gtk_icon_info_load_icon (icon_info, error);
pixbuf = gtk_icon_info_load_symbolic_internal (icon_info,
fg, success_color,
......@@ -4513,7 +4480,7 @@ gtk_icon_info_load_symbolic_for_context (GtkIconInfo *icon_info,
*was_symbolic = is_symbolic;
if (!is_symbolic)
return (GdkPaintable *)gtk_icon_info_load_texture (icon_info, error);
return gtk_icon_info_load_icon (icon_info, error);
gtk_icon_theme_lookup_symbolic_colors (gtk_style_context_lookup_style (context),
&fg, &success_color,
......
......@@ -225,10 +225,6 @@ GDK_AVAILABLE_IN_ALL
GdkPaintable * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
GError **error);
GDK_AVAILABLE_IN_ALL
GdkTexture * gtk_icon_info_load_texture (GtkIconInfo *icon_info,
GError **error);
GDK_AVAILABLE_IN_ALL
void gtk_icon_info_load_icon_async (GtkIconInfo *icon_info,
GCancellable *cancellable,
GAsyncReadyCallback callback,
......
......@@ -1171,7 +1171,7 @@ add_pid_to_process_list_store (GtkMountOperation *mount_operation,
(_gtk_style_context_peek_property (gtk_widget_get_style_context (GTK_WIDGET (mount_operation->priv->dialog)),
GTK_CSS_PROPERTY_ICON_THEME));
info = gtk_icon_theme_lookup_icon (theme, "application-x-executable", 24, 0);
texture = gtk_icon_info_load_texture (info, NULL);
texture = GDK_TEXTURE (gtk_icon_info_load_icon (info, NULL));
g_object_unref (info);
}
......
......@@ -4048,7 +4048,10 @@ icon_list_from_theme (GtkWindow *window,
0);
if (info)
{
list = g_list_insert_sorted (list, gtk_icon_info_load_texture (info, NULL), (GCompareFunc) icon_size_compare);
GdkPaintable *paintable = gtk_icon_info_load_icon (info, NULL);
if (paintable && GDK_IS_TEXTURE (paintable))
list = g_list_insert_sorted (list, GDK_TEXTURE (paintable), (GCompareFunc) icon_size_compare);
g_object_unref (info);
}
}
......@@ -4105,13 +4108,13 @@ gtk_window_realize_icon (GtkWindow *window)
g_list_free_full (icon_list, g_object_unref);
}
GdkTexture *
GdkPaintable *
gtk_window_get_icon_for_size (GtkWindow *window,
int size)
{
const char *name;
GtkIconInfo *info;
GdkTexture *texture;
GdkPaintable *paintable;
name = gtk_window_get_icon_name (window);
......@@ -4126,10 +4129,10 @@ gtk_window_get_icon_for_size (GtkWindow *window,
if (info == NULL)
return NULL;
texture = gtk_icon_info_load_texture (info, NULL);
paintable = gtk_icon_info_load_icon (info, NULL);
g_object_unref (info);
return texture;
return paintable;
}
static void
......
......@@ -112,8 +112,8 @@ GtkWidget * _gtk_window_get_popover_parent (GtkWindow *window,
gboolean _gtk_window_is_popover_widget (GtkWindow *window,
GtkWidget *popover);
GdkTexture * gtk_window_get_icon_for_size (GtkWindow *window,
int size);
GdkPaintable * gtk_window_get_icon_for_size (GtkWindow *window,
int size);
void gtk_window_set_hardcoded_surface (GtkWindow *window,
GdkSurface *surface);
......
......@@ -21,7 +21,7 @@ get_image_paintable (GtkImage *image,
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
*out_size = width;
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, width, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
paintable = GDK_PAINTABLE (gtk_icon_info_load_texture (icon_info, NULL));
paintable = gtk_icon_info_load_icon (icon_info, NULL);
g_object_unref (icon_info);
return paintable;
default:
......
......@@ -78,7 +78,7 @@ main (int argc, char **argv)
GtkWidget *window, *grid;
GtkWidget *label, *image;
GtkIconTheme *theme;
GdkTexture *texture;
GdkPaintable *paintable;
gchar *icon_name = "help-browser";
gchar *anim_filename = NULL;
GtkIconInfo *icon_info;
......@@ -110,10 +110,10 @@ main (int argc, char **argv)
theme = gtk_icon_theme_get_default ();
icon_info = gtk_icon_theme_lookup_icon_for_scale (theme, icon_name, 48, gtk_widget_get_scale_factor (window), GTK_ICON_LOOKUP_GENERIC_FALLBACK);
texture = gtk_icon_info_load_texture (icon_info, NULL);
paintable = gtk_icon_info_load_icon (icon_info, NULL);
g_object_unref (icon_info);
image = gtk_image_new_from_paintable (GDK_PAINTABLE (texture));
g_object_unref (texture);
image = gtk_image_new_from_paintable (paintable);
g_object_unref (paintable);
gtk_grid_attach (GTK_GRID (grid), image, 2, 1, 1, 1);
gtk_drag_source_set (image, GDK_BUTTON1_MASK,
......
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