[Xfce4-commits] <postler:master> Handle enumeration and monitoring failure separately
Christian Dywan
noreply at xfce.org
Fri Nov 26 01:08:05 CET 2010
Updating branch refs/heads/master
to 8cb9d5db7e346423c8d382b0b9695f8b2676b5ea (commit)
from 1c2e3f195c4493bb57fe16bea3da23515b477f91 (commit)
commit 8cb9d5db7e346423c8d382b0b9695f8b2676b5ea
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Nov 25 23:26:49 2010 +0100
Handle enumeration and monitoring failure separately
Failure to enumerate a particular folder usually means that the
account is empty or there is a /new or /cur missing. So this
shouldn't prevent populating messages.
Failure to monitor deserves its own error message.
postler/postler-messages.vala | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index 2a214de..1a3beb3 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -653,14 +653,25 @@ public class Postler.Messages : Gtk.TreeView {
foreach (var folder in folders) {
var folder_dir = File.new_for_path (folder);
- var folder_enumerator = folder_dir.enumerate_children (
- FILE_ATTRIBUTE_STANDARD_NAME + "," +
- FILE_ATTRIBUTE_STANDARD_SIZE, 0, null);
+ FileEnumerator folder_enumerator;
+ try {
+ folder_enumerator = folder_dir.enumerate_children (
+ FILE_ATTRIBUTE_STANDARD_NAME + "," +
+ FILE_ATTRIBUTE_STANDARD_SIZE, 0, null);
+ } catch (GLib.Error enumerator_error) {
+ /* Empty accounts can't be enumerated. */
+ continue;
+ }
GLib.FileInfo info;
- FileMonitor folder_monitor = folder_dir.monitor_directory (0, null);
- folder_monitor.changed.connect (folder_monitor_changed);
- folder_monitors += folder_monitor;
+ try {
+ var folder_monitor = folder_dir.monitor_directory (0, null);
+ folder_monitor.changed.connect (folder_monitor_changed);
+ folder_monitors += folder_monitor;
+ } catch (GLib.Error monitor_error) {
+ GLib.critical (_("Failed to monitor folder \"%s\": %s"),
+ folder, monitor_error.message);
+ }
folder = folder_dir.get_basename ();
bool folder_new = folder_dir.get_path ().has_suffix ("new");
More information about the Xfce4-commits
mailing list