nixpkgs-suyu/pkgs/desktops/gnome-3/3.22/misc/gnome-tweak-tool/0001-Search-for-themes-and-icons-in-system-data-dirs.patch
Alexander Ried 68eaeab4bc gnome3_22: init at 3.22
copied from 3.20
removed whitespaces at the end of lines
updated to 3.22 versions
removed webkitgtk24 where possible

gnome3_22.evolution: nspr include dir broken / not needed anymore
gnome3_22.gfbgraph: 0.2.2 -> 0.2.3
gnome3_22.gjs: 1.44.0 -> 1.46.0
gnome3_22.gnome-autoar: init at 0.1.1
gnome3_22.gnome-core.folks: 0.11.0 -> 0.11.2
gnome3_22.gnome-user-share 3.18.1 -> 3.18.3
gnome3_22.gnome-weather: 3.20.1 -> 3.20.2
gnome3_22.grilo: 0.3.1 -> 0.3.2
gnome3_22.grilo-plugins: 0.3.2 -> 0.3.3
gnome3_22.libgepub: init at 0.4
gnome3_22.libgweather: 3.20.1 -> 3.20.3
gnome3_22.rest: 0.7.93 -> 0.8.0
gnome3_22.totem: x86 patch is upstream
gnome3_22.tracker: 1.9.0 -> 1.10.0
2016-10-15 20:32:11 +02:00

120 lines
5.4 KiB
Diff

From bdbbe312e6520ce70e91319162e85367a69ce044 Mon Sep 17 00:00:00 2001
From: Jascha Geerds <jascha@jgeerds.name>
Date: Sat, 1 Aug 2015 21:01:11 +0200
Subject: [PATCH 1/3] Search for themes and icons in system data dirs
---
gtweak/tweaks/tweak_group_interface.py | 17 ++++-------------
gtweak/tweaks/tweak_group_keymouse.py | 7 ++-----
gtweak/utils.py | 17 +++++++++++++++++
3 files changed, 23 insertions(+), 18 deletions(-)
Index: gnome-tweak-tool-3.20.1/gtweak/tweaks/tweak_group_interface.py
===================================================================
--- gnome-tweak-tool-3.20.1.orig/gtweak/tweaks/tweak_group_interface.py
+++ gnome-tweak-tool-3.20.1/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
+from gtweak.utils import walk_directories, make_combo_list_with_default, extract_zip_file, get_resource_dirs
from gtweak.tweakmodel import Tweak, TWEAK_GROUP_APPEARANCE
from gtweak.gshellwrapper import GnomeShellFactory
from gtweak.gsettings import GSettingsSetting
@@ -50,10 +50,7 @@ class GtkThemeSwitcher(GSettingsComboTwe
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(GSettingsComboTw
**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(GSettingsCombo
**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
Index: gnome-tweak-tool-3.20.1/gtweak/tweaks/tweak_group_keymouse.py
===================================================================
--- gnome-tweak-tool-3.20.1.orig/gtweak/tweaks/tweak_group_keymouse.py
+++ gnome-tweak-tool-3.20.1/gtweak/tweaks/tweak_group_keymouse.py
@@ -20,7 +20,7 @@ import os.path
from gi.repository import GLib
import gtweak
-from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default
+from gtweak.utils import XSettingsOverrides, walk_directories, make_combo_list_with_default, get_resource_dirs
from gtweak.widgets import ListBoxTweakGroup, GSettingsComboTweak, GSettingsSwitchTweak, GetterSetterSwitchTweak, Title, GSettingsComboEnumTweak
class PrimaryPasteTweak(GetterSetterSwitchTweak):
@@ -48,10 +48,7 @@ class KeyThemeSwitcher(GSettingsComboTwe
**options)
def _get_valid_key_themes(self):
- 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.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
Index: gnome-tweak-tool-3.20.1/gtweak/utils.py
===================================================================
--- gnome-tweak-tool-3.20.1.orig/gtweak/utils.py
+++ gnome-tweak-tool-3.20.1/gtweak/utils.py
@@ -21,6 +21,7 @@ import tempfile
import shutil
import subprocess
import glob
+import itertools
import gtweak
from gtweak.gsettings import GSettingsSetting
@@ -116,6 +117,22 @@ def execute_subprocess(cmd_then_args, bl
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: