Commit 617b6f4d authored by John Stowers's avatar John Stowers

Port Metacity/Mutter/Shell to GSettings

parent 6f9f9bd4
3.3.0
* Adapt to Metacity/Mutter/Shell ported to GSettings
3.2.2
* Dont die on malformed schemas
......
......@@ -5,7 +5,7 @@ AM_INIT_AUTOMAKE([foreign tar-ustar dist-xz no-dist-gzip])
AM_PATH_PYTHON([2.6])
GLIB_GSETTINGS
DESKTOP_SCHEMAS_REQUIRED_VERSION=3.0.0
DESKTOP_SCHEMAS_REQUIRED_VERSION=3.3.2
PYGOBJECT_REQUIRED_VERSION=2.90.0
PKG_CHECK_MODULES([GSETTINGS_DESKTOP_SCHEMAS], [gsettings-desktop-schemas >= $DESKTOP_SCHEMAS_REQUIRED_VERSION])
......
......@@ -18,14 +18,14 @@
from gi.repository import Gtk
from gtweak.tweakmodel import Tweak, TWEAK_GROUP_FONTS
from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, GConfFontButtonTweak, GSettingsComboTweak
from gtweak.widgets import GSettingsRangeTweak, GSettingsFontButtonTweak, GSettingsComboTweak
TWEAKS = (
GSettingsRangeTweak("org.gnome.desktop.interface", "text-scaling-factor", adjustment_step=0.1, group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "document-font-name", group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.interface", "monospace-font-name", group_name=TWEAK_GROUP_FONTS),
GConfFontButtonTweak("/apps/metacity/general/titlebar_font", str, group_name=TWEAK_GROUP_FONTS),
GSettingsFontButtonTweak("org.gnome.desktop.wm.preferences", "titlebar-font", group_name=TWEAK_GROUP_FONTS),
GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "hinting",
[(i, i.title()) for i in ("none", "slight", "medium", "full")], group_name=TWEAK_GROUP_FONTS),
GSettingsComboTweak("org.gnome.settings-daemon.plugins.xsettings", "antialiasing",
......
......@@ -28,13 +28,13 @@ from gtweak.utils import walk_directories, extract_zip_file, make_combo_list_wit
from gtweak.gsettings import GSettingsSetting
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.tweakmodel import Tweak, TweakGroup, TWEAK_GROUP_THEME
from gtweak.widgets import ZipFileChooserButton, GConfComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, build_label_beside_widget, build_horizontal_sizegroup, build_combo_box_text
from gtweak.widgets import ZipFileChooserButton, GSettingsComboTweak, GSettingsComboEnumTweak, GSettingsSwitchTweak, build_label_beside_widget, build_horizontal_sizegroup, build_combo_box_text
class ShowWindowButtons(GConfComboTweak):
class ShowWindowButtons(GSettingsComboTweak):
def __init__(self, **options):
GConfComboTweak.__init__(self,
"/desktop/gnome/shell/windows/button_layout",
str,
GSettingsComboTweak.__init__(self,
"org.gnome.shell.overrides",
"button-layout",
((':close', 'Close Only'),
(':minimize,close', 'Minimize and Close'),
(':maximize,close', 'Maximize and Close'),
......
......@@ -20,42 +20,17 @@ import os.path
import gtweak
from gtweak.utils import walk_directories, make_combo_list_with_default
from gtweak.tweakmodel import TWEAK_GROUP_WINDOWS, TWEAK_GROUP_THEME
from gtweak.widgets import GConfComboTweak
from gtweak.gconf import GConfSetting
from gtweak.widgets import GSettingsComboTweak, GSettingsComboEnumTweak
class ActionClickTitlebarTweak(GConfComboTweak):
def __init__(self, key_name, **options):
#from the metacity schema
schema_options = ('toggle_shade', 'toggle_maximize', 'toggle_maximize_horizontally',
'toggle_maximize_vertically', 'minimize', 'shade', 'menu', 'lower', 'none')
GConfComboTweak.__init__(self,
key_name,
str,
[(o, o.replace("_"," ").title()) for o in schema_options],
**options)
class FocusModeTweak(GConfComboTweak):
class WindowThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GConfComboTweak.__init__(self,
"/apps/metacity/general/focus_mode",
str,
[(o, o.title()) for o in ("click","sloppy","mouse")],
**options)
class WindowThemeSwitcher(GConfComboTweak):
def __init__(self, **options):
GConfComboTweak.__init__(self,
"/desktop/gnome/shell/windows/theme",
str,
GSettingsComboTweak.__init__(self,
"org.gnome.desktop.wm.preferences",
"theme",
make_combo_list_with_default(self._get_valid_themes(), "Adwaita"),
summary=_("Window theme"),
**options)
#also need to change the fallback (metacity) window theme
self.gconf_metacity = GConfSetting("/apps/metacity/general/theme", str)
def _get_valid_themes(self):
dirs = ( os.path.join(gtweak.DATA_DIR, "themes"),
os.path.join(os.path.expanduser("~"), ".themes"))
......@@ -63,19 +38,10 @@ class WindowThemeSwitcher(GConfComboTweak):
os.path.exists(os.path.join(d, "metacity-1")))
return valid
def _on_combo_changed(self, combo):
#its probbably not too nice to dupe this function here, but i'm lazy
#and the real cause is the hidious gconf/shell/metacity override business
_iter = combo.get_active_iter()
if _iter:
value = combo.get_model().get_value(_iter, 0)
self.gconf.set_value(value)
self.gconf_metacity.set_value(value)
TWEAKS = (
WindowThemeSwitcher(group_name=TWEAK_GROUP_THEME),
ActionClickTitlebarTweak("/apps/metacity/general/action_double_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
ActionClickTitlebarTweak("/apps/metacity/general/action_middle_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
ActionClickTitlebarTweak("/apps/metacity/general/action_right_click_titlebar", group_name=TWEAK_GROUP_WINDOWS),
FocusModeTweak(group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-double-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "action-right-click-titlebar", group_name=TWEAK_GROUP_WINDOWS),
GSettingsComboEnumTweak("org.gnome.desktop.wm.preferences", "focus-mode", group_name=TWEAK_GROUP_WINDOWS),
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment