gnome3.gnome-tweak-tool: 3.26.3 → 3.26.4

Also cleaned up and sent patches upstream.
This commit is contained in:
Jan Tojnar 2017-12-17 06:26:09 +01:00
parent 04dd10f8a5
commit 98adff8b1a
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
6 changed files with 28 additions and 244 deletions

View File

@ -1,97 +0,0 @@
From f7f7fe6bf36ca08c66192077bf964036eb02ffb5 Mon Sep 17 00:00:00 2001
From: Jascha Geerds <jascha@jgeerds.name>
Date: Tue, 19 Sep 2017 03:08:07 +0200
Subject: [PATCH 1/3] Search for themes and icons in system data dirs
---
gtweak/tweaks/tweak_group_appearance.py | 17 ++++-------------
gtweak/utils.py | 17 +++++++++++++++++
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/gtweak/tweaks/tweak_group_appearance.py b/gtweak/tweaks/tweak_group_appearance.py
index ccadefc..0d12194 100644
--- a/gtweak/tweaks/tweak_group_appearance.py
+++ b/gtweak/tweaks/tweak_group_appearance.py
@@ -26,7 +26,7 @@ from gi.repository import Gtk
from gi.repository import GLib
import gtweak
-from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file
+from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs
from gtweak.tweakmodel import Tweak
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.gsettings import GSettingsSetting
@@ -50,10 +50,7 @@ class GtkThemeSwitcher(GSettingsComboTweak):
if gtk_ver % 2: # Want even number
gtk_ver += 1
- dirs = ( os.path.join(gtweak.DATA_DIR, "themes"),
- os.path.join(GLib.get_user_data_dir(), "themes"),
- os.path.join(os.path.expanduser("~"), ".themes"))
- valid = walk_directories(dirs, lambda d:
+ valid = walk_directories(get_resource_dirs("themes"), lambda d:
os.path.exists(os.path.join(d, "gtk-2.0")) and \
(os.path.exists(os.path.join(d, "gtk-3.0")) or \
os.path.exists(os.path.join(d, "gtk-3.{}".format(gtk_ver)))))
@@ -69,10 +66,7 @@ class IconThemeSwitcher(GSettingsComboTweak):
**options)
def _get_valid_icon_themes(self):
- dirs = ( os.path.join(gtweak.DATA_DIR, "icons"),
- os.path.join(GLib.get_user_data_dir(), "icons"),
- os.path.join(os.path.expanduser("~"), ".icons"))
- valid = walk_directories(dirs, lambda d:
+ valid = walk_directories(get_resource_dirs("icons"), lambda d:
os.path.isdir(d) and \
os.path.exists(os.path.join(d, "index.theme")))
return valid
@@ -87,10 +81,7 @@ class CursorThemeSwitcher(GSettingsComboTweak):
**options)
def _get_valid_cursor_themes(self):
- dirs = ( os.path.join(gtweak.DATA_DIR, "icons"),
- os.path.join(GLib.get_user_data_dir(), "icons"),
- os.path.join(os.path.expanduser("~"), ".icons"))
- valid = walk_directories(dirs, lambda d:
+ valid = walk_directories(get_resource_dirs("icons"), lambda d:
os.path.isdir(d) and \
os.path.exists(os.path.join(d, "cursors")))
return valid
diff --git a/gtweak/utils.py b/gtweak/utils.py
index de6c345..6c60b88 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -21,6 +21,7 @@ import tempfile
import shutil
import subprocess
import glob
+import itertools
import gtweak
from gtweak.gsettings import GSettingsSetting
@@ -117,6 +118,22 @@ def execute_subprocess(cmd_then_args, block=True):
stdout, stderr = p.communicate()
return stdout, stderr, p.returncode
+def get_resource_dirs(resource):
+ """Returns a list of all known resource dirs for a given resource.
+
+ :param str resource:
+ Name of the resource (e.g. "themes")
+ :return:
+ A list of resource dirs
+ """
+ dirs = [os.path.join(dir, resource)
+ for dir in itertools.chain(GLib.get_system_data_dirs(),
+ (gtweak.DATA_DIR,
+ GLib.get_user_data_dir()))]
+ dirs += [os.path.join(os.path.expanduser("~"), ".{}".format(resource))]
+
+ return [dir for dir in dirs if os.path.isdir(dir)]
+
@singleton
class AutostartManager:
--
2.14.1

View File

@ -1,80 +0,0 @@
From 8e75fe5f1ebd8a140a7306294d2219aea4ac47d2 Mon Sep 17 00:00:00 2001
From: Jascha Geerds <jascha@jgeerds.name>
Date: Tue, 19 Sep 2017 03:16:07 +0200
Subject: [PATCH 2/3] Don't show multiple entries for a single theme
---
gtweak/tweaks/tweak_group_appearance.py | 8 ++++----
gtweak/utils.py | 16 ++++++++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/gtweak/tweaks/tweak_group_appearance.py b/gtweak/tweaks/tweak_group_appearance.py
index 0d12194..8e05077 100644
--- a/gtweak/tweaks/tweak_group_appearance.py
+++ b/gtweak/tweaks/tweak_group_appearance.py
@@ -26,7 +26,7 @@ from gi.repository import Gtk
from gi.repository import GLib
import gtweak
-from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs
+from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs, get_unique_resources
from gtweak.tweakmodel import Tweak
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.gsettings import GSettingsSetting
@@ -54,7 +54,7 @@ class GtkThemeSwitcher(GSettingsComboTweak):
os.path.exists(os.path.join(d, "gtk-2.0")) and \
(os.path.exists(os.path.join(d, "gtk-3.0")) or \
os.path.exists(os.path.join(d, "gtk-3.{}".format(gtk_ver)))))
- return valid
+ return get_unique_resources(valid)
class IconThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
@@ -69,7 +69,7 @@ class IconThemeSwitcher(GSettingsComboTweak):
valid = walk_directories(get_resource_dirs("icons"), lambda d:
os.path.isdir(d) and \
os.path.exists(os.path.join(d, "index.theme")))
- return valid
+ return get_unique_resources(valid)
class CursorThemeSwitcher(GSettingsComboTweak):
def __init__(self, **options):
@@ -84,7 +84,7 @@ class CursorThemeSwitcher(GSettingsComboTweak):
valid = walk_directories(get_resource_dirs("icons"), lambda d:
os.path.isdir(d) and \
os.path.exists(os.path.join(d, "cursors")))
- return valid
+ return get_unique_resources(valid)
class ShellThemeTweak(Gtk.Box, Tweak):
diff --git a/gtweak/utils.py b/gtweak/utils.py
index 6c60b88..6fd7c6a 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -134,6 +134,22 @@ def get_resource_dirs(resource):
return [dir for dir in dirs if os.path.isdir(dir)]
+def get_unique_resources(dirs):
+ """Filter out duplicated resources.
+
+ :param list dirs:
+ List of resource dirs (e.g. /usr/share/themes/Adwaita)
+ :return:
+ List of dirs without duplicated resources
+ """
+ unique_dirs = {}
+ for dir in dirs:
+ basename = os.path.basename(dir)
+ if basename not in unique_dirs:
+ unique_dirs[basename] = dir
+
+ return unique_dirs
+
@singleton
class AutostartManager:
--
2.14.1

