I#1502 - Mail: Option to make search scope global

Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1502
This commit is contained in:
Milan Crha
2021-05-27 14:05:38 +02:00
parent ec8e8564ca
commit c8c5191b9e
2 changed files with 23 additions and 9 deletions

View File

@ -294,6 +294,11 @@
<_summary>Enable to use a similar message list view settings for all folders</_summary>
<_description>Enable to use a similar message list view settings for all folders.</_description>
</key>
<key name="global-view-search" type="b">
<default>true</default>
<_summary>Enable to use the same search settings for all folders</_summary>
<_description>This is considered only in combination with the 'global-view-setting'.</_description>
</key>
<key name="mark-citations" type="b">
<default>true</default>
<_summary>Mark citations in the message “Preview”</_summary>

View File

@ -777,9 +777,10 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view)
EMailView *mail_view;
CamelFolder *folder;
CamelVeeFolder *vee_folder;
const gchar *old_state_group;
const gchar *old_state_group, *new_state_group;
gchar *folder_uri;
gchar *new_state_group;
gchar *tmp = NULL;
GSettings *settings;
/* XXX Move this to EMailShellContent. */
@ -816,18 +817,26 @@ e_mail_shell_view_restore_state (EMailShellView *mail_shell_view)
if (vee_folder != NULL && folder == CAMEL_FOLDER (vee_folder))
goto exit;
folder_uri = e_mail_folder_uri_from_folder (folder);
new_state_group = g_strdup_printf ("Folder %s", folder_uri);
old_state_group = e_shell_searchbar_get_state_group (searchbar);
g_free (folder_uri);
settings = e_util_ref_settings ("org.gnome.evolution.mail");
if (g_settings_get_boolean (settings, "global-view-setting") &&
g_settings_get_boolean (settings, "global-view-search")) {
new_state_group = "GlobalSearch";
} else {
folder_uri = e_mail_folder_uri_from_folder (folder);
tmp = g_strdup_printf ("Folder %s", folder_uri);
new_state_group = tmp;
g_free (folder_uri);
}
/* Avoid loading search state unnecessarily. */
if (g_strcmp0 (new_state_group, old_state_group) != 0) {
old_state_group = e_shell_searchbar_get_state_group (searchbar);
/* Avoid loading search state unnecessarily, unless it's the global search. */
if (!tmp || g_strcmp0 (new_state_group, old_state_group) != 0) {
e_shell_searchbar_set_state_group (searchbar, new_state_group);
e_shell_searchbar_load_state (searchbar);
}
g_free (new_state_group);
g_free (tmp);
exit:
g_clear_object (&folder);