diff options
Diffstat (limited to 'src/curses-ui/logo.vala')
-rw-r--r-- | src/curses-ui/logo.vala | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/src/curses-ui/logo.vala b/src/curses-ui/logo.vala index dbc716d..1bb609b 100644 --- a/src/curses-ui/logo.vala +++ b/src/curses-ui/logo.vala @@ -1,4 +1,5 @@ /* Copyright 2013, Sebastian Reichel <sre@ring0.de> + * Copyright 2017-2018, Johannes Rudolph <johannes.rudolph@gmx.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -18,17 +19,30 @@ using Curses; public class Logo { Window win; - public Logo() { + public Logo(string configdir) { win = new Window(8, COLS - 2, 0, 1); win.bkgdset(COLOR_PAIR(1) | Attribute.BOLD); win.addstr("\n"); - win.addstr(" _ ___ _____ ____ _ \n"); - win.addstr(" | |/ / ||_ _| / ___|| |__ ___ _ __ \n"); - win.addstr(" | ' /| __|| | \\___ \\| '_ \\ / _ \\| '_ \\ \n"); - win.addstr(" | . \\| |_ | | ___) | | | | (_) | |_) )\n"); - win.addstr(" |_|\\_\\\\__||_| |____/|_| |_|\\___/| .__/ \n"); - win.addstr(" |_| \n"); + + var logofilename = Path.build_filename(configdir, "logo.txt"); + var file = File.new_for_path(logofilename); + if (!file.query_exists()) { + stderr.printf (_("File '%s' doesn't exist.\n"), file.get_path ()); + } + + try { + // Open file for reading and wrap returned FileInputStream into a + // DataInputStream, so we can read line by line + var dis = new DataInputStream(file.read()); + string line; + // Read lines until end of file (null) is reached + while ((line = dis.read_line(null)) != null) { + win.addstr(line+"\n"); + } + } catch(Error e) { + error (_("Error: %s"), e.message); + } win.clrtobot(); |