From: Alexander Larsson Date: Thu, 30 Jan 2020 14:15:08 +0000 (+0100) Subject: icon-theme: Add i/o priority to choose_icon_async() X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~20^2~126^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d1cd578d59c1a9487d81d69f4e51756cf2bc209a;p=gtk4.git icon-theme: Add i/o priority to choose_icon_async() This is set on the GTask and lower priority will be loaded before, this can be used to prioritize some icons for preloading. --- diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 4091722cc4..e266887c56 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -215,7 +215,7 @@ _gtk_icon_helper_preload (GtkIconHelper *self) gtk_icon_theme_choose_icon_async (icon_theme, (const gchar **)g_themed_icon_get_names (G_THEMED_ICON (gicon)), size, scale, - flags, NULL, NULL, NULL); + flags, 0, NULL, NULL, NULL); } if (free_gicon) diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 104a95e332..f04b019b1b 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -2458,6 +2458,7 @@ load_icon_thread (GTask *task, * @size: desired icon size. * @scale: the window scale this will be displayed on * @flags: flags modifying the behavior of the icon lookup + * @io_priority: the [I/O priority][io-priority] of the request. * @cancellable: (allow-none): optional #GCancellable object, %NULL to ignore * @callback: (scope async): a #GAsyncReadyCallback to call when the * request is satisfied @@ -2474,9 +2475,10 @@ gtk_icon_theme_choose_icon_async (GtkIconTheme *self, gint size, gint scale, GtkIconLookupFlags flags, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) + int priority, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { GTask *task; GtkIcon *icon = NULL; @@ -2489,6 +2491,7 @@ gtk_icon_theme_choose_icon_async (GtkIconTheme *self, g_warn_if_fail ((flags & GTK_ICON_LOOKUP_GENERIC_FALLBACK) == 0); task = g_task_new (self, cancellable, callback, user_data); + g_task_set_priority (task, priority); if (gtk_icon_theme_trylock (self)) { diff --git a/gtk/gtkicontheme.h b/gtk/gtkicontheme.h index 45ca609363..a11959a61b 100644 --- a/gtk/gtkicontheme.h +++ b/gtk/gtkicontheme.h @@ -163,6 +163,7 @@ void gtk_icon_theme_choose_icon_async (GtkIconTheme gint size, gint scale, GtkIconLookupFlags flags, + int priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data); diff --git a/tests/testicontheme.c b/tests/testicontheme.c index c988f10ce5..4271e6df46 100644 --- a/tests/testicontheme.c +++ b/tests/testicontheme.c @@ -149,7 +149,7 @@ main (int argc, char *argv[]) gtk_widget_show (window); icons[0] = argv[3]; - gtk_icon_theme_choose_icon_async (icon_theme, icons, size, scale, flags, NULL, icon_loaded_cb, image); + gtk_icon_theme_choose_icon_async (icon_theme, icons, size, scale, flags, 0, NULL, icon_loaded_cb, image); gtk_main (); } diff --git a/testsuite/gtk/icontheme.c b/testsuite/gtk/icontheme.c index 2d1ea6902c..9563ad2908 100644 --- a/testsuite/gtk/icontheme.c +++ b/testsuite/gtk/icontheme.c @@ -622,8 +622,8 @@ test_async (void) g_printerr ("test_async\n"); theme = get_test_icontheme (TRUE); - gtk_icon_theme_choose_icon_async (theme, icons, 32, 1, 0, NULL, load_icon, loop); - gtk_icon_theme_choose_icon_async (theme, icons, 48, 1, 0, NULL, load_icon, loop); + gtk_icon_theme_choose_icon_async (theme, icons, 32, 1, 0, 0, NULL, load_icon, loop); + gtk_icon_theme_choose_icon_async (theme, icons, 48, 1, 0, 0, NULL, load_icon, loop); g_main_loop_run (loop); g_main_loop_unref (loop);