summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-18 17:28:50 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-18 17:28:50 +0100
commit6c177cfa63af0433da3b17a3c85aab9dc52aefda (patch)
tree44a6874d06b15b774c0856dbe0cccf39dcf3298c
parent56985c505d4cbbf62825eafb16416f8d3c9ca6d1 (diff)
downloadpa-sink-ctl-6c177cfa63af0433da3b17a3c85aab9dc52aefda.tar.gz
pa-sink-ctl-6c177cfa63af0433da3b17a3c85aab9dc52aefda.tar.bz2
pa-sink-ctl-6c177cfa63af0433da3b17a3c85aab9dc52aefda.zip
interface: (cosmetic) Move resize and clear functions around
-rw-r--r--src/interface.c92
1 files 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)
{
@@ -216,24 +188,6 @@ interface_get_input(GIOChannel *source, GIOCondition condition, gpointer data)
}
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, ...)
{
va_list ap;
@@ -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);
+}