From 014757afa4bed330f5562dbbdd30bba4e30e83c0 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 21 Jan 2025 10:49:54 +0100 Subject: [PATCH] Preview layout setting does not stick after app restart The change from classic/horizontal to vertical is saved into the GSettings, but on start the state was restored to the second action of this radio group, while the group was not set yet, due to the EUIManager being frozen at that time, thus when the EUIMnager had been unfrozen, the value of the first action in the group was used to update the group value, which did not reflect the value read from the GSettings. Instead of shifting the binding settings to a place where the EUIManager is truly unfrozen, simply use the first action in the group for the GSettings key. --- src/modules/addressbook/e-book-shell-view-private.c | 4 +++- src/modules/calendar/e-cal-shell-view-private.c | 4 +++- src/modules/calendar/e-memo-shell-view-private.c | 4 +++- src/modules/calendar/e-task-shell-view-private.c | 6 ++++-- src/modules/mail/e-mail-shell-view-private.c | 4 +++- 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/modules/addressbook/e-book-shell-view-private.c b/src/modules/addressbook/e-book-shell-view-private.c index f5ebfaea41..3de15e2598 100644 --- a/src/modules/addressbook/e-book-shell-view-private.c +++ b/src/modules/addressbook/e-book-shell-view-private.c @@ -625,7 +625,9 @@ e_book_shell_view_private_constructed (EBookShellView *book_shell_view) book_shell_view->priv->book_shell_content, "preview-visible", G_BINDING_SYNC_CREATE); - action = ACTION (CONTACT_VIEW_VERTICAL); + /* use the "classic" action, because it's the first in the group and + the group is not set yet, due to the UI manager being frozen */ + action = ACTION (CONTACT_VIEW_CLASSIC); g_settings_bind_with_mapping ( settings, "layout", diff --git a/src/modules/calendar/e-cal-shell-view-private.c b/src/modules/calendar/e-cal-shell-view-private.c index 9be5585c59..0d4ce40dd4 100644 --- a/src/modules/calendar/e-cal-shell-view-private.c +++ b/src/modules/calendar/e-cal-shell-view-private.c @@ -593,7 +593,9 @@ e_cal_shell_view_private_constructed (ECalShellView *cal_shell_view) priv->views[E_CAL_VIEW_KIND_YEAR].calendar_view, "preview-visible", G_BINDING_SYNC_CREATE); - action = ACTION (CALENDAR_PREVIEW_VERTICAL); + /* use the "horizontal" action, because it's the first in the group and + the group is not set yet, due to the UI manager being frozen */ + action = ACTION (CALENDAR_PREVIEW_HORIZONTAL); g_settings_bind_with_mapping ( settings, "year-layout", diff --git a/src/modules/calendar/e-memo-shell-view-private.c b/src/modules/calendar/e-memo-shell-view-private.c index 6414286f29..f50260c72c 100644 --- a/src/modules/calendar/e-memo-shell-view-private.c +++ b/src/modules/calendar/e-memo-shell-view-private.c @@ -277,7 +277,9 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view) priv->memo_shell_content, "preview-visible", G_BINDING_SYNC_CREATE); - action = ACTION (MEMO_VIEW_VERTICAL); + /* use the "classic" action, because it's the first in the group and + the group is not set yet, due to the UI manager being frozen */ + action = ACTION (MEMO_VIEW_CLASSIC); g_settings_bind_with_mapping ( settings, "memo-layout", diff --git a/src/modules/calendar/e-task-shell-view-private.c b/src/modules/calendar/e-task-shell-view-private.c index 350898edfb..571dfa1d2c 100644 --- a/src/modules/calendar/e-task-shell-view-private.c +++ b/src/modules/calendar/e-task-shell-view-private.c @@ -432,11 +432,13 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view) priv->task_shell_content, "preview-visible", G_BINDING_SYNC_CREATE); - action = ACTION (TASK_VIEW_VERTICAL); + /* use the "classic" action, because it's the first in the group and + the group is not set yet, due to the UI manager being frozen */ + action = ACTION (TASK_VIEW_CLASSIC); g_settings_bind_with_mapping ( settings, "task-layout", - ACTION (TASK_VIEW_VERTICAL), "state", + action, "state", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY, e_shell_view_util_layout_to_state_cb, e_shell_view_util_state_to_layout_cb, NULL, NULL); diff --git a/src/modules/mail/e-mail-shell-view-private.c b/src/modules/mail/e-mail-shell-view-private.c index 8c978eefb1..892697ebab 100644 --- a/src/modules/mail/e-mail-shell-view-private.c +++ b/src/modules/mail/e-mail-shell-view-private.c @@ -638,7 +638,9 @@ e_mail_shell_view_private_constructed (EMailShellView *mail_shell_view) ACTION (MAIL_SHOW_PREVIEW_TOOLBAR), "active", G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_NO_SENSITIVITY); - action = ACTION (MAIL_VIEW_VERTICAL); + /* use the "classic" action, because it's the first in the group and + the group is not set yet, due to the UI manager being frozen */ + action = ACTION (MAIL_VIEW_CLASSIC); g_settings_bind_with_mapping ( settings, "layout",