[gnome-tweaks/insensitive-desktop-icons] desktop: Make desktop icons switch insensitive in classic mode
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweaks/insensitive-desktop-icons] desktop: Make desktop icons switch insensitive in classic mode
- Date: Wed, 12 Sep 2018 11:54:52 +0000 (UTC)
commit fd68779956bd7c3e4416c77f3f3b673b9b9a6079
Author: Carlos Soriano <csoriano redhat com>
Date: Wed Sep 5 16:52:34 2018 +0200
desktop: Make desktop icons switch insensitive in classic mode
It's not possible to disable them there, so disable the button
to not be confusing.
Patch by zhengqiang at https://bugzilla.gnome.org/show_bug.cgi?id=785513
Closes: https://gitlab.gnome.org/GNOME/gnome-tweaks/issues/101
gtweak/tweaks/tweak_group_desktop.py | 7 +++++++
gtweak/widgets.py | 6 +++---
2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_desktop.py b/gtweak/tweaks/tweak_group_desktop.py
index f55c696..143f638 100644
--- a/gtweak/tweaks/tweak_group_desktop.py
+++ b/gtweak/tweaks/tweak_group_desktop.py
@@ -3,8 +3,15 @@
# License-Filename: LICENSES/GPL-3.0
from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, Title
+from gtweak.gshellwrapper import GnomeShellFactory
dicons = GSettingsSwitchTweak(_("Show Icons"),"org.gnome.desktop.background","show-desktop-icons")
+_shell = GnomeShellFactory().get_shell()
+if (_shell.mode == 'classic'):
+ dicons.switch.set_active(True)
+ dicons.switch.set_sensitive(False)
+else:
+ dicons.switch.set_sensitive(True)
# show-desktop-icons is in gsettings-desktop-schemas, but it won't actually
# *work* unless we have a version of Nautilus that still has the ability to
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index f1d607c..6c765a7 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -239,8 +239,8 @@ class GSettingsSwitchTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
_GSettingsTweak.__init__(self, name, schema_name, key_name, **options)
- w = Gtk.Switch()
- self.settings.bind(key_name, w, "active", Gio.SettingsBindFlags.DEFAULT)
+ self.switch = Gtk.Switch()
+ self.settings.bind(key_name, self.switch, "active", Gio.SettingsBindFlags.DEFAULT)
self.add_dependency_on_tweak(
options.get("depends_on"),
@@ -267,7 +267,7 @@ class GSettingsSwitchTweak(Gtk.Box, _GSettingsTweak, _DependableMixin):
vbox2_upper = Gtk.Box()
vbox2_lower = Gtk.Box()
vbox2.pack_start(vbox2_upper, True, True, 0)
- vbox2.pack_start(w, False, False, 0)
+ vbox2.pack_start(self.switch, False, False, 0)
vbox2.pack_start(vbox2_lower, True, True, 0)
self.pack_start(vbox1, True, True, 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]