diff options
author | Stefano Karapetsas <[email protected]> | 2013-04-21 22:47:20 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-04-21 22:47:20 +0200 |
commit | 28d93721274e56e7a488df73f9b926da39945013 (patch) | |
tree | 4e724943592ef0d1258e29d966281962ad1ffa98 /mate-conf | |
parent | 3a89a7b675adb771e0ce7e960a9afff0de16c6c5 (diff) | |
download | mate-desktop-28d93721274e56e7a488df73f9b926da39945013.tar.bz2 mate-desktop-28d93721274e56e7a488df73f9b926da39945013.tar.xz |
mate-conf-import: Add support for mate-terminal default profile
Diffstat (limited to 'mate-conf')
-rwxr-xr-x | mate-conf/mate-conf-import | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mate-conf/mate-conf-import b/mate-conf/mate-conf-import index 15c519b..beb7976 100755 --- a/mate-conf/mate-conf-import +++ b/mate-conf/mate-conf-import @@ -452,6 +452,51 @@ if os.path.exists(mateconf_panel_file): # apply settings! panel_settings.apply() +# ugly hack to migrate terminal default profile +mateconf_terminal_file = os.path.join(mateconf_user_path, "apps/mate-terminal/profiles/Default", "%mateconf.xml") +if os.path.exists(mateconf_terminal_file): + + tree = ElementTree.parse(mateconf_terminal_file) + root = tree.getroot() + + gsettings_schema = "org.mate.terminal.profile" + terminal_settings = Gio.Settings.new_with_path(gsettings_schema, "/org/mate/terminal/profiles/default/") + terminal_settings.delay() + + for child in root: + # if the key exists, the user has a custom value + if 'name' in child.attrib: + + gsettings_key = gsettings_id(child.attrib['name']) + + # boolean + if child.attrib["type"] == "bool": + if child.attrib["value"] == "true": + debug_message(gsettings_schema, gsettings_key, True) + terminal_settings.set_boolean(gsettings_key, True) + else: + debug_message(gsettings_schema, gsettings_key, False) + terminal_settings.set_boolean(gsettings_key, False) + + # int + elif child.attrib["type"] == "int": + debug_message(gsettings_schema, gsettings_key, int(child.attrib["value"])) + terminal_settings.set_int(gsettings_key, int(child.attrib["value"])) + + # string + elif child.attrib["type"] == "string": + + value = child[0].text + if value != None: + debug_message(gsettings_schema, gsettings_key, value) + terminal_settings.set_string(gsettings_key, value) + + else: + debug_message("Unknown type", child.attrib["type"]) + + # apply settings! + terminal_settings.apply() + # success! dialog = Gtk.MessageDialog (None, Gtk.DialogFlags.MODAL, |