From 4dbf4ff099a19ce2fe55f50e2dacb299d4a0841f Mon Sep 17 00:00:00 2001 From: Dolan O'Toole Date: Fri, 1 Jun 2012 17:41:13 +0100 Subject: [PATCH 1/4] added ascii logo on startup --- windows.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/windows.c b/windows.c index 8fe91a2f..d18e54ef 100644 --- a/windows.c +++ b/windows.c @@ -395,7 +395,14 @@ static void _create_windows(void) wattrset(_cons_win, A_BOLD); _win_show_time(_cons_win); - wprintw(_cons_win, "Welcome to Profanity.\n"); + wprintw(_cons_win, "Welcome to\n"); + wprintw(_cons_win, " ___ _ \n"); + wprintw(_cons_win, " / __) (_)_ \n"); + wprintw(_cons_win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ \n"); + wprintw(_cons_win, "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |\n"); + wprintw(_cons_win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |\n"); + wprintw(_cons_win, "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |\n"); + wprintw(_cons_win, "|_| (____/ \n"); prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1); dirty = TRUE; From d91175e5c2c33c2b03ff4c991008ea0a87841055 Mon Sep 17 00:00:00 2001 From: Dolan O'Toole Date: Sun, 3 Jun 2012 23:02:13 +0100 Subject: [PATCH 2/4] added showsplash command --- command.c | 18 ++++++++++++++++++ preferences.c | 11 +++++++++++ preferences.h | 2 ++ 3 files changed, 31 insertions(+) diff --git a/command.c b/command.c index 743ec5ae..f9b70e1f 100644 --- a/command.c +++ b/command.c @@ -44,6 +44,7 @@ static gboolean _cmd_msg(const char * const inp); static gboolean _cmd_close(const char * const inp); static gboolean _cmd_set_beep(const char * const inp); static gboolean _cmd_set_flash(const char * const inp); +static gboolean _cmd_set_showsplash(const char * const inp); static gboolean _cmd_away(const char * const inp); static gboolean _cmd_online(const char * const inp); static gboolean _cmd_dnd(const char * const inp); @@ -107,6 +108,8 @@ static gboolean _handle_command(const char * const command, const char * const i result = _cmd_set_beep(inp); } else if (strcmp(command, "/flash") == 0) { result = _cmd_set_flash(inp); + } else if (strcmp(command, "/showsplash") == 0) { + result = _cmd_set_showsplash(inp); } else if (strcmp(command, "/away") == 0) { result = _cmd_away(inp); } else if (strcmp(command, "/online") == 0) { @@ -267,6 +270,21 @@ static gboolean _cmd_set_flash(const char * const inp) return TRUE; } +static gboolean _cmd_set_showsplash(const char * const inp) +{ + if (strcmp(inp, "/showsplash on") == 0) { + cons_show("Splash screen enabled."); + prefs_set_showsplash(TRUE); + } else if (strcmp(inp, "/showsplash off") == 0) { + cons_show("Splash screen disabled."); + prefs_set_showsplash(FALSE); + } else { + cons_show("Usage: /showsplash "); + } + + return TRUE; +} + static gboolean _cmd_away(const char * const inp) { _update_presence(PRESENCE_AWAY, "away", inp); diff --git a/preferences.c b/preferences.c index c5710a1e..46e511eb 100644 --- a/preferences.c +++ b/preferences.c @@ -129,6 +129,17 @@ void prefs_add_login(const char *jid) } } +gboolean prefs_get_showsplash(void) +{ + return g_key_file_get_boolean(prefs, "ui", "showsplash", NULL); +} + +void prefs_set_showsplash(gboolean value) +{ + g_key_file_set_boolean(prefs, "ui", "showsplash", value); + _save_prefs(); +} + static void _save_prefs(void) { gsize g_data_size; diff --git a/preferences.h b/preferences.h index 8f2cfadc..2785a32e 100644 --- a/preferences.h +++ b/preferences.h @@ -35,5 +35,7 @@ void prefs_set_beep(gboolean value); gboolean prefs_get_flash(void); void prefs_set_flash(gboolean value); void prefs_add_login(const char *jid); +gboolean prefs_get_showsplash(void); +void prefs_set_showsplash(gboolean value); #endif From a26403f909138d3b58b223d491b806009c4ffb06 Mon Sep 17 00:00:00 2001 From: Dolan O'Toole Date: Mon, 4 Jun 2012 16:15:12 +0100 Subject: [PATCH 3/4] added switching of splash logo on or off --- windows.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/windows.c b/windows.c index d18e54ef..9c069e92 100644 --- a/windows.c +++ b/windows.c @@ -51,6 +51,7 @@ static int dirty; static int max_cols = 0; static void _create_windows(void); +static void _print_splash_logo(WINDOW *win); static int _find_prof_win_index(const char * const contact); static int _new_prof_win(const char * const contact); static void _current_window_refresh(void); @@ -395,14 +396,11 @@ static void _create_windows(void) wattrset(_cons_win, A_BOLD); _win_show_time(_cons_win); - wprintw(_cons_win, "Welcome to\n"); - wprintw(_cons_win, " ___ _ \n"); - wprintw(_cons_win, " / __) (_)_ \n"); - wprintw(_cons_win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ \n"); - wprintw(_cons_win, "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |\n"); - wprintw(_cons_win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |\n"); - wprintw(_cons_win, "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |\n"); - wprintw(_cons_win, "|_| (____/ \n"); + if (prefs_get_showsplash()) { + _print_splash_logo(_cons_win); + } else { + wprintw(_cons_win, "Welcome to Profanity.\n"); + } prefresh(_cons_win, 0, 0, 1, 0, rows-3, cols-1); dirty = TRUE; @@ -421,6 +419,20 @@ static void _create_windows(void) } } +static void _print_splash_logo(WINDOW *win) +{ + wprintw(win, "Welcome to\n"); + wattron(win, COLOR_PAIR(5)); + wprintw(win, " ___ _ \n"); + wprintw(win, " / __) (_)_ \n"); + wprintw(win, " ____ ____ ___ | |__ ____ ____ _| |_ _ _ \n"); + wprintw(win, "| _ \\ / ___) _ \\| __) _ | _ \\| | _) | | |\n"); + wprintw(win, "| | | | | | |_| | | ( ( | | | | | | |_| |_| |\n"); + wprintw(win, "| ||_/|_| \\___/|_| \\_||_|_| |_|_|\\___)__ |\n"); + wprintw(win, "|_| (____/ \n"); + wattroff(win, COLOR_PAIR(5)); +} + static int _find_prof_win_index(const char * const contact) { // find the chat window for recipient From 26b6db5b78b01e50eaee048472d5d33d5a468c3c Mon Sep 17 00:00:00 2001 From: Dolan O'Toole Date: Mon, 4 Jun 2012 16:22:45 +0100 Subject: [PATCH 4/4] added help text for /showsplash --- windows.c | 1 + 1 file changed, 1 insertion(+) diff --git a/windows.c b/windows.c index 9c069e92..935d66b4 100644 --- a/windows.c +++ b/windows.c @@ -278,6 +278,7 @@ void cons_help(void) cons_show(""); cons_show("/beep : Enable/disable sound notification"); cons_show("/flash : Enable/disable screen flash notification"); + cons_show("/showsplash : Enable/disable splash logo on startup"); cons_show(""); cons_show("Status changes (msg is optional):"); cons_show("");