Author: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
all: initialize main flow
src/seamus.c | 43 ++++++++++++++++++-------------------------
diff --git a/src/seamus.c b/src/seamus.c index 0fa901cbf45523c252677cb87b4f4495faa5fdd9..8aa1ffa3bd4d6ba5476db50e600866442ddbea1d 100755 --- a/src/seamus.c +++ b/src/seamus.c @@ -25,6 +25,7 @@ return 1; } s->conn = connection; + return 0; } @@ -131,38 +132,30 @@ main(int argc, char *argv[]) { struct seamus_frontend seamus = {0}; - seamus_init(&seamus); + int r = seamus_init(&seamus); - fetch_mpd_from_current_queue(&seamus, 10); + if (r != 0) { + log_fatal("Couldn't initialize seamus"); + return 1; + } - print_songs_from_queue(&seamus); + r = tickit_init(&seamus); - //return 0; - - /* - t = tickit_new_stdtty(); - - TickitWindow *root = tickit_get_rootwin(t); - - if (!root) { - fprintf(stderr, "Cannot create TickitTerm - %d\n", strerror(errno)); - return 1; + if (r != 0) { + log_fatal("Something went wrong when initializing tickit"); + goto exit_tickit; } - main_window = tickit_window_new(root, (TickitRect){ - .top = 2, .left = 2, .lines = tickit_window_lines(root) - 5, - .cols = tickit_window_cols(root) - 7 - }, 0); + fetch_mpd_from_current_queue(&seamus, 10); + + print_songs_from_queue(&seamus); - tickit_window_bind_event(main_window, TICKIT_WINDOW_ON_EXPOSE, 0, &render, NULL); - tickit_window_bind_event(root, TICKIT_WINDOW_ON_EXPOSE, 0, &render_root, NULL); +exit_tickit: + tickit_finish(&seamus); - // Initial update - tickit_watch_timer_after_msec(t, 1000, 0, &update, NULL); +exit_mpd: + seamus_finish(&seamus); - tickit_run(t); - tickit_window_close(root); - tickit_unref(t); +exit: return 0; - */ }