summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-11-23 23:44:26 +0100
committerGravatar waker <wakeroid@gmail.com>2012-11-23 23:44:26 +0100
commit70ab97a092fb3f8f98f63230c21a7475d93364fa (patch)
treef91756b7b1ee959530b23be197d084cbc028a709
parent6e791c9fb449c0da4f8606db1cc5a477ad5742ec (diff)
gtkui: added toggle/show/hide eq hotkeys
-rw-r--r--plugins/gtkui/actionhandlers.c48
-rw-r--r--plugins/gtkui/actionhandlers.h9
-rw-r--r--plugins/gtkui/gtkui.c18
3 files changed, 66 insertions, 9 deletions
diff --git a/plugins/gtkui/actionhandlers.c b/plugins/gtkui/actionhandlers.c
index e3be709a..d3d80082 100644
--- a/plugins/gtkui/actionhandlers.c
+++ b/plugins/gtkui/actionhandlers.c
@@ -884,3 +884,51 @@ action_crop_selected_handler (DB_plugin_action_t *act, int ctx) {
deadbeef->sendmessage (DB_EV_PLAYLISTCHANGED, 0, 0, 0);
return 0;
}
+
+gboolean
+action_toggle_eq_handler_cb (void *data) {
+ GtkWidget *menuitem = lookup_widget (mainwin, "view_eq");
+ gboolean act = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem));
+ act = !act;
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), act);
+ return FALSE;
+}
+
+int
+action_toggle_eq_handler (DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_toggle_eq_handler_cb, NULL);
+ return 0;
+}
+
+gboolean
+action_show_eq_handler_cb (void *data) {
+ GtkWidget *menuitem = lookup_widget (mainwin, "view_eq");
+ gboolean act = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem));
+ if (!act) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), 1);
+ }
+ return FALSE;
+}
+
+int
+action_show_eq_handler(DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_show_eq_handler_cb, NULL);
+ return 0;
+}
+
+gboolean
+action_hide_eq_handler_cb (void *data) {
+ GtkWidget *menuitem = lookup_widget (mainwin, "view_eq");
+ gboolean act = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (menuitem));
+ if (act) {
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (menuitem), 0);
+ }
+ return FALSE;
+}
+
+int
+action_hide_eq_handler(DB_plugin_action_t *act, int ctx) {
+ g_idle_add (action_hide_eq_handler_cb, NULL);
+ return 0;
+}
+
diff --git a/plugins/gtkui/actionhandlers.h b/plugins/gtkui/actionhandlers.h
index e649c1cd..08e19df5 100644
--- a/plugins/gtkui/actionhandlers.h
+++ b/plugins/gtkui/actionhandlers.h
@@ -177,4 +177,13 @@ action_sort_custom_handler (DB_plugin_action_t *act, int ctx);
int
action_crop_selected_handler (DB_plugin_action_t *act, int ctx);
+int
+action_toggle_eq_handler (DB_plugin_action_t *act, int ctx);
+
+int
+action_show_eq_handler(DB_plugin_action_t *act, int ctx);
+
+int
+action_hide_eq_handler(DB_plugin_action_t *act, int ctx);
+
#endif
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index dd595d3b..10f7e57f 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -1495,31 +1495,31 @@ static DB_plugin_action_t action_new_playlist = {
};
static DB_plugin_action_t action_toggle_eq = {
- .title = "[stub] Show\\/Hide Equalizer",
+ .title = "View/Show\\/Hide Equalizer",
.name = "toggle_eq",
.flags = DB_ACTION_COMMON,
- .callback = NULL,
+ .callback = action_toggle_eq_handler,
.next = &action_new_playlist
};
static DB_plugin_action_t action_hide_eq = {
- .title = "[stub] Hide Equalizer",
+ .title = "View/Hide Equalizer",
.name = "hide_eq",
.flags = DB_ACTION_COMMON,
- .callback = NULL,
+ .callback = action_hide_eq_handler,
.next = &action_toggle_eq
};
static DB_plugin_action_t action_show_eq = {
- .title = "[stub] Show Equalizer",
+ .title = "View/Show Equalizer",
.name = "show_eq",
.flags = DB_ACTION_COMMON,
- .callback = NULL,
+ .callback = action_show_eq_handler,
.next = &action_hide_eq
};
static DB_plugin_action_t action_toggle_mainwin = {
- .title = "Show\\/Hide Player Window",
+ .title = "View/Show\\/Hide Player Window",
.name = "toggle_player_window",
.flags = DB_ACTION_COMMON,
.callback = action_toggle_mainwin_handler,
@@ -1527,7 +1527,7 @@ static DB_plugin_action_t action_toggle_mainwin = {
};
static DB_plugin_action_t action_hide_mainwin = {
- .title = "Hide Player Window",
+ .title = "View/Hide Player Window",
.name = "hide_player_window",
.flags = DB_ACTION_COMMON,
.callback = action_hide_mainwin_handler,
@@ -1535,7 +1535,7 @@ static DB_plugin_action_t action_hide_mainwin = {
};
static DB_plugin_action_t action_show_mainwin = {
- .title = "Show Player Window",
+ .title = "View/Show Player Window",
.name = "show_player_window",
.flags = DB_ACTION_COMMON,
.callback = action_show_mainwin_handler,