From ee555c9630cbc96107c7ed659be799042b2412a8 Mon Sep 17 00:00:00 2001 From: waker Date: Fri, 23 Nov 2012 23:18:37 +0100 Subject: gtkui: toggle statusbar hotkey --- plugins/gtkui/actionhandlers.c | 20 ++++++++++++++++++++ plugins/gtkui/actionhandlers.h | 6 ++++++ plugins/gtkui/gtkui.c | 14 +++----------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c index a662cba9..2e3709ee 100644 --- a/plugins/gtkui/actionhandlers.c +++ b/plugins/gtkui/actionhandlers.c @@ -788,3 +788,23 @@ action_toggle_menu_handler (DB_plugin_action_t *act, int ctx) { return 0; } +gboolean +action_toggle_statusbar_handler_cb (void *data) { + GtkWidget *sb = lookup_widget (mainwin, "statusbar"); + if (sb) { + int val = 1 - deadbeef->conf_get_int ("gtkui.statusbar.visible", 1); + deadbeef->conf_set_int ("gtkui.statusbar.visible", val); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "view_status_bar")), val); + val ? gtk_widget_show (sb) : gtk_widget_hide (sb); + deadbeef->conf_save (); + } + return FALSE; +} + +int +action_toggle_statusbar_handler (DB_plugin_action_t *act, int ctx) { + g_idle_add (action_toggle_statusbar_handler_cb, NULL); + return 0; +} + + diff --git a/plugins/gtkui/actionhandlers.h b/plugins/gtkui/actionhandlers.h index 5ed9520a..3973a4b1 100644 --- a/plugins/gtkui/actionhandlers.h +++ b/plugins/gtkui/actionhandlers.h @@ -150,4 +150,10 @@ action_toggle_menu_handler_cb (void *data); int action_toggle_menu_handler (DB_plugin_action_t *act, int ctx); +gboolean +action_toggle_statusbar_handler_cb (void *data); + +int +action_toggle_statusbar_handler (DB_plugin_action_t *act, int ctx); + #endif diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c index f3fc357c..cbc86cef 100644 --- a/plugins/gtkui/gtkui.c +++ b/plugins/gtkui/gtkui.c @@ -1413,20 +1413,12 @@ static DB_plugin_action_t action_toggle_menu = { .next = &action_scroll_follows_playback }; -static DB_plugin_action_t action_toggle_column_headers = { - .title = "View/[stub] Show\\/Hide playlist column headers", - .name = "toggle_headers", - .flags = DB_ACTION_COMMON, - .callback = NULL, - .next = &action_toggle_menu -}; - static DB_plugin_action_t action_toggle_statusbar = { - .title = "View/[stub] Show\\/Hide statusbar", + .title = "View/Show\\/Hide statusbar", .name = "toggle_statusbar", .flags = DB_ACTION_COMMON, - .callback = NULL, - .next = &action_toggle_column_headers + .callback = action_toggle_statusbar_handler, + .next = &action_toggle_menu }; static DB_plugin_action_t action_toggle_designmode = { -- cgit v1.2.3