[gnome-tweak-tool/gnome-3-14] windows: Take other buttons into account when changing button layout
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool/gnome-3-14] windows: Take other buttons into account when changing button layout
- Date: Wed, 8 Apr 2015 14:41:24 +0000 (UTC)
commit 530d7bc98ac9016aea1ee87ff571542ee8980b16
Author: Rui Matos <tiagomatos gmail com>
Date: Mon Mar 16 20:37:55 2015 +0100
windows: Take other buttons into account when changing button layout
https://bugzilla.gnome.org/show_bug.cgi?id=743610
gtweak/tweaks/tweak_group_windows.py | 27 ++++++++++++++++++---------
1 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_windows.py b/gtweak/tweaks/tweak_group_windows.py
index ce5e26a..306fc33 100644
--- a/gtweak/tweaks/tweak_group_windows.py
+++ b/gtweak/tweaks/tweak_group_windows.py
@@ -25,7 +25,7 @@ from gi.repository import Gtk
_shell = GnomeShellFactory().get_shell()
_shell_loaded = _shell is not None
-
+
class ShowWindowButtons(GSettingsSwitchTweakValue):
def __init__(self, name, value, **options):
@@ -38,18 +38,27 @@ class ShowWindowButtons(GSettingsSwitchTweakValue):
**options)
def get_active(self):
return self.value in self.settings.get_string(self.key_name)
-
+
def set_active(self, v):
val = self.settings.get_string(self.key_name)
+
+ (left, colon, right) = val.partition(":")
+ rsplit = right.split(",")
+
if v:
- if val == ":close":
- val = val.replace(":", ":"+self.value+",")
- else:
- val = ":minimize,maximize,close"
+ rsplit.append(self.value)
else:
- val = val.replace(self.value+",", "")
+ rsplit.remove(self.value)
+
+ def sort_buttons(x, y):
+ order = ["minimize", "maximize", "close"];
+ if x in order and y in order:
+ return order.index(x) - order.index(y)
+ else:
+ return 0
+ rsplit.sort(cmp=sort_buttons)
- self.settings.set_string(self.key_name, val)
+ self.settings.set_string(self.key_name, left + colon + ",".join(rsplit))
class WindowScalingFactorTweak(Gtk.Box, Tweak):
def __init__(self, **options):
@@ -71,7 +80,7 @@ class WindowScalingFactorTweak(Gtk.Box, Tweak):
def _on_value_changed(self, adj):
self._xsettings.set_window_scaling_factor(adj.get_value())
-TWEAK_GROUPS = [
+TWEAK_GROUPS = [
ListBoxTweakGroup(TWEAK_GROUP_WINDOWS,
GSettingsSwitchTweak(_("Attached Modal Dialogs"),"org.gnome.mutter", "attach-modal-dialogs"),
GSettingsSwitchTweak(_("Automatically Raise Windows"),"org.gnome.desktop.wm.preferences",
"auto-raise"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]