[Xfce4-commits] <postler:master> Treat failure to list folders as an error
Christian Dywan
noreply at xfce.org
Thu Dec 30 06:00:09 CET 2010
Updating branch refs/heads/master
to 4651968ba6689f75dee664e1a78ed23a0aa98106 (commit)
from 85fdba7ea650d00606af3132d065cbe7c1a8c194 (commit)
commit 4651968ba6689f75dee664e1a78ed23a0aa98106
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Dec 29 01:18:44 2010 +0100
Treat failure to list folders as an error
No folders should be created that the server didn't list,
including inbox for completeness. And special folders
shouldn't be implicitly added if no other folders exist.
An error icon indicates that fetching folders failed.
postler/postler-folders.vala | 5 ++++-
postler/postler-service.vala | 21 +++++++++------------
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/postler/postler-folders.vala b/postler/postler-folders.vala
index 7a807de..a6541f7 100644
--- a/postler/postler-folders.vala
+++ b/postler/postler-folders.vala
@@ -178,7 +178,7 @@ public class Postler.Folders : Gtk.TreeView {
populate_accounts (account_infos, num_accounts);
});
store.insert_with_values (out account_iter, null, -1,
- Columns.ICON, Gtk.STOCK_DIRECTORY,
+ Columns.ICON, Gtk.STOCK_DIALOG_ERROR,
Columns.NAME, account_info.name,
Columns.ELLIPSIZE, Pango.EllipsizeMode.MIDDLE,
Columns.LOCATION, null,
@@ -186,6 +186,9 @@ public class Postler.Folders : Gtk.TreeView {
Columns.TOPLEVEL_MONITOR, monitor);
}
+ if (!FileUtils.test (account_info.path + "/INBOX", FileTest.EXISTS))
+ continue;
+
var folder_enumerator = folder_dir.enumerate_children (
FILE_ATTRIBUTE_STANDARD_NAME, 0, null);
FileInfo info;
diff --git a/postler/postler-service.vala b/postler/postler-service.vala
index 58f4502..310fff0 100644
--- a/postler/postler-service.vala
+++ b/postler/postler-service.vala
@@ -161,22 +161,19 @@ namespace Postler {
string output;
Process.spawn_sync (null, command.split (" "), null,
SpawnFlags.SEARCH_PATH, null, out output);
- GLib.debug ("%s -> %s", info.path, output);
- string[] folders = ((output.split ("INBOX\n"
- + "Channel local-remote\n"
- + "Opening slave local...\n"
- + "local-remote:"))[1]).split ("\n");
- /* INBOX is always needed */
- DirUtils.create_with_parents (info.path + "/INBOX/new", 0700);
- DirUtils.create (info.path + "/INBOX/cur", 0700);
- DirUtils.create (info.path + "/INBOX/tmp", 0700);
+ GLib.debug ("Fetching %s\n%s", info.name, output);
+ string[] listing = output.split ("INBOX\n"
+ + "Channel local-remote\n"
+ + "Opening slave local...\n"
+ + "local-remote:\n");
+ if (!(listing[0] != null && listing[1] != null))
+ throw new GLib.FileError.FAILED (_("Failed to list folders"));
+ string[] folders = listing[1].chomp ().split ("\n");
foreach (string current_folder in folders) {
- if (current_folder == "")
- continue;
string folder = info.path + "/" + current_folder.replace ("/", "~-");
DirUtils.create_with_parents (folder + "/new", 0700);
DirUtils.create (folder + "/cur", 0700);
- DirUtils.create (current_folder + "/tmp", 0700);
+ DirUtils.create (folder + "/tmp", 0700);
}
} catch (Error error) {
return false;
More information about the Xfce4-commits
mailing list