From 343932964f3ca5b540173c0af3b537ca7baab230 Mon Sep 17 00:00:00 2001 From: Matthijs Velsink Date: Fri, 2 Feb 2024 01:02:41 +0100 Subject: [PATCH] system/about: Create CcSystemDetailsWindow upon opening Initializing the About page involves creating a CcSystemDetailsWindow too. This costs time, making the System panel open slower because it has to wait for the About page to finish initializing. By creating the CcSystemDetailsWindow only when it should be opened, we save at least 0.1 s when opening the System panel. --- panels/system/about/cc-about-page.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/panels/system/about/cc-about-page.c b/panels/system/about/cc-about-page.c index ddbec5fc0..89471e69d 100644 --- a/panels/system/about/cc-about-page.c +++ b/panels/system/about/cc-about-page.c @@ -54,7 +54,6 @@ about_page_setup_overview (CcAboutPage *self) g_autofree char *os_name_text = NULL; g_autofree char *hardware_model_text = NULL; g_autofree gchar *disk_capacity_string = NULL; - GtkWindow *parent; hardware_model_text = get_hardware_model_string (); cc_list_row_set_secondary_label (self->hardware_model_row, hardware_model_text); @@ -76,10 +75,6 @@ about_page_setup_overview (CcAboutPage *self) os_name_text = get_os_name (); cc_list_row_set_secondary_label (self->os_name_row, os_name_text); - - self->system_details_window = GTK_WINDOW (cc_system_details_window_new ()); - parent = (GtkWindow *) gtk_widget_get_native (GTK_WIDGET (self)); - gtk_window_set_transient_for (GTK_WINDOW (self->system_details_window), parent); } static gboolean @@ -123,6 +118,9 @@ cc_about_page_open_system_details (CcAboutPage *self) { GtkNative *parent; + if (!self->system_details_window) + self->system_details_window = GTK_WINDOW (cc_system_details_window_new ()); + parent = gtk_widget_get_native (GTK_WIDGET (self)); gtk_window_set_transient_for (self->system_details_window, GTK_WINDOW (parent)); gtk_window_present (GTK_WINDOW (self->system_details_window));