Compare commits

...

1 Commits

Author SHA1 Message Date
Carlos Soriano
784242fd20 gtkicontheme: Provide safe thread sync load_icon
Although we have a thread safe async version since 7690846c3f, the sync
version cannot be run in a different thread than the main one without
explicitly copying the internal data. Having an async version leads to
believe that the sync version would be thread safe.

It would be good to provide that alternative to be able to run this
on custom thread workers, and at the same time avoid the confusion with
the async alternative.
2018-07-28 19:17:40 +02:00
2 changed files with 21 additions and 0 deletions

View File

@@ -4106,6 +4106,24 @@ gtk_icon_info_load_icon (GtkIconInfo *icon_info,
return icon_info->proxy_pixbuf;
}
GdkPixbuf *
gtk_icon_info_load_icon_thread_safe (GtkIconInfo *icon_info,
GError **error)
{
GtkIconInfo *dup;
GdkPixbuf *pixbuf;
g_return_val_if_fail (icon_info != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
dup = icon_info_dup (icon_info);
pixbuf = gtk_icon_info_load_icon (dup, error);
g_object_unref (dup);
return pixbuf;
}
/**
* gtk_icon_info_load_surface:
* @icon_info: a #GtkIconInfo from gtk_icon_theme_lookup_icon()

View File

@@ -300,6 +300,9 @@ gboolean gtk_icon_info_is_symbolic (GtkIconInfo *icon_info
GDK_AVAILABLE_IN_ALL
GdkPixbuf * gtk_icon_info_load_icon (GtkIconInfo *icon_info,
GError **error);
GDK_AVAILABLE_IN_3_24
GdkPixbuf * gtk_icon_info_load_icon_thread_safe (GtkIconInfo *icon_info,
GError **error);
GDK_AVAILABLE_IN_3_10
cairo_surface_t * gtk_icon_info_load_surface (GtkIconInfo *icon_info,
GdkWindow *for_window,