From f01f0bfffd2bf365a9527053a227a261cf6b024f Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 9 Aug 2023 17:36:35 -0700 Subject: [PATCH] plugins: fix linkage of GResources The libcommon_dep gresources were not ending up in the final gsd-* plugin binaries. What this means is that the work to disable the GTK theme parsing at startup was innefective, wasting significant time and memory during application startup. Collectively, these are still slowing down login. Calling g_resources_register() at startup is enough to ensure that the the empty gtk.css ends up in the target binary. You can verify the resources show up in the resulting binary with: $ gresources list /path/to/gsd-media-keys /org/gtk/libgtk/theme/Disabled/gtk.css This was found with Sysprof while profiling login on GNOME OS. --- plugins/color/meson.build | 1 + plugins/common/daemon-skeleton-gtk.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/plugins/color/meson.build b/plugins/color/meson.build index b454bbb1f..bb05f72ff 100644 --- a/plugins/color/meson.build +++ b/plugins/color/meson.build @@ -13,6 +13,7 @@ deps = plugins_deps + [ libcanberra_gtk_dep, libgeoclue_dep, libnotify_dep, + libcommon_dep, m_dep, ] diff --git a/plugins/common/daemon-skeleton-gtk.h b/plugins/common/daemon-skeleton-gtk.h index 4e67706ed..1b73390e8 100644 --- a/plugins/common/daemon-skeleton-gtk.h +++ b/plugins/common/daemon-skeleton-gtk.h @@ -21,6 +21,8 @@ #include "gnome-settings-bus.h" +#include "gsd-resources.h" + #ifndef PLUGIN_NAME #error Include PLUGIN_CFLAGS in the daemon s CFLAGS #endif /* !PLUGIN_NAME */ @@ -219,6 +221,9 @@ main (int argc, char **argv) textdomain (GETTEXT_PACKAGE); setlocale (LC_ALL, ""); + /* Ensure we don't lose resources during linkage */ + g_resources_register (gsd_get_resource ()); + set_empty_gtk_theme (TRUE); #ifdef GDK_BACKEND -- GitLab