diff options
author | Clement Lefebvre <clement.lefebvre@linuxmint.com> | 2017-06-20 15:36:01 +0200 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-06-20 15:36:01 +0200 |
commit | 89876fc7d6922995d6c253a222a608153772227d (patch) | |
tree | cd5ce48a8677f02824c8b789df5e9b2d3ad8f085 /src/background.vala | |
parent | b37ceae7c7a8dbbaa76c74a7720f9d77b2aebcd9 (diff) | |
download | arctica-greeter-89876fc7d6922995d6c253a222a608153772227d.tar.gz arctica-greeter-89876fc7d6922995d6c253a222a608153772227d.tar.bz2 arctica-greeter-89876fc7d6922995d6c253a222a608153772227d.zip |
src/background.vala: No runtime warning on empty background image filename. Ported from slick-greeter.
Diffstat (limited to 'src/background.vala')
-rw-r--r-- | src/background.vala | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/background.vala b/src/background.vala index 967e9f9..0c722e8 100644 --- a/src/background.vala +++ b/src/background.vala @@ -439,14 +439,16 @@ public class Background : Gtk.Fixed width = height = 0; try { - var image = new Gdk.Pixbuf.from_file (filename); - width = image.width; - height = image.height; - var surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, image.width, image.height); - var c = new Cairo.Context (surface); - Gdk.cairo_set_source_pixbuf (c, image, 0, 0); - c.paint (); - return surface; + if (filename != "") { + var image = new Gdk.Pixbuf.from_file (filename); + width = image.width; + height = image.height; + var surface = new Cairo.Surface.similar (target_surface, Cairo.Content.COLOR_ALPHA, image.width, image.height); + var c = new Cairo.Context (surface); + Gdk.cairo_set_source_pixbuf (c, image, 0, 0); + c.paint (); + return surface; + } } catch (Error e) { |