summaryrefslogtreecommitdiff
path: root/mate-conf/mate-conf-import
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2013-04-07 13:32:05 +0200
committerStefano Karapetsas <[email protected]>2013-04-07 13:32:05 +0200
commit0f86ff8cb5e71c063b0976ae162e18a98056d181 (patch)
treea3f73dd2a528b1503dc19e3e0d72f34eea882e2f /mate-conf/mate-conf-import
parentbbd33e26c62a26d038c1b0d6e1d05c1aa8b682a1 (diff)
downloadmate-desktop-0f86ff8cb5e71c063b0976ae162e18a98056d181.tar.bz2
mate-desktop-0f86ff8cb5e71c063b0976ae162e18a98056d181.tar.xz
mate-conf-import: Check if mateconf files exists and are valid before use them
Diffstat (limited to 'mate-conf/mate-conf-import')
-rwxr-xr-xmate-conf/mate-conf-import23
1 files changed, 17 insertions, 6 deletions
diff --git a/mate-conf/mate-conf-import b/mate-conf/mate-conf-import
index 8d0aa55..5fe9c86 100755
--- a/mate-conf/mate-conf-import
+++ b/mate-conf/mate-conf-import
@@ -220,8 +220,11 @@ if os.path.exists(mateconf_panel_file):
mateconf_obj_file = os.path.join(mateconf_user_path, "apps/panel/objects", obj, "%mateconf.xml")
if not os.path.exists(mateconf_obj_file):
continue
- obj_tree = ElementTree.parse(mateconf_obj_file)
- obj_root = obj_tree.getroot()
+ try:
+ obj_tree = ElementTree.parse(mateconf_obj_file)
+ obj_root = obj_tree.getroot()
+ except:
+ continue
obj_id = gsettings_id(obj)
obj_settings = Gio.Settings.new_with_path("org.mate.panel.object", "/org/mate/panel/objects/%s/" % obj_id)
new_objects.append(obj_id)
@@ -261,8 +264,11 @@ if os.path.exists(mateconf_panel_file):
mateconf_app_file = os.path.join(mateconf_user_path, "apps/panel/applets", app, "%mateconf.xml")
if not os.path.exists(mateconf_app_file):
continue
- app_tree = ElementTree.parse(mateconf_app_file)
- app_root = app_tree.getroot()
+ try:
+ app_tree = ElementTree.parse(mateconf_app_file)
+ app_root = app_tree.getroot()
+ except:
+ continue
app_id = gsettings_id(app)
app_settings = Gio.Settings.new_with_path("org.mate.panel.object", "/org/mate/panel/objects/%s/" % app_id)
new_objects.append(app_id)
@@ -308,8 +314,13 @@ if os.path.exists(mateconf_panel_file):
for toplevel in toplevels:
debug_message("toplevel", toplevel)
mateconf_toplevel_file = os.path.join(mateconf_user_path, "apps/panel/toplevels", toplevel, "%mateconf.xml")
- toplevel_tree = ElementTree.parse(mateconf_toplevel_file)
- toplevel_root = toplevel_tree.getroot()
+ if not os.path.exists(mateconf_toplevel_file):
+ continue
+ try:
+ toplevel_tree = ElementTree.parse(mateconf_toplevel_file)
+ toplevel_root = toplevel_tree.getroot()
+ except:
+ continue
toplevel_id = gsettings_id(toplevel)
toplevel_settings = Gio.Settings.new_with_path("org.mate.panel.toplevel", "/org/mate/panel/toplevels/%s/" % toplevel_id)
new_toplevels.append(toplevel_id)