diff options
author | Stefano Karapetsas <[email protected]> | 2013-04-07 01:31:02 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-04-07 01:31:02 +0200 |
commit | 059e1f11c7f24f63bb849adf88775be4b0031c35 (patch) | |
tree | f5adb4aa46031b581b838c46bc72fe4fc1c6fd99 /mate-conf | |
parent | c81f15186809952ed6fca75f2d60d605218fed2d (diff) | |
download | mate-desktop-059e1f11c7f24f63bb849adf88775be4b0031c35.tar.bz2 mate-desktop-059e1f11c7f24f63bb849adf88775be4b0031c35.tar.xz |
mate-conf-import: Improve comments
Diffstat (limited to 'mate-conf')
-rwxr-xr-x | mate-conf/mate-conf-import | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/mate-conf/mate-conf-import b/mate-conf/mate-conf-import index 0abc2a8..2517b88 100755 --- a/mate-conf/mate-conf-import +++ b/mate-conf/mate-conf-import @@ -27,11 +27,14 @@ import sys # to read MateConf files import xml.etree.ElementTree as ElementTree -# to write GSettings + import gi +# to show dialogs gi.require_version("Gtk", "2.0") from gi.repository import Gtk +# to read convert files from gi.repository import GLib +# to write GSettings from gi.repository import Gio # command options @@ -81,6 +84,7 @@ dialog = Gtk.MessageDialog (None, "Migrate settings from MATE 1.4?") res = dialog.run() if res != Gtk.ResponseType.YES: + dialog.destroy() sys.exit(0) dialog.destroy() @@ -118,6 +122,7 @@ for convert_file in convert_files: # if user has custom mateconf if os.path.exists(mateconf_file): + # MateConf file could be empty try: tree = ElementTree.parse(mateconf_file) root = tree.getroot() @@ -219,25 +224,31 @@ if os.path.exists(mateconf_panel_file): new_objects.append(obj_id) for child in obj_root: + # toplevel-id if child.attrib["name"] == "toplevel_id": obj_settings.set_string("toplevel-id", gsettings_id(child[0].text)) + # object-type elif child.attrib["name"] == "object_type": obj_type = child[0].text - # changed types + # changed types in 1.6 if obj_type == "launcher-object": obj_type = "launcher" elif obj_type == "action-applet": obj_type = "action" obj_settings.set_string("object-type", obj_type) + # other settings elif "type" in child.attrib: name = gsettings_id(child.attrib["name"]) + # boolean if child.attrib["type"] == "bool": if child.attrib["value"] == "true": obj_settings.set_boolean(name, True) else: obj_settings.set_boolean(name, False) + # int elif child.attrib["type"] == "int": obj_settings.set_int(name, int(child.attrib["value"])) + # string elif child.attrib["type"] == "string": obj_settings.set_string(name, child[0].text) @@ -252,30 +263,37 @@ if os.path.exists(mateconf_panel_file): new_objects.append(app_id) for child in app_root: + # toplevel-id if child.attrib["name"] == "toplevel_id": app_settings.set_string("toplevel-id", gsettings_id(child[0].text)) + # object-type elif child.attrib["name"] == "object_type": app_type = child[0].text if app_type == "external-applet": app_type = "applet" app_settings.set_string("object-type", app_type) + # applet-iid elif child.attrib["name"] == "applet_iid": applet_iid = child[0].text - # changed iids + # changed iids in 1.6 if applet_iid == "OAFIID:SensorsApplet": applet_iid = "SensorsAppletFactory::SensorsApplet" elif applet_iid == "OAFIID:MATE_NetspeedApplet": applet_iid = "NetspeedAppletFactory::NetspeedApplet" app_settings.set_string("applet-iid", applet_iid) + # other settings elif "type" in child.attrib: name = gsettings_id(child.attrib["name"]) + # boolean if child.attrib["type"] == "bool": if child.attrib["value"] == "true": app_settings.set_boolean(name, True) else: app_settings.set_boolean(name, False) + # int elif child.attrib["type"] == "int": app_settings.set_int(name, int(child.attrib["value"])) + # string elif child.attrib["type"] == "string": app_settings.set_string(name, child[0].text) @@ -292,13 +310,16 @@ if os.path.exists(mateconf_panel_file): for child in toplevel_root: if "type" in child.attrib: name = gsettings_id(child.attrib["name"]) + # boolean if child.attrib["type"] == "bool": if child.attrib["value"] == "true": toplevel_settings.set_boolean(name, True) else: toplevel_settings.set_boolean(name, False) + # int elif child.attrib["type"] == "int": toplevel_settings.set_int(name, int(child.attrib["value"])) + # string elif child.attrib["type"] == "string": toplevel_settings.set_string(name, child[0].text) |