[libhandy] main: Don't delay styles and icons initialization
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy] main: Don't delay styles and icons initialization
- Date: Wed, 24 Jun 2020 15:03:08 +0000 (UTC)
commit 46f8f698a6bf4a90c6f89296808115c7e4cd9ec1
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat Jun 20 10:23:45 2020 +0200
main: Don't delay styles and icons initialization
It was needed because the library constructor had a lot of chance to be
called before gtk_init(), without any way to guarantee it would be
called just after it. This allowed to initialize the styles after
gtk_init() was called, but before really running the application.
Now that hdy_init() replaced the library constructor, and now it is
documented when to call it, delaying isn't needed. Dropping it avoids
race conditions on the first iteration.
Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/220
src/hdy-main.c | 25 ++-----------------------
1 file changed, 2 insertions(+), 23 deletions(-)
---
diff --git a/src/hdy-main.c b/src/hdy-main.c
index 45b3e475..7845b3d1 100644
--- a/src/hdy-main.c
+++ b/src/hdy-main.c
@@ -22,13 +22,6 @@ static gint hdy_initialized = FALSE;
* are set up properly.
*/
-/* A stupidly high priority used to load the styles before anything else
- * happens.
- *
- * See https://gitlab.gnome.org/GNOME/libhandy/issues/214.
- */
-#define HDY_PRIORITY_STYLE -1000
-
/* The style provider priority to use for libhandy widgets custom styling. It is
* higher than themes and settings, allowing to override theme defaults, but
* lower than applications and user provided styles, so application developers
@@ -205,18 +198,6 @@ hdy_icons_init (void)
g_once_init_leave (&guard, 1);
}
- /* var theme = Gtk.IconTheme.get_default (); */
- /* theme.add_resource_path ("/org/gnome/clocks/icons"); */
-
-static gboolean
-init_theme_cb (void)
-{
- hdy_style_init ();
- hdy_icons_init ();
-
- return G_SOURCE_REMOVE;
-}
-
/**
* hdy_init:
*
@@ -238,10 +219,8 @@ hdy_init (void)
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
hdy_init_public_types ();
- /* Initializes the style and icons when the main loop starts, which should be
- * before any window shows up but after GTK is initialized.
- */
- g_idle_add_full (HDY_PRIORITY_STYLE, (GSourceFunc) init_theme_cb, NULL, NULL);
+ hdy_style_init ();
+ hdy_icons_init ();
hdy_initialized = TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]