From 6c177cfa63af0433da3b17a3c85aab9dc52aefda Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Sun, 18 Dec 2011 17:28:50 +0100 Subject: interface: (cosmetic) Move resize and clear functions around --- src/interface.c | 92 ++++++++++++++++++++++++++++----------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/src/interface.c b/src/interface.c index c16f83f..7a3952d 100644 --- a/src/interface.c +++ b/src/interface.c @@ -82,34 +82,6 @@ interface_get_current_ctl(struct context *ctx, struct vol_ctl **parent) return NULL; } -static gboolean -interface_resize(gpointer data) -{ - struct context *ctx = data; - struct winsize wsize; - gint height = 80; - gint width = 24; - - if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsize) >= 0) { - height = wsize.ws_row; - width = wsize.ws_col; - } - - resize_term(height, width); - clear(); - refresh(); - - wresize(ctx->menu_win, height - H_MSG_BOX, width); - wresize(ctx->msg_win, H_MSG_BOX, width); - mvwin(ctx->msg_win, height - H_MSG_BOX, 0); - - /* NULL := display old status */ - interface_set_status(ctx, NULL); - interface_redraw(ctx); - - return TRUE; -} - static void allocate_volume_bar(struct context *ctx) { @@ -215,24 +187,6 @@ interface_get_input(GIOChannel *source, GIOCondition condition, gpointer data) return TRUE; } -void -interface_clear(struct context *ctx) -{ - g_source_remove(ctx->resize_source_id); - g_source_remove(ctx->input_source_id); -#ifdef HAVE_SIGNALFD - close(ctx->signal_fd); -#endif - clear(); - refresh(); - delwin(ctx->menu_win); - delwin(ctx->msg_win); - endwin(); - delscreen(NULL); - if (ctx->status) - g_free(ctx->status); -} - void interface_set_status(struct context *ctx, const gchar *msg, ...) { @@ -252,6 +206,34 @@ interface_set_status(struct context *ctx, const gchar *msg, ...) refresh(); } +static gboolean +interface_resize(gpointer data) +{ + struct context *ctx = data; + struct winsize wsize; + gint height = 80; + gint width = 24; + + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &wsize) >= 0) { + height = wsize.ws_row; + width = wsize.ws_col; + } + + resize_term(height, width); + clear(); + refresh(); + + wresize(ctx->menu_win, height - H_MSG_BOX, width); + wresize(ctx->msg_win, H_MSG_BOX, width); + mvwin(ctx->msg_win, height - H_MSG_BOX, 0); + + /* NULL := display old status */ + interface_set_status(ctx, NULL); + interface_redraw(ctx); + + return TRUE; +} + #ifdef HAVE_SIGNALFD static gboolean resize_gio(GIOChannel *source, GIOCondition condition, gpointer data) @@ -331,3 +313,21 @@ interface_init(struct context *ctx) return 0; } + +void +interface_clear(struct context *ctx) +{ + g_source_remove(ctx->resize_source_id); + g_source_remove(ctx->input_source_id); +#ifdef HAVE_SIGNALFD + close(ctx->signal_fd); +#endif + clear(); + refresh(); + delwin(ctx->menu_win); + delwin(ctx->msg_win); + endwin(); + delscreen(NULL); + if (ctx->status) + g_free(ctx->status); +} -- cgit