[conduit] Catch errors when adding a gio monitor to a file that does not support monitoring fails
- From: John Stowers <jstowers src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit] Catch errors when adding a gio monitor to a file that does not support monitoring fails
- Date: Tue, 7 Apr 2009 18:17:43 -0400 (EDT)
commit bb6005a2ec44a5ec70ae6c49b7a9aa41f6c68268
Author: John Stowers <john nzjrs-desktop (none)>
Date: Wed Apr 8 10:14:09 2009 +1200
Catch errors when adding a gio monitor to a file that does not support monitoring fails
---
ChangeLog | 5 +++++
conduit/platform/FileGio.py | 13 ++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c49923c..d414f27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-04-08 John Stowers <john stowers gmail com>
+
+ * conduit/platform/FileGio.py:
+ Catch errors when failing to add a file monitor.
+
2009-03-17 Alexandre Rosenfeld <airmind gmail com>
* conduit/gtkui/ConfigContainer.py:
diff --git a/conduit/platform/FileGio.py b/conduit/platform/FileGio.py
index f056d8f..54bb3bc 100644
--- a/conduit/platform/FileGio.py
+++ b/conduit/platform/FileGio.py
@@ -305,12 +305,15 @@ class FileMonitor(conduit.platform.FileMonitor):
self.emit("changed", f1.get_uri(), event)
def add(self, URI, monitorType):
- if monitorType == self.MONITOR_DIRECTORY:
- self._fm = gio.File(URI).monitor_directory()
- else:
- self._fm = gio.File(URI).monitor_file()
+ try:
+ if monitorType == self.MONITOR_DIRECTORY:
+ self._fm = gio.File(URI).monitor_directory()
+ else:
+ self._fm = gio.File(URI).monitor_file()
- self._fm.connect("changed", self._on_change)
+ self._fm.connect("changed", self._on_change)
+ except gio.Error:
+ log.warn("Could not add monitor", exc_info=True)
def cancel(self):
if self._fm:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]