Codebase list lightdm-gtk-greeter-settings / b4cda78
Support gtk-3.* themes (LP: #1709864) Sean Davis 6 years ago
2 changed file(s) with 18 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
522522 return ''
523523
524524 # [greeter] theme-name
525 GtkThemesPattern = (sys.prefix, 'share', 'themes', '*', 'gtk-3.0', 'gtk.css')
525 # LP: #1709864, Support gtk-3.* themes
526 GtkThemesPattern = (sys.prefix, 'share', 'themes', '*', 'gtk-3.*', 'gtk.css')
526527
527528 def on_entry_setup_greeter_theme_name(self, entry, pattern=GtkThemesPattern):
528529 values = entry.widgets['values']
530 themes = []
529531 idx = pattern.index('*') - len(pattern)
530532 for path in sorted(iglob(os.path.join(*pattern))):
531 values.append_text(path.split(os.path.sep)[idx])
533 theme = path.split(os.path.sep)[idx]
534 if theme not in themes:
535 themes.append(theme)
536
537 themes = sorted(themes, key=lambda theme: theme.lower())
538
539 for theme in themes:
540 values.append_text(theme)
532541
533542 def on_entry_changed_greeter_theme_name(self, entry, pattern=GtkThemesPattern):
534543 value = entry.value
170170 def check_path_accessibility(path, file=True, executable=False):
171171 """Return None if file is readable by greeter and error message otherwise"""
172172
173 # LP: #1709864, Support gtk-3.* themes
174 if "gtk-3.*" in path:
175 for x in range(0, 40):
176 if os.path.exists(path.replace("gtk-3.*", "gtk-3.%i" % x)):
177 path = path.replace("gtk-3.*", "gtk-3.%i" % x)
178 return check_path_accessibility(path, file, executable)
179
173180 if not os.path.exists(path):
174181 return _('File not found: {path}').format(path=path)
175182