summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <wjt@endlessos.org>2023-02-23 15:33:00 +0000
committerWill Thompson <wjt@endlessos.org>2023-02-23 15:33:00 +0000
commitc7a11ead1adaca22be6d29314fe2e4debcf37bab (patch)
treea4e45e8ac2581ed6444e9af1896f8d8252d161a5
parentf00962a7a21d94a333dff76928da9084e093550a (diff)
downloadgnome-initial-setup-c7a11ead1adaca22be6d29314fe2e4debcf37bab.tar.gz
account: Install CSS in class_init(), not init()
GisAccountPageLocal may be instantiated multiple times, because all pages are reconstructed when the language is changed. But the style context is global (to a GdkDisplay). So previously, the same style provider would be installed every time the language is changed. Instead, do this in class_init(). Fixes 0416c80024e1c783df010b293173e919de7ceaa3 ("gis-account-page: Add a proper edit button to customize the user avatar").
-rw-r--r--gnome-initial-setup/pages/account/gis-account-page.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gnome-initial-setup/pages/account/gis-account-page.c b/gnome-initial-setup/pages/account/gis-account-page.c
index cbc77f9..50c6a29 100644
--- a/gnome-initial-setup/pages/account/gis-account-page.c
+++ b/gnome-initial-setup/pages/account/gis-account-page.c
@@ -296,17 +296,18 @@ gis_account_page_class_init (GisAccountPageClass *klass)
page_class->save_data = gis_account_page_save_data;
page_class->shown = gis_account_page_shown;
object_class->constructed = gis_account_page_constructed;
-}
-static void
-gis_account_page_init (GisAccountPage *page)
-{
g_autoptr(GtkCssProvider) provider = NULL;
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/org/gnome/initial-setup/gis-account-page.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+}
+
+static void
+gis_account_page_init (GisAccountPage *page)
+{
g_resources_register (account_get_resource ());
g_type_ensure (GIS_TYPE_ACCOUNT_PAGE_LOCAL);
g_type_ensure (GIS_TYPE_ACCOUNT_PAGE_ENTERPRISE);