aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-01-07 23:46:14 +0800
committerMilan Crha <mcrha@redhat.com>2010-01-07 23:46:14 +0800
commit5accac136eb35405cbb8069e0f12191391c58a1a (patch)
tree57a77881b2756be22daf81fee29af372356533f8 /mail/em-utils.c
parent84d1cc73e2b9765b02b361a45c50b8bab25d4436 (diff)
downloadgsoc2013-evolution-5accac136eb35405cbb8069e0f12191391c58a1a.tar.gz
gsoc2013-evolution-5accac136eb35405cbb8069e0f12191391c58a1a.tar.zst
gsoc2013-evolution-5accac136eb35405cbb8069e0f12191391c58a1a.zip
Bug #604994 - Folder state not preserved in Copy/Move Folder dialog
Diffstat (limited to 'mail/em-utils.c')
-rw-r--r--mail/em-utils.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 63d323430f..eab434dfaf 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2210,3 +2210,38 @@ em_utils_guess_account (CamelMimeMessage *message, CamelFolder *folder)
return account;
}
+
+void
+emu_restore_folder_tree_state (EMFolderTree *folder_tree)
+{
+ EShell *shell;
+ EShellBackend *backend;
+ GKeyFile *key_file;
+ const gchar *config_dir;
+ gchar *filename;
+ GError *error = NULL;
+
+ g_return_if_fail (folder_tree != NULL);
+ g_return_if_fail (EM_IS_FOLDER_TREE (folder_tree));
+
+ shell = e_shell_get_default ();
+ backend = e_shell_get_backend_by_name (shell, "mail");
+ g_return_if_fail (backend != NULL);
+
+ config_dir = e_shell_backend_get_config_dir (backend);
+ g_return_if_fail (config_dir != NULL);
+
+ filename = g_build_filename (config_dir, "state", NULL);
+
+ key_file = g_key_file_new ();
+ g_key_file_load_from_file (key_file, filename, 0, &error);
+ g_free (filename);
+
+ if (error) {
+ g_error_free (error);
+ } else {
+ em_folder_tree_restore_state (folder_tree, key_file);
+ }
+
+ g_key_file_free (key_file);
+}