[gnome-tweak-tool] 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] windows: Take other buttons into account when changing button layout
- Date: Mon, 16 Mar 2015 19:43:58 +0000 (UTC)
commit 69f3ecee579f2979c0980d2dc8e1d38fb42206e1
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 15ba5d4..3db10c2 100644
--- a/gtweak/tweaks/tweak_group_windows.py
+++ b/gtweak/tweaks/tweak_group_windows.py
@@ -26,7 +26,7 @@ from gi.repository import Gtk, GLib
_shell = GnomeShellFactory().get_shell()
_shell_loaded = _shell is not None
-
+
class ShowWindowButtons(GSettingsSwitchTweakValue):
def __init__(self, name, value, **options):
@@ -39,18 +39,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):
@@ -123,7 +132,7 @@ class WindowScalingFactorTweak(Gtk.Box, Tweak):
self._close()
self._dialog.destroy()
-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]