View File

@ -1,27 +0,0 @@
From 6a6a7d1c708a2f568277699c5b605fa03ccb5faa Mon Sep 17 00:00:00 2001
From: Jascha Geerds <jascha@jgeerds.name>
Date: Tue, 19 Sep 2017 03:17:20 +0200
Subject: [PATCH 3/3] Create config dir if it doesn't exist
---
gtweak/gtksettings.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gtweak/gtksettings.py b/gtweak/gtksettings.py
index a11363b..2871c49 100644
--- a/gtweak/gtksettings.py
+++ b/gtweak/gtksettings.py
@@ -36,6 +36,10 @@ class GtkSettingsManager:
def _get_keyfile(self):
keyfile = None
try:
+ config_dir = os.path.dirname(self._path)
+ if not os.path.isdir(config_dir):
+ os.makedirs(config_dir)
+
keyfile = GLib.KeyFile()
keyfile.load_from_file(self._path, 0)
except MemoryError:
--
2.14.1

View File

@ -6,19 +6,18 @@
stdenv.mkDerivation rec {
inherit (import ./src.nix fetchurl) name src;
doCheck = true;
checkPhase = "meson test";
propagatedUserEnvPkgs = [ gnome3.gnome_themes_standard ];
nativeBuildInputs = [ meson ninja pkgconfig gettext itstool libxml2 file wrapGAppsHook ];
buildInputs = [ gtk3 glib gnome3.gsettings_desktop_schemas
gdk_pixbuf gnome3.defaultIconTheme librsvg
libnotify gnome3.gnome_shell python3Packages.pygobject3
libsoup gnome3.gnome_settings_daemon gnome3.nautilus
gnome3.gnome_desktop gobjectIntrospection
];
nativeBuildInputs = [
meson ninja pkgconfig gettext itstool libxml2 file wrapGAppsHook
];
buildInputs = [
gtk3 glib gnome3.gsettings_desktop_schemas
gdk_pixbuf gnome3.defaultIconTheme librsvg
libnotify gnome3.gnome_shell python3Packages.pygobject3
libsoup gnome3.gnome_settings_daemon gnome3.nautilus
gnome3.mutter gnome3.gnome_desktop gobjectIntrospection
];
postPatch = ''
patchShebangs meson-postinstall.py
@ -30,10 +29,21 @@ stdenv.mkDerivation rec {
'';
patches = [
./find_gsettings.patch
./0001-Search-for-themes-and-icons-in-system-data-dirs.patch
./0002-Don-t-show-multiple-entries-for-a-single-theme.patch
./0003-Create-config-dir-if-it-doesn-t-exist.patch
(fetchurl {
name = "find_gsettings.patch";
url = https://bugzilla.gnome.org/attachment.cgi?id=365642;
sha256 = "14ik1kad0w99xa2wn3d4ynrkhnwchjlqfbaij7p11y5zpiwhaha4";
})
(fetchurl {
name = "0001-Search-for-themes-and-icons-in-system-data-dirs.patch";
url = https://bugzilla.gnome.org/attachment.cgi?id=365643;
sha256 = "1phq3c7hc9lryih6rp3m5wmp88rfbl6iv42ng4g6bzm1jphgl89f";
})
(fetchurl {
name = "0001-appearance-Don-t-duplicate-the-cursor-theme-name.patch";
url = https://bugzilla.gnome.org/attachment.cgi?id=365648;
sha256 = "1n9vwsfz4sx72qsi1gd1y7460zmagwirvmi9qrfhc3ahanpyn4fr";
})
];
meta = with stdenv.lib; {

View File

@ -1,22 +0,0 @@
diff --git a/gtweak/gsettings.py b/gtweak/gsettings.py
index a00fe19..dce74b2 100644
--- a/gtweak/gsettings.py
+++ b/gtweak/gsettings.py
@@ -33,10 +33,15 @@ class GSettingsMissingError(Exception):
class _GSettingsSchema:
def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options):
- if not schema_dir:
- schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
if not schema_filename:
schema_filename = schema_name + ".gschema.xml"
+ if not schema_dir:
+ schema_dir = gtweak.GSETTINGS_SCHEMA_DIR
+ for xdg_dir in GLib.get_system_data_dirs():
+ dir = os.path.join(xdg_dir, "glib-2.0", "schemas")
+ if os.path.exists(os.path.join(dir, schema_filename)):
+ schema_dir = dir
+ break
schema_path = os.path.join(schema_dir, schema_filename)
if not os.path.exists(schema_path):

View File

@ -1,10 +1,10 @@
# Autogenerated by maintainers/scripts/gnome.sh update
fetchurl: {
name = "gnome-tweak-tool-3.26.3";
name = "gnome-tweak-tool-3.26.4";
src = fetchurl {
url = mirror://gnome/sources/gnome-tweak-tool/3.26/gnome-tweak-tool-3.26.3.tar.xz;
sha256 = "9406447850b14de204f9c5a6eaa6b63ba805ddb1a10fd863239841090af76430";
url = mirror://gnome/sources/gnome-tweak-tool/3.26/gnome-tweak-tool-3.26.4.tar.xz;
sha256 = "fda08044d22c258bbd93dbad326d282d4d1184b98795ae8e3e5f07f8275005df";
};
}