[gnome-tweaks/wip/ewlsh/flatpak: 4/4] Handle missing xsettings in flatpak.
- From: Evan Welsh <ewlsh src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-tweaks/wip/ewlsh/flatpak: 4/4] Handle missing xsettings in flatpak.
- Date: Sat, 24 Oct 2020 04:18:29 +0000 (UTC)
commit c9b93f6e1fcce3cae21d8120398041d092fd3ff6
Author: Evan Welsh <contact evanwelsh com>
Date: Fri Oct 23 23:16:53 2020 -0500
Handle missing xsettings in flatpak.
org.gnome.settings-daemon.plugins.xsettings is not
available in Flatpak, this should change in GNOME 40
when the schema moves.
gtweak/tweaks/tweak_group_font.py | 15 ++++++++++++---
gtweak/utils.py | 13 +++++++++++--
2 files changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/gtweak/tweaks/tweak_group_font.py b/gtweak/tweaks/tweak_group_font.py
index 3d7d61e2..4869abab 100644
--- a/gtweak/tweaks/tweak_group_font.py
+++ b/gtweak/tweaks/tweak_group_font.py
@@ -2,19 +2,28 @@
# SPDX-License-Identifier: GPL-3.0+
# License-Filename: LICENSES/GPL-3.0
+import logging
+
from gi.repository import Gio, Gtk
from gtweak.tweakmodel import Tweak
from gtweak.widgets import ListBoxTweakGroup, GSettingsSpinButtonTweak, GSettingsFontButtonTweak
-
+from gtweak.gsettings import GSettingsSetting
class FontXSettingsTweak(Gtk.Box, Tweak):
def __init__(self, **options):
Gtk.Box.__init__(self)
Tweak.__init__(self, _("Hinting"), _("Antialiasing"))
-
- self.settings = Gio.Settings("org.gnome.settings-daemon.plugins.xsettings")
+
+ try:
+ self.settings = GSettingsSetting("org.gnome.settings-daemon.plugins.xsettings")
+ except:
+ self.settings = None
+ logging.warn("org.gnome.settings-daemon.plugins.xsettings not installed or running")
+
+ if not self.settings:
+ return
self.set_spacing(12)
self.props.margin_top = 12
diff --git a/gtweak/utils.py b/gtweak/utils.py
index af5fcf3a..6f1fd63a 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -9,6 +9,7 @@ import shutil
import subprocess
import glob
import itertools
+import logging
import gi
gi.require_version("Notify", "0.7")
@@ -19,6 +20,7 @@ from gi.repository import Notify
import gtweak
+from gtweak.gsettings import GSettingsSetting
def singleton(cls):
"""
@@ -261,8 +263,15 @@ class XSettingsOverrides:
}
def __init__(self):
- self._settings = Gio.Settings(schema='org.gnome.settings-daemon.plugins.xsettings')
- self._variant = self._settings.get_value("overrides")
+ # Ensure we don't error out
+ try:
+ self._settings = GSettingsSetting(schema='org.gnome.settings-daemon.plugins.xsettings')
+ except:
+ self._settings = None
+ logging.warn("org.gnome.settings-daemon.plugins.xsettings not installed or running")
+
+ if self._settings:
+ self._variant = self._settings.get_value("overrides")
def _dup_variant_as_dict(self):
items = {}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]