diff options
author | Cobinja <Cobinja@users.noreply.github.com> | 2018-11-26 13:37:46 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2018-11-26 13:37:56 +0100 |
commit | 96fc2cab17e3c69a38d3a2274dc33956c32f80eb (patch) | |
tree | 8442b0e0dc34f9c65cad6e0de90c711230e3b51b /src/background.vala | |
parent | ad14c1325c515843e1b7af14debd18fbd8cb506d (diff) | |
download | arctica-greeter-96fc2cab17e3c69a38d3a2274dc33956c32f80eb.tar.gz arctica-greeter-96fc2cab17e3c69a38d3a2274dc33956c32f80eb.tar.bz2 arctica-greeter-96fc2cab17e3c69a38d3a2274dc33956c32f80eb.zip |
Fix background if image file is not readable.
This fixes a bug, where we fell back to the defined background color, if
reading an image file failed.
If that file was a user background, we didn't fall back to the defined
system background before using the color, now we do.
Only if that one is not readable either, we fall back to the color.
Ported from Slick Greeter:
https://github.com/linuxmint/slick-greeter/commit/32f2bb5feebca3377c9fc202e0a6aac6ddb75212.patch
Diffstat (limited to 'src/background.vala')
-rw-r--r-- | src/background.vala | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/background.vala b/src/background.vala index 6c94831..9a77047 100644 --- a/src/background.vala +++ b/src/background.vala @@ -681,7 +681,25 @@ public class Background : Gtk.Fixed private BackgroundLoader load_background (string? filename) { if (filename == null) + { filename = fallback_bgcolor; + } else + { + try + { + var file = File.new_for_path(filename); + var fileInfo = file.query_info(FileAttribute.ACCESS_CAN_READ, FileQueryInfoFlags.NONE, null); + if (!fileInfo.get_attribute_boolean(FileAttribute.ACCESS_CAN_READ)) + { + debug ("Can't read background file %s, falling back to %s", filename, system_background); + filename = system_background; + } + } + catch + { + filename = system_background; + } + } var b = loaders.lookup (filename); if (b == null) |