From 85fb21cc2bb75cd207d770c6ee7567ddb8e09fd4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 15 Sep 2008 09:23:49 +0200 Subject: [PATCH] splash: removed the useless splash screen The code looks strange and spews lots of warnings. Since it does nothing useful, and wastes the user's precious time, simply remove it. --- src/Makefile.am | 2 - src/conf.c | 10 +--- src/main.c | 2 - src/options.c | 3 +- src/options.h | 1 - src/splash.c | 125 ------------------------------------------------ src/splash.h | 1 - 7 files changed, 2 insertions(+), 142 deletions(-) delete mode 100644 src/splash.c delete mode 100644 src/splash.h diff --git a/src/Makefile.am b/src/Makefile.am index 3ceef6a..e3ddc31 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -29,7 +29,6 @@ ncmpc_headers = \ utils.h\ ncmpc.h\ screen_browse.h\ - splash.h\ src_lyrics.h # $Id$ @@ -62,7 +61,6 @@ ncmpc_SOURCES = \ wreadln.c\ strfsong.c\ utils.c\ - splash.c\ src_lyrics.c if LEOSLYRICS_FIXED diff --git a/src/conf.c b/src/conf.c index df0ac54..049671c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -560,15 +560,7 @@ read_rc_file(char *filename, options_t *options) } else if( !strcasecmp(CONF_SHOW_SPLASH, name) ) { - options->show_splash = str2bool(value); - -#ifdef DEBUG - D("screen-list:"); - j=0; - while(options->screen_list[j]) - D(" %s", options->screen_list[j++]); - D("\n"); -#endif + /* the splash screen was removed */ } else if( !strcasecmp(CONF_HOST, name)) { diff --git a/src/main.c b/src/main.c index 5e97840..2f01cab 100644 --- a/src/main.c +++ b/src/main.c @@ -37,7 +37,6 @@ #include "screen.h" #include "screen_utils.h" #include "strfsong.h" -#include "splash.h" #define BUFSIZE 1024 @@ -266,7 +265,6 @@ main(int argc, const char *argv[]) atexit(exit_and_cleanup); ncurses_init(); - if(options->show_splash == TRUE) draw_splash(); src_lyr_init (); diff --git a/src/options.c b/src/options.c index fbf079a..0d3c2a6 100644 --- a/src/options.c +++ b/src/options.c @@ -217,7 +217,7 @@ handle_option(int c, char *arg) options.key_file = g_strdup(arg); break; case 'S': /* --key-file */ - options.show_splash = FALSE; + /* the splash screen was removed */ break; #ifdef DEBUG case 'K': /* --dump-keys */ @@ -374,7 +374,6 @@ options_init( void ) options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0); options.timedisplay_type = DEFAULT_TIMEDISPLAY_TYPE; options.lyrics_timeout = DEFAULT_LYRICS_TIMEOUT; - options.show_splash = FALSE; options.scroll = DEFAULT_SCROLL; options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP); diff --git a/src/options.h b/src/options.h index 5547ff8..661d874 100644 --- a/src/options.h +++ b/src/options.h @@ -33,7 +33,6 @@ typedef struct gboolean visible_bell; gboolean enable_xterm_title; gboolean enable_mouse; - gboolean show_splash; gboolean scroll; } options_t; diff --git a/src/splash.c b/src/splash.c deleted file mode 100644 index fbd5457..0000000 --- a/src/splash.c +++ /dev/null @@ -1,125 +0,0 @@ - - -#include -#include -#include -#include -#include - -#include "ncmpc.h" -#include "colors.h" - - -gpointer get_input(void *null) -{ - int key; - while(key = getch()) - { - if(key == 'q') - { - exit(0); - } - } - return; -} - -void draw_message(char *msg) -{ - int rows, cols; - getmaxyx(stdscr, rows, cols); - mvaddstr(rows-1, (cols/2)-(strlen(msg)/2), msg); - refresh(); -} - - -/*void draw_title() -{ - colors_use(stdscr, COLOR_TITLE_BOLD); - mvaddstr(rows/2+1, COLS/2, VERSION); - colors_use(stdscr, COLOR_TITLE_BOLD); - mvaddstr(rows/2-1, x, PACKAGE); - refresh(); -} -*/ -gboolean advance_version() -{ - int rows, cols; - getmaxyx(stdscr, rows, cols); - static int x = 0; - if(x == 0) - { - x = cols - strlen(VERSION); - } - colors_use(stdscr, COLOR_TITLE_BOLD); - mvaddstr(rows/2+1, x--, VERSION); - mvhline(rows/2+1, x+strlen(VERSION)+1, ' ', cols); - refresh(); - if(x == cols/2) return FALSE; - return TRUE; -} - - -gboolean advance_name() -{ - int rows, cols; - getmaxyx(stdscr, rows, cols); - static int x = 0; - colors_use(stdscr, COLOR_TITLE_BOLD); - mvaddstr(rows/2-1, x, PACKAGE); - mvhline(rows/2-1, 0, ' ', x); - refresh(); - if(x + strlen(PACKAGE) == cols/2) return FALSE; - x++; - return TRUE; -} - -gboolean draw_animation(gpointer *data) -{ //need this to execute both functions, even if one of them return TRUE - if(advance_name() == FALSE && advance_version() == FALSE || advance_name() == TRUE && advance_version() == FALSE) - { - // system("sleep 8"); - g_main_loop_quit((GMainLoop*) data); - // g_source_attach(((int*)data)[1], data); - return FALSE; - } - - return TRUE; -} - -void drawx() -{ - // g_thread_create(get_input, NULL, FALSE, NULL); - int rows, cols; - getmaxyx(stdscr, rows, cols); - - fprintf(stderr, "%d", rows/2); - - mvhline(rows/2, 0, ACS_HLINE , cols); - draw_message("Connecting..."); - //advance_version(); - refresh(); - - GMainContext *cont = g_main_context_new(); - GMainLoop *loop = g_main_loop_new(cont, FALSE); - - GSource *frame = g_timeout_source_new(3); - GSource *state = g_timeout_source_new(100); - GSource *stopper = g_timeout_source_new(200); - - void *blubb = malloc(sizeof(GMainLoop*)+sizeof(GSource*)); - blubb = loop; - ((int*)blubb)[1] = stopper; - - g_source_set_callback(frame, draw_animation ,blubb, NULL); - g_source_attach(frame, g_main_loop_get_context(loop)); - - g_main_loop_run(loop); -} - - -void draw_splash() -{ - drawx(); -} - -//int draw_frame diff --git a/src/splash.h b/src/splash.h deleted file mode 100644 index dbc7a3e..0000000 --- a/src/splash.h +++ /dev/null @@ -1 +0,0 @@ -void draw_splash(); -- 2.30.2