mirror of
https://github.com/altlinux/gpupdate.git
synced 2025-10-16 19:33:48 +03:00
Compare commits
2 Commits
bugsFix
...
gsettings_
Author | SHA1 | Date | |
---|---|---|---|
|
285e646986 | ||
|
94d039653a |
@@ -61,9 +61,6 @@ class system_gsettings:
|
||||
def append(self, schema, path, data, lock, helper):
|
||||
self.gsettings.append(system_gsetting(schema, path, data, lock, helper))
|
||||
|
||||
def pop(self):
|
||||
self.gsettings.pop()
|
||||
|
||||
def apply(self):
|
||||
config = configparser.ConfigParser()
|
||||
|
||||
|
@@ -20,6 +20,7 @@ import logging
|
||||
import os
|
||||
import pwd
|
||||
import subprocess
|
||||
import urllib.parse
|
||||
|
||||
from gi.repository import (
|
||||
Gio
|
||||
@@ -62,6 +63,7 @@ class gsettings_applier(applier_frontend):
|
||||
__registry_branch = 'Software\\BaseALT\\Policies\\GSettings\\'
|
||||
__registry_locks_branch = 'Software\\BaseALT\\Policies\\GSettingsLocks\\'
|
||||
__wallpaper_entry = 'Software\\BaseALT\\Policies\\GSettings\\org.mate.background.picture-filename'
|
||||
__vino_authentication_methods_entry = 'Software\\BaseALT\\Policies\\GSettings\\org.gnome.Vino.authentication-methods'
|
||||
__global_schema = '/usr/share/glib-2.0/schemas'
|
||||
__override_priority_file = 'zzz_policy.gschema.override'
|
||||
__override_old_file = '0_policy.gschema.override'
|
||||
@@ -78,7 +80,6 @@ class gsettings_applier(applier_frontend):
|
||||
self.override_old_file = os.path.join(self.__global_schema, self.__override_old_file)
|
||||
self.gsettings = system_gsettings(self.override_file)
|
||||
self.locks = dict()
|
||||
self.dictArr = dict()
|
||||
self.__module_enabled = check_enabled(
|
||||
self.storage
|
||||
, self.__module_name
|
||||
@@ -114,33 +115,21 @@ class gsettings_applier(applier_frontend):
|
||||
# Calculate all configured gsettings
|
||||
for setting in self.gsettings_keys:
|
||||
helper = None
|
||||
valuename = setting.valuename
|
||||
valuename = setting.hive_key.rpartition('\\')[2]
|
||||
rp = valuename.rpartition('.')
|
||||
schema = rp[0]
|
||||
path = rp[2]
|
||||
data = setting.data
|
||||
|
||||
if setting.hive_key.lower() == self.__wallpaper_entry.lower():
|
||||
self.update_file_cache(setting.data)
|
||||
helper = self.uri_fetch_helper
|
||||
# Registry branch ends with back slash.
|
||||
# If keyname starts with same prefix, it would be array
|
||||
elif setting.keyname.lower().startswith(self.__registry_branch.lower()):
|
||||
valuenameArr = setting.keyname.rpartition('\\')[2]
|
||||
if valuenameArr:
|
||||
valuename = valuenameArr
|
||||
rpArr = valuename.rpartition('.')
|
||||
schema = rpArr[0]
|
||||
path = rpArr[2]
|
||||
if self.dictArr and path in self.dictArr.keys():
|
||||
self.dictArr[path].append(setting.data)
|
||||
self.gsettings.pop()
|
||||
else:
|
||||
self.dictArr[path] = [setting.data,]
|
||||
data = self.dictArr[path]
|
||||
|
||||
lock = bool(self.locks[valuename]) if valuename in self.locks else None
|
||||
if setting.hive_key.lower() == self.__wallpaper_entry.lower():
|
||||
check = urllib.parse.urlparse(setting.data)
|
||||
if check.scheme:
|
||||
self.update_file_cache(setting.data)
|
||||
helper = self.uri_fetch_helper
|
||||
elif setting.hive_key.lower() == self.__vino_authentication_methods_entry.lower():
|
||||
data = [setting.data]
|
||||
self.gsettings.append(schema, path, data, lock, helper)
|
||||
|
||||
# Create GSettings policy with highest available priority
|
||||
self.gsettings.apply()
|
||||
|
||||
@@ -200,6 +189,7 @@ class gsettings_applier_user(applier_frontend):
|
||||
__module_enabled = True
|
||||
__registry_branch = 'Software\\BaseALT\\Policies\\GSettings\\'
|
||||
__wallpaper_entry = 'Software\\BaseALT\\Policies\\GSettings\\org.mate.background.picture-filename'
|
||||
__vino_authentication_methods_entry = 'Software\\BaseALT\\Policies\\GSettings\\org.gnome.Vino.authentication-methods'
|
||||
|
||||
def __init__(self, storage, file_cache, sid, username):
|
||||
self.storage = storage
|
||||
@@ -211,7 +201,7 @@ class gsettings_applier_user(applier_frontend):
|
||||
self.gsettings = list()
|
||||
self.__module_enabled = check_enabled(self.storage, self.__module_name, self.__module_enabled)
|
||||
self.__windows_mapping_enabled = check_windows_mapping_enabled(self.storage)
|
||||
self.dictArr = dict()
|
||||
|
||||
self.__windows_settings = dict()
|
||||
self.windows_settings = list()
|
||||
mapping = [
|
||||
@@ -282,20 +272,11 @@ class gsettings_applier_user(applier_frontend):
|
||||
rp = valuename.rpartition('.')
|
||||
schema = rp[0]
|
||||
path = rp[2]
|
||||
data = setting.data
|
||||
helper = self.uri_fetch_helper if setting.hive_key.lower() == self.__wallpaper_entry.lower() else None
|
||||
if valuename == setting.data:
|
||||
valuenameArr = setting.keyname.rpartition('\\')[2]
|
||||
rpArr = valuenameArr.rpartition('.')
|
||||
schema = rpArr[0]
|
||||
path = rpArr[2]
|
||||
if self.dictArr and path in self.dictArr.keys():
|
||||
self.dictArr[path].append(setting.data)
|
||||
self.gsettings.pop()
|
||||
else:
|
||||
self.dictArr[path] = [setting.data,]
|
||||
self.gsettings.append(user_gsetting(schema, path, self.dictArr[path], helper))
|
||||
continue
|
||||
self.gsettings.append(user_gsetting(schema, path, setting.data, helper))
|
||||
if setting.hive_key.lower() == self.__vino_authentication_methods_entry.lower():
|
||||
data = [setting.data]
|
||||
self.gsettings.append(user_gsetting(schema, path, data, helper))
|
||||
|
||||
# Create GSettings policy with highest available priority
|
||||
for gsetting in self.gsettings:
|
||||
|
Reference in New Issue
Block a user