[gnome-tweak-tool] Add gtk-key-theme switcher



commit b739c222981eb8a904dbef97b41d21f114c70d55
Author: Jamie <jamie audible transient net>
Date:   Mon Jun 20 10:00:17 2011 +1200

    Add gtk-key-theme switcher

 gtweak/tweaks/tweak_interface.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_interface.py b/gtweak/tweaks/tweak_interface.py
index 81dae59..4b74044 100644
--- a/gtweak/tweaks/tweak_interface.py
+++ b/gtweak/tweaks/tweak_interface.py
@@ -73,6 +73,22 @@ class CursorThemeSwitcher(GSettingsComboTweak):
                         os.path.exists(os.path.join(d, "cursors")))
         return valid
 
+class KeyThemeSwitcher(GSettingsComboTweak):
+    def __init__(self, **options):
+        GSettingsComboTweak.__init__(self,
+            "org.gnome.desktop.interface",
+            "gtk-key-theme",
+            make_combo_list_with_default(self._get_valid_key_themes(), "Default"),
+            **options)
+
+    def _get_valid_key_themes(self):
+        dirs = ( os.path.join(gtweak.DATA_DIR, "themes"),
+                 os.path.join(os.path.expanduser("~"), ".themes"))
+        valid = walk_directories(dirs, lambda d:
+                    os.path.isfile(os.path.join(d, "gtk-3.0", "gtk-keys.css")) and \
+                    os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc")))
+        return valid
+
 sg = build_horizontal_sizegroup()
 
 TWEAK_GROUPS = (
@@ -81,6 +97,7 @@ TWEAK_GROUPS = (
             GSettingsSwitchTweak("org.gnome.desktop.interface", "menus-have-icons"),
             GSettingsSwitchTweak("org.gnome.desktop.interface", "buttons-have-icons"),
             GtkThemeSwitcher(size_group=sg),
+            KeyThemeSwitcher(size_group=sg),
             IconThemeSwitcher(size_group=sg),
             CursorThemeSwitcher(size_group=sg)),
 )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]