nixpkgs/pkgs/desktops/gnome-3/misc/gnome-tweak-tool/0002-Don-t-show-multiple-entries-for-a-single-theme.patch
Jan Tojnar 69698ec11c gnome3: only maintain single GNOME 3 package set (#29397)
* gnome3: only maintain single GNOME 3 package set

GNOME 3 was split into 3.10 and 3.12 in #2694. Unfortunately, we barely have the resources
to update a single version of GNOME. Maintaining multiple versions just does not make sense.
Additionally, it makes viewing history using most Git tools bothersome.

This commit renames `pkgs/desktops/gnome-3/3.24` to `pkgs/desktops/gnome-3`, removes
the config variable for choosing packageset (`environment.gnome3.packageSet`), updates
the hint in maintainer script, and removes the `gnome3_24` derivation from `all-packages.nix`.

Closes: #29329

* maintainers/scripts/gnome: Use fixed GNOME 3 directory

Since we now allow only a single GNOME 3 package set, specifying
the working directory is not necessary.

This commit sets the directory to `pkgs/desktops/gnome-3`.
2017-09-24 12:15:50 +01:00

104 lines
4.2 KiB
Diff

From 25c047ac6a2ac892e2be3d7e002fbf7a16725a4c Mon Sep 17 00:00:00 2001
From: Jascha Geerds <jascha@jgeerds.name>
Date: Sun, 25 Jun 2017 11:35:10 +0100
Subject: [PATCH 2/3] Don't show multiple entries for a single theme
---
gtweak/tweaks/tweak_group_interface.py | 8 ++++----
gtweak/tweaks/tweak_group_keymouse.py | 4 ++--
gtweak/utils.py | 16 ++++++++++++++++
3 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/gtweak/tweaks/tweak_group_interface.py b/gtweak/tweaks/tweak_group_interface.py
index db89b85..4697fe3 100644
--- a/gtweak/tweaks/tweak_group_interface.py
+++ b/gtweak/tweaks/tweak_group_interface.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, TWEAK_GROUP_APPEARANCE
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/tweaks/tweak_group_keymouse.py b/gtweak/tweaks/tweak_group_keymouse.py
index b06900c..d34793e 100644
--- a/gtweak/tweaks/tweak_group_keymouse.py
+++ b/gtweak/tweaks/tweak_group_keymouse.py
@@ -21,7 +21,7 @@ from gi.repository import GLib
import gtweak
from gtweak.gshellwrapper import GnomeShellFactory
-from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs
+from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs, get_unique_resources
from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title, GSettingsComboEnumTweak
_shell = GnomeShellFactory().get_shell()
@@ -44,7 +44,7 @@ class KeyThemeSwitcher(GSettingsComboTweak):
valid = walk_directories(get_resource_dirs("themes"), lambda d:
os.path.isfile(os.path.join(d, "gtk-3.0", "gtk-keys.css")) and \
os.path.isfile(os.path.join(d, "gtk-2.0-key", "gtkrc")))
- return valid
+ return get_unique_resources(valid)
TWEAK_GROUPS = [
ListBoxTweakGroup(_("Keyboard and Mouse"),
diff --git a/gtweak/utils.py b/gtweak/utils.py
index b0993b6..0d995bc 100644
--- a/gtweak/utils.py
+++ b/gtweak/utils.py
@@ -133,6 +133,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.12.2