Accepting request 629241 from GNOME:Factory

OBS-URL: https://build.opensuse.org/request/show/629241
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/evolution?expand=0&rev=216
This commit is contained in:
Dominique Leuenberger 2018-08-27 11:45:54 +00:00 committed by Git OBS Bridge
commit 7fed898351
3 changed files with 171 additions and 1 deletions

View File

@ -0,0 +1,162 @@
From dd4cd78c96c7e91d17f7cd9c1d7d220ac8504f3e Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Thu, 26 Apr 2018 11:48:47 +0200
Subject: [PATCH] Bug 795567 - Do not expand archive folder in Copy/Move
message to folder dialog
---
data/org.gnome.evolution.mail.gschema.xml.in | 4 +
src/mail/e-mail-reader.c | 1 +
src/mail/em-folder-selector.c | 98 ++++++++++++++++++++
src/mail/em-folder-selector.h | 2 +
src/modules/mail/e-mail-shell-view-actions.c | 1 +
5 files changed, 106 insertions(+)
--- a/data/org.gnome.evolution.mail.gschema.xml.in
+++ b/data/org.gnome.evolution.mail.gschema.xml.in
@@ -728,6 +728,10 @@
<_summary>Visually wrap long lines in composer</_summary>
<_description>Whether to visually wrap long lines of text to avoid horizontal scrolling</_description>
</key>
+ <key name="collapse-archive-folders-in-selectors" type="b">
+ <default>false</default>
+ <_summary>collapse archive folders in move/copy message to folder and go to folder selectors.</_summary>
+ </key>
<!-- The following keys are deprecated. -->
--- a/src/mail/e-mail-reader.c
+++ b/src/mail/e-mail-reader.c
@@ -363,6 +363,7 @@ mail_reader_copy_or_move_selected_messag
EMFT_EXCLUDE_VIRTUAL |
EMFT_EXCLUDE_VTRASH);
gtk_tree_view_expand_all (GTK_TREE_VIEW (folder_tree));
+ em_folder_selector_maybe_collapse_archive_folders (selector);
if (default_xfer_messages_uri != NULL) {
em_folder_tree_set_selected (
--- a/src/mail/em-folder-selector.c
+++ b/src/mail/em-folder-selector.c
@@ -825,3 +825,101 @@ em_folder_selector_new_activity (EMFolde
return activity;
}
+void
+em_folder_selector_maybe_collapse_archive_folders (EMFolderSelector *selector)
+{
+ EMFolderTreeModel *model;
+ EMailSession *mail_session;
+ ESourceRegistry *registry;
+ CamelSession *session;
+ GSettings *settings;
+ GList *services, *link;
+ GHashTable *archives;
+ gchar *local_archive_folder;
+
+ g_return_if_fail (EM_IS_FOLDER_SELECTOR (selector));
+
+ settings = e_util_ref_settings ("org.gnome.evolution.mail");
+ if (!g_settings_get_boolean (settings, "collapse-archive-folders-in-selectors")) {
+ g_object_unref (settings);
+ return;
+ }
+ local_archive_folder = g_settings_get_string (settings, "local-archive-folder");
+ g_object_unref (settings);
+
+ model = em_folder_selector_get_model (selector);
+ mail_session = em_folder_tree_model_get_session (model);
+ registry = e_mail_session_get_registry (mail_session);
+ session = CAMEL_SESSION (mail_session);
+
+ archives = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+
+ if (local_archive_folder && *local_archive_folder) {
+ g_hash_table_insert (archives, local_archive_folder, NULL);
+ } else {
+ g_free (local_archive_folder);
+ }
+
+ services = camel_session_list_services (session);
+ for (link = services; link; link = g_list_next (link)) {
+ CamelService *service = link->data;
+
+ if (CAMEL_IS_STORE (service)) {
+ ESource *source;
+
+ source = e_source_registry_ref_source (registry, camel_service_get_uid (service));
+ if (source && e_source_has_extension (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT)) {
+ ESourceMailAccount *account_ext;
+ gchar *archive_folder;
+
+ account_ext = e_source_get_extension (source, E_SOURCE_EXTENSION_MAIL_ACCOUNT);
+
+ archive_folder = e_source_mail_account_dup_archive_folder (account_ext);
+ if (archive_folder && *archive_folder) {
+ g_hash_table_insert (archives, archive_folder, NULL);
+ } else {
+ g_free (archive_folder);
+ }
+ }
+
+ g_clear_object (&source);
+ }
+ }
+
+ g_list_free_full (services, g_object_unref);
+
+ if (g_hash_table_size (archives)) {
+ GtkTreeView *tree_view;
+ GHashTableIter iter;
+ gpointer key;
+
+ tree_view = GTK_TREE_VIEW (em_folder_selector_get_folder_tree (selector));
+
+ g_hash_table_iter_init (&iter, archives);
+
+ while (g_hash_table_iter_next (&iter, &key, NULL)) {
+ const gchar *folder_uri = key;
+ CamelStore *store = NULL;
+ gchar *folder_name = NULL;
+
+ if (folder_uri && *folder_uri &&
+ e_mail_folder_uri_parse (session, folder_uri, &store, &folder_name, NULL)) {
+ GtkTreeRowReference *row;
+
+ row = em_folder_tree_model_get_row_reference (model, store, folder_name);
+ if (row) {
+ GtkTreePath *path;
+
+ path = gtk_tree_row_reference_get_path (row);
+ gtk_tree_view_collapse_row (tree_view, path);
+ gtk_tree_path_free (path);
+ }
+
+ g_clear_object (&store);
+ g_free (folder_name);
+ }
+ }
+ }
+
+ g_hash_table_destroy (archives);
+}
--- a/src/mail/em-folder-selector.h
+++ b/src/mail/em-folder-selector.h
@@ -96,6 +96,8 @@ void em_folder_selector_set_selected (E
const gchar * em_folder_selector_get_selected_uri
(EMFolderSelector *selector);
EActivity * em_folder_selector_new_activity (EMFolderSelector *selector);
+void em_folder_selector_maybe_collapse_archive_folders
+ (EMFolderSelector *selector);
G_END_DECLS
--- a/src/modules/mail/e-mail-shell-view-actions.c
+++ b/src/modules/mail/e-mail-shell-view-actions.c
@@ -1145,6 +1145,7 @@ action_mail_goto_folder_cb (GtkAction *a
folder_tree = em_folder_selector_get_folder_tree (selector);
gtk_tree_view_expand_all (GTK_TREE_VIEW (folder_tree));
+ em_folder_selector_maybe_collapse_archive_folders (selector);
if (folder) {
gchar *uri = e_mail_folder_uri_from_folder (folder);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Aug 9 22:56:27 UTC 2018 - mcepl@suse.com
- Add evolution-3.28.5-dont-expand-archive-folder.patch
(bgo#795567).
-------------------------------------------------------------------
Tue Jul 31 06:27:24 UTC 2018 - bjorn.lie@gmail.com

View File

@ -33,6 +33,8 @@ License: LGPL-2.0-only AND LGPL-3.0-only
Group: Productivity/Networking/Email/Clients
URL: http://wiki.gnome.org/Apps/Evolution/
Source0: http://download.gnome.org/sources/evolution/%{evolution_base_version}/%{name}-%{version}.tar.xz
# PATCH-FIX-UPSTREAM evolution-3.28.5-dont-expand-archive-folder.patch mcepl@suse.cz -- Do not expand archive folder in Copy/Move message to folder dialog (bgo#795567)
Patch0: evolution-3.28.5-dont-expand-archive-folder.patch
# The icon we rely on is from adwaita-icon-theme
BuildRequires: adwaita-icon-theme
@ -117,7 +119,7 @@ This package provides a catalog for Glade, to allow the use of Evolution
widgets in Glade.
%package -n evolution-plugin-bogofilter
Summary: bogofilter plugin for the Evolution groupware suite
Summary: Bogofilter plugin for the Evolution groupware suite
Group: Productivity/Networking/Email/Clients
Requires: %{name}
Requires: bogofilter