[gnome-tweak-tool] appearance: remove Global Dark Theme tweak
- From: Jeremy Bicha <jbicha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweak-tool] appearance: remove Global Dark Theme tweak
- Date: Mon, 13 Nov 2017 21:14:18 +0000 (UTC)
commit 72e5f6da95f5dcb8e583f33a9f0df66a6cb548da
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Mon Nov 13 16:12:03 2017 -0500
appearance: remove Global Dark Theme tweak
And turn it off when the Applications theme is changed.
https://bugzilla.gnome.org/show_bug.cgi?id=783666
gtweak/tweaks/tweak_group_appearance.py | 23 ++++++++++++++-
gtweak/widgets.py | 45 -------------------------------
2 files changed, 21 insertions(+), 47 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_appearance.py b/gtweak/tweaks/tweak_group_appearance.py
index 76f3f48..0a73ecc 100644
--- a/gtweak/tweaks/tweak_group_appearance.py
+++ b/gtweak/tweaks/tweak_group_appearance.py
@@ -17,7 +17,8 @@ from gtweak.utils import walk_directories, make_combo_list_with_default, extract
from gtweak.tweakmodel import Tweak
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.gsettings import GSettingsSetting
-from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GSettingsComboTweak, DarkThemeSwitcher,
Title, build_combo_box_text,build_label_beside_widget, FileChooserButton
+from gtweak.gtksettings import GtkSettingsManager
+from gtweak.widgets import ListBoxTweakGroup, GSettingsSwitchTweak, GSettingsComboTweak, Title,
build_combo_box_text,build_label_beside_widget, FileChooserButton
_shell = GnomeShellFactory().get_shell()
_shell_loaded = _shell is not None
@@ -31,6 +32,9 @@ class GtkThemeSwitcher(GSettingsComboTweak):
make_combo_list_with_default(self._get_valid_themes(), "Adwaita"),
**options)
+ self._gtksettings3 = GtkSettingsManager('3.0')
+ self._gtksettings4 = GtkSettingsManager('4.0')
+
def _get_valid_themes(self):
""" Only shows themes that have variations for gtk3"""
gtk_ver = Gtk.MINOR_VERSION
@@ -46,6 +50,22 @@ class GtkThemeSwitcher(GSettingsComboTweak):
os.path.exists(os.path.join(d, "gtk-3.{}".format(gtk_ver))))
return set(valid)
+ def _on_combo_changed(self, combo):
+ _iter = combo.get_active_iter()
+ if _iter:
+ value = combo.get_model().get_value(_iter, 0)
+ self.settings.set_string(self.key_name, value)
+ # Turn off Global Dark Theme when theme is changed.
+ # https://bugzilla.gnome.org/783666
+ try:
+ self._gtksettings3.set_integer("gtk-application-prefer-dark-theme",
+ 0)
+ self._gtksettings4.set_integer("gtk-application-prefer-dark-theme",
+ 0)
+ except:
+ self.notify_information(_("Error writing setting"))
+
+
class IconThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
GSettingsComboTweak.__init__(self,
@@ -243,7 +263,6 @@ class ShellThemeTweak(Gtk.Box, Tweak):
TWEAK_GROUPS = [
ListBoxTweakGroup(_("Appearance"),
- DarkThemeSwitcher(),
#GSettingsSwitchTweak("Buttons Icons","org.gnome.desktop.interface", "buttons-have-icons"),
#GSettingsSwitchTweak("Menu Icons","org.gnome.desktop.interface", "menus-have-icons"),
GSettingsSwitchTweak(_("Animations"), "org.gnome.desktop.interface", "enable-animations"),
diff --git a/gtweak/widgets.py b/gtweak/widgets.py
index 3373ba7..c282bfe 100644
--- a/gtweak/widgets.py
+++ b/gtweak/widgets.py
@@ -484,51 +484,6 @@ class GetterSetterSwitchTweak(Gtk.Box, Tweak):
def set_active(self, v):
raise NotImplementedError()
-class DarkThemeSwitcher(Gtk.Box, Tweak):
- def __init__(self, **options):
- Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
- Tweak.__init__(self, _("Enable dark theme for all applications"),
- _("Enable the dark theme hint for all the applications in the session"),
- **options)
-
- self._gtksettings3 = GtkSettingsManager('3.0')
- self._gtksettings4 = GtkSettingsManager('4.0')
-
- w = Gtk.Switch()
- w.set_active(self._gtksettings3.get_integer("gtk-application-prefer-dark-theme"))
-
- title = _("Global Dark Theme")
- description = _("Applications need to be restarted for this change to take place.")
- w.connect("notify::active", self._on_switch_changed)
-
- hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
- hbox.props.spacing = UI_BOX_SPACING
- lbl = Gtk.Label(label=title)
- lbl.props.ellipsize = Pango.EllipsizeMode.END
- lbl.props.xalign = 0.0
- hbox.pack_start(lbl, True, True, 0)
- hbox.pack_start(w, False, False, 0)
-
- lbl_des = Gtk.Label()
- lbl_des.props.xalign = 0.0
- lbl_des.get_style_context().add_class("dim-label")
- lbl_des.set_markup("<span size='small'>"+GLib.markup_escape_text(description)+"</span>")
-
- self.pack_start(hbox, False, False, 0)
- self.pack_start(lbl_des, False, False,0)
- self.widget_for_size_group = None
-
- def _on_switch_changed(self, switch, param):
- active = switch.get_active()
-
- try:
- self._gtksettings3.set_integer("gtk-application-prefer-dark-theme",
- active)
- self._gtksettings4.set_integer("gtk-application-prefer-dark-theme",
- active)
- except:
- self.notify_information(_("Error writing setting"))
-
class Title(Gtk.Box, Tweak):
def __init__(self, name, desc, **options):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]