Ejemplo n.º 1
0
void handle_init(void) {
    status_bar_init();
#ifdef PBL_ROUND
    round_bottom_bar_init();
#endif
    settings_init();
    locale_init();
    stations_init();
    favorites_init();
    message_init();
    
    ui_push_window(new_window_main_menu());
}
Ejemplo n.º 2
0
void
screen_init(struct mpdclient *c)
{
	if (COLS < SCREEN_MIN_COLS || LINES < SCREEN_MIN_ROWS) {
		fprintf(stderr, "%s\n", _("Error: Screen too small"));
		exit(EXIT_FAILURE);
	}

	screen.cols = COLS;
	screen.rows = LINES;

	screen.buf  = g_malloc(screen.cols);
	screen.buf_size = screen.cols;
	screen.findbuf = NULL;

#ifndef NCMPC_MINI
	if (options.welcome_screen_list)
		screen.welcome_source_id =
			g_timeout_add(SCREEN_WELCOME_TIME * 1000,
				      welcome_timer_callback, c);
#endif

	/* create top window */
	title_bar_init(&screen.title_bar, screen.cols, 0, 0);

	/* create main window */
	window_init(&screen.main_window, screen.rows - 4, screen.cols, 2, 0);

	if (!options.hardware_cursor)
		leaveok(screen.main_window.w, TRUE);

	keypad(screen.main_window.w, TRUE);

	/* create progress window */
	progress_bar_init(&screen.progress_bar, screen.cols,
			  screen.rows - 2, 0);
	progress_bar_paint(&screen.progress_bar);

	/* create status window */
	status_bar_init(&screen.status_bar, screen.cols, screen.rows - 1, 0);
	status_bar_paint(&screen.status_bar, c->status, c->song);

#ifdef ENABLE_COLORS
	if (options.enable_colors) {
		/* set background attributes */
		wbkgd(stdscr, COLOR_PAIR(COLOR_LIST));
		wbkgd(screen.main_window.w,     COLOR_PAIR(COLOR_LIST));
		wbkgd(screen.title_bar.window.w, COLOR_PAIR(COLOR_TITLE));
		wbkgd(screen.progress_bar.window.w,
		      COLOR_PAIR(COLOR_PROGRESSBAR));
		wbkgd(screen.status_bar.window.w, COLOR_PAIR(COLOR_STATUS));
		colors_use(screen.progress_bar.window.w, COLOR_PROGRESSBAR);
	}
#endif

	doupdate();

	/* initialize screens */
	screen_list_init(screen.main_window.w,
			 screen.main_window.cols, screen.main_window.rows);

	if (mode_fn->open != NULL)
		mode_fn->open(c);
}