From 07393bee130f722d33f094a686dcfdab82e8aa20 Mon Sep 17 00:00:00 2001 From: Qiu Wenbo Date: Sun, 21 Apr 2024 02:44:50 +0800 Subject: [PATCH 1/5] shell: Move the construction of default_settings to composite template Signed-off-by: Qiu Wenbo --- shell/pps-window.c | 9 ++++----- shell/pps-window.ui | 4 ++++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/shell/pps-window.c b/shell/pps-window.c index 80dd99a74..4de45177e 100644 --- a/shell/pps-window.c +++ b/shell/pps-window.c @@ -5199,10 +5199,8 @@ pps_window_dispose (GObject *object) g_clear_object (&priv->attachment_popup_menu); g_clear_object (&priv->settings); - if (priv->default_settings) { - g_settings_apply (priv->default_settings); - g_clear_object (&priv->default_settings); - } + + g_settings_apply (priv->default_settings); /* FIXME: crash when closing papers window */ /* g_clear_object (&priv->lockdown_settings); */ @@ -6349,7 +6347,6 @@ pps_window_init (PpsWindow *pps_window) G_CALLBACK (view_caret_cursor_moved_cb), pps_window, 0); - priv->default_settings = g_settings_new (GS_SCHEMA_NAME".Default"); g_settings_delay (priv->default_settings); pps_window_setup_default (pps_window); @@ -6393,6 +6390,8 @@ pps_window_class_init (PpsWindowClass *pps_window_class) gtk_widget_class_bind_template_child_private (widget_class, PpsWindow, page_selector); gtk_widget_class_bind_template_child_private (widget_class, PpsWindow, header_bar); + gtk_widget_class_bind_template_child_private (widget_class, PpsWindow, default_settings); + /* sidebar */ gtk_widget_class_bind_template_child_private (widget_class, PpsWindow, sidebar_links); gtk_widget_class_bind_template_child_private (widget_class, PpsWindow, sidebar_annots); diff --git a/shell/pps-window.ui b/shell/pps-window.ui index 9da6ca77f..6a4183610 100644 --- a/shell/pps-window.ui +++ b/shell/pps-window.ui @@ -17,6 +17,10 @@ + + org.gnome.Papers.Default + +