[evolution-data-server] Set properly children availability for newly created local folders
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Set properly children availability for newly created local folders
- Date: Thu, 17 Apr 2014 12:42:03 +0000 (UTC)
commit fbec8fe2cf4e13d4549f71c90fe97ec8ba435af3
Author: Milan Crha <mcrha redhat com>
Date: Thu Apr 17 14:40:05 2014 +0200
Set properly children availability for newly created local folders
This is to help with a UI regression mentioned at
https://bugzilla.gnome.org/show_bug.cgi?id=722698#c13
with the local folders.
camel/providers/local/camel-local-folder.c | 4 ++-
camel/providers/local/camel-maildir-store.c | 28 +++++++++++++++++++++++---
2 files changed, 27 insertions(+), 5 deletions(-)
---
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 555ca8b..e203210 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -644,7 +644,9 @@ camel_local_folder_construct (CamelLocalFolder *lf,
if ((flags & CAMEL_STORE_FOLDER_CREATE) != 0) {
CamelFolderInfo *fi;
- fi = camel_store_get_folder_info_sync (parent_store, full_name, 0, NULL, NULL);
+ /* Use 'recursive' mode, even for just created folder, to have set whether
+ the folder has children or not properly. */
+ fi = camel_store_get_folder_info_sync (parent_store, full_name,
CAMEL_STORE_FOLDER_INFO_RECURSIVE, NULL, NULL);
g_return_val_if_fail (fi != NULL, lf);
camel_store_folder_created (parent_store, fi);
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 2884ff0..9a3ff35 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -607,6 +607,7 @@ scan_dirs (CamelStore *store,
CamelLocalSettings *local_settings;
CamelSettings *settings;
CamelService *service;
+ CamelFolderInfo *fi;
GPtrArray *folders;
gint res = -1;
DIR *dir;
@@ -665,7 +666,6 @@ scan_dirs (CamelStore *store,
while ((d = readdir (dir))) {
gchar *full_name, *filename;
const gchar *short_name;
- CamelFolderInfo *fi;
struct stat st;
if (strcmp (d->d_name, "tmp") == 0
@@ -707,9 +707,6 @@ scan_dirs (CamelStore *store,
fi = scan_fi (store, flags, full_name, short_name, cancellable);
g_free (full_name);
- fi->flags &= ~CAMEL_FOLDER_NOCHILDREN;
- fi->flags |= CAMEL_FOLDER_CHILDREN;
-
g_ptr_array_add (folders, fi);
}
@@ -725,6 +722,29 @@ scan_dirs (CamelStore *store,
camel_folder_info_free (old_topfi);
}
+ fi = *topfi;
+
+ if (fi && (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) != 0) {
+ while (fi) {
+ if (fi->child) {
+ fi->flags = fi->flags & (~CAMEL_FOLDER_NOCHILDREN);
+ fi->flags = fi->flags | CAMEL_FOLDER_CHILDREN;
+
+ fi = fi->child;
+ } else if (fi->next) {
+ fi = fi->next;
+ } else {
+ while (fi) {
+ fi = fi->parent;
+ if (fi && fi->next) {
+ fi = fi->next;
+ break;
+ }
+ }
+ }
+ }
+ }
+
res = 0;
} else
res = -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]