forked from AuroraMiddleware/gtk
Ensure icon themes are loaded with other themes
Trigger icon theme loading from the code in GtkApplication where we set up the icon theme search path. This makes it happen before the first frame.
This commit is contained in:
parent
4ac8011126
commit
88d26b7549
@ -38,7 +38,7 @@
|
|||||||
#include "gtkmain.h"
|
#include "gtkmain.h"
|
||||||
#include "gtkrecentmanager.h"
|
#include "gtkrecentmanager.h"
|
||||||
#include "gtkaccelmapprivate.h"
|
#include "gtkaccelmapprivate.h"
|
||||||
#include "gtkicontheme.h"
|
#include "gtkiconthemeprivate.h"
|
||||||
#include "gtkbuilder.h"
|
#include "gtkbuilder.h"
|
||||||
#include "gtkshortcutswindow.h"
|
#include "gtkshortcutswindow.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
@ -218,6 +218,7 @@ gtk_application_load_resources (GtkApplication *application)
|
|||||||
iconspath = g_strconcat (base_path, "/icons/", NULL);
|
iconspath = g_strconcat (base_path, "/icons/", NULL);
|
||||||
gtk_icon_theme_add_resource_path (default_theme, iconspath);
|
gtk_icon_theme_add_resource_path (default_theme, iconspath);
|
||||||
g_free (iconspath);
|
g_free (iconspath);
|
||||||
|
gtk_icon_theme_ensure_loaded (default_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Load the menus */
|
/* Load the menus */
|
||||||
|
@ -762,7 +762,6 @@ do_theme_change (GtkIconTheme *self)
|
|||||||
blow_themes (self);
|
blow_themes (self);
|
||||||
|
|
||||||
queue_theme_changed (self);
|
queue_theme_changed (self);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1270,6 +1269,7 @@ load_themes (GtkIconTheme *self)
|
|||||||
IconThemeDirMtime *dir_mtime;
|
IconThemeDirMtime *dir_mtime;
|
||||||
GStatBuf stat_buf;
|
GStatBuf stat_buf;
|
||||||
GList *d;
|
GList *d;
|
||||||
|
gint64 before = g_get_monotonic_time ();
|
||||||
|
|
||||||
if (self->current_theme)
|
if (self->current_theme)
|
||||||
insert_theme (self, self->current_theme);
|
insert_theme (self, self->current_theme);
|
||||||
@ -1356,6 +1356,9 @@ load_themes (GtkIconTheme *self)
|
|||||||
g_message ("%s", s->str);
|
g_message ("%s", s->str);
|
||||||
g_string_free (s, TRUE);
|
g_string_free (s, TRUE);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
self->loading_themes = FALSE;
|
||||||
|
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon theme load", self->current_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1363,7 +1366,6 @@ ensure_valid_themes (GtkIconTheme *self)
|
|||||||
{
|
{
|
||||||
GTimeVal tv;
|
GTimeVal tv;
|
||||||
gboolean was_valid = self->themes_valid;
|
gboolean was_valid = self->themes_valid;
|
||||||
gint64 before = g_get_monotonic_time ();
|
|
||||||
|
|
||||||
if (self->loading_themes)
|
if (self->loading_themes)
|
||||||
return;
|
return;
|
||||||
@ -1389,11 +1391,12 @@ ensure_valid_themes (GtkIconTheme *self)
|
|||||||
if (was_valid)
|
if (was_valid)
|
||||||
queue_theme_changed (self);
|
queue_theme_changed (self);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (gdk_profiler_is_running ())
|
void
|
||||||
gdk_profiler_add_mark (before * 1000, (g_get_monotonic_time () - before) * 1000, "icon theme load", NULL);
|
gtk_icon_theme_ensure_loaded (GtkIconTheme *self)
|
||||||
|
{
|
||||||
self->loading_themes = FALSE;
|
ensure_valid_themes (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline gboolean
|
static inline gboolean
|
||||||
|
@ -27,4 +27,6 @@ void gtk_icon_theme_lookup_symbolic_colors (GtkCssStyle *style,
|
|||||||
GdkRGBA *warning_out,
|
GdkRGBA *warning_out,
|
||||||
GdkRGBA *error_out);
|
GdkRGBA *error_out);
|
||||||
|
|
||||||
|
void gtk_icon_theme_ensure_loaded (GtkIconTheme *self);
|
||||||
|
|
||||||
#endif /* __GTK_ICON_THEME_PRIVATE_H__ */
|
#endif /* __GTK_ICON_THEME_PRIVATE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user