From 2f4e9c4ed6e4263652f98361687d09e67cff1e52 Mon Sep 17 00:00:00 2001
From: Clement Lefebvre <clement.lefebvre@linuxmint.com>
Date: Sat, 8 Apr 2017 14:29:48 +0100
Subject: [PATCH] Only support user backgrounds in Ubuntu derivatives
Backgrounds aren't part of AccountsService, that support is patched
by Ubuntu and only exists in its derivatives.
---
debian/control | 2 +-
usr/lib/lightdm-settings/lightdm-settings | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/debian/control b/debian/control
index 0f8f175..565b4ee 100644
--- a/debian/control
+++ b/debian/control
@@ -7,7 +7,7 @@ Standards-Version: 3.9.5
Package: lightdm-settings
Architecture: all
-Depends: ${misc:Depends}, python3-setproctitle
+Depends: ${misc:Depends}, python3-setproctitle, lsb-release
Description: LightDM configuration tool
A configuration tool for the LightDM display manager.
diff --git a/usr/lib/lightdm-settings/lightdm-settings b/usr/lib/lightdm-settings/lightdm-settings
index 2c3c03b..e4d18b5 100755
--- a/usr/lib/lightdm-settings/lightdm-settings
+++ b/usr/lib/lightdm-settings/lightdm-settings
@@ -11,6 +11,11 @@ from SettingsWidgets import *
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gio, GLib
+try:
+ import lsb_release
+except:
+ pass
+
setproctitle.setproctitle("lightdm-settings")
gettext.install("lightdm-settings", "/usr/share/locale")
@@ -83,7 +88,15 @@ class Application(Gtk.Application):
section = page.add_section(_("Settings"))
section.add_row(SettingsRow(Gtk.Label(_("Draw a grid")), SettingsSwitch(keyfile, settings, "draw-grid")))
- section.add_row(SettingsRow(Gtk.Label(_("Draw user backgrounds")), SettingsSwitch(keyfile, settings, "draw-user-backgrounds")))
+
+ try:
+ distro = lsb_release.get_lsb_information()['ID']
+ if distro.lower() in ['linuxmint', 'ubuntu', 'elementary']:
+ # AccountsService doesn't support Background selection. It's something that is patched in Ubuntu, so only support this feature
+ # in Ubuntu derivatives
+ section.add_row(SettingsRow(Gtk.Label(_("Draw user backgrounds")), SettingsSwitch(keyfile, settings, "draw-user-backgrounds")))
+ except:
+ pass
section.add_row(SettingsRow(Gtk.Label(_("Show hostname")), SettingsSwitch(keyfile, settings, "show-hostname")))
row = section.add_row(SettingsRow(Gtk.Label(_("Logo")), SettingsFileChooser(keyfile, settings, "logo")))