[kupfer: 16/18] preferences: catch exceptions when loading .Desktop files
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 16/18] preferences: catch exceptions when loading .Desktop files
- Date: Tue, 22 Jan 2013 20:45:04 +0000 (UTC)
commit 658e67bcf746ba09d83549571c29ee4c3fe2d57b
Author: Karol BÄdkowski <karol bedkowski gmail com>
Date: Fri Dec 14 19:05:54 2012 +0100
preferences: catch exceptions when loading .Desktop files
kupfer/ui/preferences.py | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index 31edf73..e457513 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -292,14 +292,22 @@ class PreferencesWindowController (pretty.OutputMixin):
return
desktop_file_path = desktop_files[0]
# Read installed file and modify it
- dfile = desktop.DesktopEntry(desktop_file_path)
+ try:
+ dfile = desktop.DesktopEntry(desktop_file_path)
+ except xdg_e.ParsingError, exception:
+ pretty.print_error(__name__, exception)
+ return
executable = dfile.getExec()
## append no-splash
if "--no-splash" not in executable:
executable += " --no-splash"
dfile.set("Exec", executable)
else:
- dfile = desktop.DesktopEntry(autostart_file)
+ try:
+ dfile = desktop.DesktopEntry(autostart_file)
+ except xdg_e.ParsingError, exception:
+ pretty.print_error(__name__, exception)
+ return
activestr = str(bool(widget.get_active())).lower()
self.output_debug("Setting autostart to", activestr)
dfile.set(AUTOSTART_KEY, activestr)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]