[kupfer: 15/18] preferences: prevent Kupfer crashing on broken .desktop files
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 15/18] preferences: prevent Kupfer crashing on broken .desktop files
- Date: Tue, 22 Jan 2013 20:44:59 +0000 (UTC)
commit 326e2d83c6f6b44f0206062795aa93d9eecb5a30
Author: Karol BÄdkowski <karol bedkowski gmail com>
Date: Thu Dec 13 18:29:40 2012 +0100
preferences: prevent Kupfer crashing on broken .desktop files
Closes: lp#1089347
kupfer/ui/preferences.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/ui/preferences.py b/kupfer/ui/preferences.py
index f6f82e5..31edf73 100644
--- a/kupfer/ui/preferences.py
+++ b/kupfer/ui/preferences.py
@@ -7,6 +7,7 @@ import gobject
import pango
from xdg import BaseDirectory as base
from xdg import DesktopEntry as desktop
+from xdg import Exceptions as xdg_e
from kupfer import config, pretty, utils, icons, version
@@ -270,7 +271,11 @@ class PreferencesWindowController (pretty.OutputMixin):
autostart_file = os.path.join(autostart_dir, KUPFER_DESKTOP)
if not os.path.exists(autostart_file):
return False
- dfile = desktop.DesktopEntry(autostart_file)
+ try:
+ dfile = desktop.DesktopEntry(autostart_file)
+ except xdg_e.ParsingError, exception:
+ pretty.print_error(__name__, exception)
+ return False
return (dfile.hasKey(AUTOSTART_KEY) and
dfile.get(AUTOSTART_KEY, type="boolean"))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]