diff options
-rw-r--r-- | plugins/gtkui/Makefile.am | 1 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.c | 2 | ||||
-rw-r--r-- | plugins/gtkui/callbacks.h | 30 | ||||
-rw-r--r-- | plugins/gtkui/deadbeef.glade | 338 | ||||
-rw-r--r-- | plugins/gtkui/hotkeys.c | 178 | ||||
-rw-r--r-- | plugins/gtkui/hotkeys.h | 31 | ||||
-rw-r--r-- | plugins/gtkui/interface.c | 162 | ||||
-rw-r--r-- | plugins/gtkui/prefwin.c | 11 |
8 files changed, 747 insertions, 6 deletions
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am index b756dbfe..33e1c16b 100644 --- a/plugins/gtkui/Makefile.am +++ b/plugins/gtkui/Makefile.am @@ -39,6 +39,7 @@ GTKUI_SOURCES = gtkui.c gtkui.h\ ddbseekbar.h ddbequalizer.h ddbcellrenderertextmultiline.h\ ddbseekbar.c ddbequalizer.c ddbcellrenderertextmultiline.c\ gtkuigl.c gtkuigl.h\ + hotkeys.c hotkeys.h\ $(SM_SOURCES) sdkdir = $(pkgincludedir) diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index f8a64a16..66d0b17e 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -1312,3 +1312,5 @@ on_design_mode1_activate (GtkMenuItem *menuitem, w_set_design_mode (act ? 1 : 0); } + + diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h index c0442b2e..15e060c8 100644 --- a/plugins/gtkui/callbacks.h +++ b/plugins/gtkui/callbacks.h @@ -1183,3 +1183,33 @@ on_enable_cp1251_recoding_toggled (GtkToggleButton *togglebutton, void on_enable_cp936_recoding_toggled (GtkToggleButton *togglebutton, gpointer user_data); + +void +on_hotkeys_list_cursor_changed (GtkTreeView *treeview, + gpointer user_data); + +void +on_hotkey_add_clicked (GtkButton *button, + gpointer user_data); + +void +on_hotkey_remove_clicked (GtkButton *button, + gpointer user_data); + +void +on_hotkeys_actions_cursor_changed (GtkTreeView *treeview, + gpointer user_data); + +void +on_hotkey_keycombo_changed (GtkEditable *editable, + gpointer user_data); + +void +on_hotkey_is_global_toggled (GtkToggleButton *togglebutton, + gpointer user_data); + + +gboolean +on_hotkey_keycombo_key_press_event (GtkWidget *widget, + GdkEventKey *event, + gpointer user_data); diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade index 907a35be..6c7223ce 100644 --- a/plugins/gtkui/deadbeef.glade +++ b/plugins/gtkui/deadbeef.glade @@ -4993,6 +4993,344 @@ SOCKS5_HOSTNAME</property> </child> <child> + <widget class="GtkVBox" id="vbox36"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkHBox" id="hbox108"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label135"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>List of hotkeys</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator4"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow9"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="hotkeys_list"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">True</property> + <property name="rules_hint">False</property> + <property name="reorderable">False</property> + <property name="enable_search">False</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + <signal name="cursor_changed" handler="on_hotkeys_list_cursor_changed" last_modification_time="Tue, 30 Oct 2012 20:39:55 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHButtonBox" id="hbuttonbox3"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkButton" id="hotkey_add"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Add</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_hotkey_add_clicked" last_modification_time="Tue, 30 Oct 2012 20:39:18 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkButton" id="hotkey_remove"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Remove</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <signal name="clicked" handler="on_hotkey_remove_clicked" last_modification_time="Tue, 30 Oct 2012 20:39:23 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox105"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label133"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Action</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator2"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkScrolledWindow" id="scrolledwindow10"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property> + <property name="shadow_type">GTK_SHADOW_IN</property> + <property name="window_placement">GTK_CORNER_TOP_LEFT</property> + + <child> + <widget class="GtkTreeView" id="hotkeys_actions"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="headers_visible">True</property> + <property name="rules_hint">False</property> + <property name="reorderable">False</property> + <property name="enable_search">True</property> + <property name="fixed_height_mode">False</property> + <property name="hover_selection">False</property> + <property name="hover_expand">False</property> + <signal name="cursor_changed" handler="on_hotkeys_actions_cursor_changed" last_modification_time="Tue, 30 Oct 2012 20:39:50 GMT"/> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox106"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkLabel" id="label134"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Key</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator3"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox107"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkEntry" id="hotkey_keycombo"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">•</property> + <property name="activates_default">False</property> + <signal name="changed" handler="on_hotkey_keycombo_changed" last_modification_time="Tue, 30 Oct 2012 20:39:32 GMT"/> + <signal name="key_press_event" handler="on_hotkey_keycombo_key_press_event" last_modification_time="Tue, 30 Oct 2012 20:56:34 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="hotkey_is_global"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Global hotkey</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_hotkey_is_global_toggled" last_modification_time="Tue, 30 Oct 2012 20:39:27 GMT"/> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label132"> + <property name="visible">True</property> + <property name="label" translatable="yes">Hotkeys</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> <widget class="GtkHPaned" id="hpaned1"> <property name="border_width">12</property> <property name="visible">True</property> diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c new file mode 100644 index 00000000..340b17d7 --- /dev/null +++ b/plugins/gtkui/hotkeys.c @@ -0,0 +1,178 @@ +/* + GTK hotkeys configuration for Deadbeef player + Copyright (C) 2009-2012 Alexey Yakovenko and other contributors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif +#include <gtk/gtk.h> +#include "../../gettext.h" +#include "support.h" +#include "gtkui.h" + +static void +unescape_forward_slash (const char *src, char *dst, int size) { + char *start = dst; + while (*src) { + if (dst - start >= size - 1) { + break; + } + if (*src == '\\' && *(src+1) == '/') { + src++; + } + *dst++ = *src++; + } + *dst = 0; +} + +void +prefwin_init_hotkeys (GtkWidget *prefwin) { + GtkWidget *hotkeys = lookup_widget (prefwin, "hotkeys_list"); + GtkWidget *actions = lookup_widget (prefwin, "hotkeys_actions"); + + // setup hotkeys list + GtkTreeViewColumn *hk_col1 = gtk_tree_view_column_new_with_attributes (_("Key combination"), gtk_cell_renderer_text_new (), "text", 0, NULL); + gtk_tree_view_column_set_resizable (hk_col1, TRUE); + GtkTreeViewColumn *hk_col2 = gtk_tree_view_column_new_with_attributes (_("Action"), gtk_cell_renderer_text_new (), "text", 1, NULL); + gtk_tree_view_column_set_resizable (hk_col2, TRUE); + GtkTreeViewColumn *hk_col3 = gtk_tree_view_column_new_with_attributes (_("Context"), gtk_cell_renderer_text_new (), "text", 2, NULL); + gtk_tree_view_column_set_resizable (hk_col3, TRUE); + GtkTreeViewColumn *hk_col4 = gtk_tree_view_column_new_with_attributes (_("Is global"), gtk_cell_renderer_text_new (), "text", 3, NULL); + gtk_tree_view_column_set_resizable (hk_col4, TRUE); + gtk_tree_view_append_column (GTK_TREE_VIEW (hotkeys), hk_col1); + gtk_tree_view_append_column (GTK_TREE_VIEW (hotkeys), hk_col2); + gtk_tree_view_append_column (GTK_TREE_VIEW (hotkeys), hk_col3); + gtk_tree_view_append_column (GTK_TREE_VIEW (hotkeys), hk_col4); + GtkListStore *hkstore = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + gtk_tree_view_set_model (GTK_TREE_VIEW (hotkeys), GTK_TREE_MODEL (hkstore)); + + // setup action tree + GtkTreeViewColumn *hk_act_col1 = gtk_tree_view_column_new_with_attributes (_("Action"), gtk_cell_renderer_text_new (), "text", 0, NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW (actions), hk_act_col1); + + // traverse all plugins and collect all exported actions to dropdown + // column0: title + // column1: ID (invisible) + GtkTreeStore *actions_store = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_STRING); + GtkTreeIter action_main_iter; + gtk_tree_store_append (actions_store, &action_main_iter, NULL); + gtk_tree_store_set (actions_store, &action_main_iter, 0, _("Main"), 1, NULL, -1); + GtkTreeIter action_selection_iter; + gtk_tree_store_append (actions_store, &action_selection_iter, NULL); + gtk_tree_store_set (actions_store, &action_selection_iter, 0, _("Selected track(s)"), 1, NULL, -1); + GtkTreeIter action_playlist_iter; + gtk_tree_store_append (actions_store, &action_playlist_iter, NULL); + gtk_tree_store_set (actions_store, &action_playlist_iter, 0, _("Current playlist"), 1, NULL, -1); + GtkTreeIter action_nowplaying_iter; + gtk_tree_store_append (actions_store, &action_nowplaying_iter, NULL); + gtk_tree_store_set (actions_store, &action_nowplaying_iter, 0, _("Now playing"), 1, NULL, -1); + + DB_plugin_t **plugins = deadbeef->plug_get_list (); + for (int i = 0; plugins[i]; i++) { + DB_plugin_t *p = plugins[i]; + if (p->get_actions) { + DB_plugin_action_t *actions = p->get_actions (NULL); + while (actions) { + if (actions->name && actions->title) { // only add actions with both the name and the title + char title[100]; + unescape_forward_slash (actions->title, title, sizeof (title)); + + GtkTreeIter iter; + if (actions->flags & DB_ACTION_COMMON) { + gtk_tree_store_append (actions_store, &iter, &action_main_iter); + gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, -1); + } + if (actions->flags & (DB_ACTION_SINGLE_TRACK | DB_ACTION_ALLOW_MULTIPLE_TRACKS | DB_ACTION_CAN_MULTIPLE_TRACKS)) { + gtk_tree_store_append (actions_store, &iter, &action_selection_iter); + gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, -1); + gtk_tree_store_append (actions_store, &iter, &action_nowplaying_iter); + gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, -1); + gtk_tree_store_append (actions_store, &iter, &action_playlist_iter); + gtk_tree_store_set (actions_store, &iter, 0, title, 1, actions->name, -1); + } + } + else { +// fprintf (stderr, "WARNING: action %s/%s from plugin %s is missing name and/or title\n", actions->name, actions->title, p->name); + } + actions = actions->next; + } + } + } + + gtk_tree_view_set_model (GTK_TREE_VIEW (actions), GTK_TREE_MODEL (actions_store)); +} + +void +on_hotkeys_list_cursor_changed (GtkTreeView *treeview, + gpointer user_data) +{ + +} + + +void +on_hotkey_add_clicked (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_hotkey_remove_clicked (GtkButton *button, + gpointer user_data) +{ + +} + + +void +on_hotkeys_actions_cursor_changed (GtkTreeView *treeview, + gpointer user_data) +{ + +} + + +void +on_hotkey_keycombo_changed (GtkEditable *editable, + gpointer user_data) +{ + +} + + +void +on_hotkey_is_global_toggled (GtkToggleButton *togglebutton, + gpointer user_data) +{ + +} + +gboolean +on_hotkey_keycombo_key_press_event (GtkWidget *widget, + GdkEventKey *event, + gpointer user_data) +{ + + return FALSE; +} + diff --git a/plugins/gtkui/hotkeys.h b/plugins/gtkui/hotkeys.h new file mode 100644 index 00000000..4e5ff182 --- /dev/null +++ b/plugins/gtkui/hotkeys.h @@ -0,0 +1,31 @@ +/* + GTK hotkeys configuration for Deadbeef player + Copyright (C) 2009-2012 Alexey Yakovenko and other contributors + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef __GTKUI_HOTKEYS_H +#define __GTKUI_HOTKEYS_H + +void +prefwin_init_hotkeys (GtkWidget *prefwin); + +#endif // __GTKUI_HOTKEYS_H + diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c index eff27824..e7e9d943 100644 --- a/plugins/gtkui/interface.c +++ b/plugins/gtkui/interface.c @@ -1779,6 +1779,27 @@ create_prefwin (void) GtkWidget *label131; GtkWidget *useragent; GtkWidget *label16; + GtkWidget *vbox36; + GtkWidget *hbox108; + GtkWidget *label135; + GtkWidget *hseparator4; + GtkWidget *scrolledwindow9; + GtkWidget *hotkeys_list; + GtkWidget *hbuttonbox3; + GtkWidget *hotkey_add; + GtkWidget *hotkey_remove; + GtkWidget *hbox105; + GtkWidget *label133; + GtkWidget *hseparator2; + GtkWidget *scrolledwindow10; + GtkWidget *hotkeys_actions; + GtkWidget *hbox106; + GtkWidget *label134; + GtkWidget *hseparator3; + GtkWidget *hbox107; + GtkWidget *hotkey_keycombo; + GtkWidget *hotkey_is_global; + GtkWidget *label132; GtkWidget *hpaned1; GtkWidget *scrolledwindow2; GtkWidget *pref_pluginlist; @@ -2475,6 +2496,103 @@ create_prefwin (void) gtk_widget_show (label16); gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 5), label16); + vbox36 = gtk_vbox_new (FALSE, 8); + gtk_widget_show (vbox36); + gtk_container_add (GTK_CONTAINER (notebook), vbox36); + gtk_container_set_border_width (GTK_CONTAINER (vbox36), 12); + + hbox108 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox108); + gtk_box_pack_start (GTK_BOX (vbox36), hbox108, FALSE, TRUE, 0); + + label135 = gtk_label_new (_("<b>List of hotkeys</b>")); + gtk_widget_show (label135); + gtk_box_pack_start (GTK_BOX (hbox108), label135, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (label135), TRUE); + + hseparator4 = gtk_hseparator_new (); + gtk_widget_show (hseparator4); + gtk_box_pack_start (GTK_BOX (hbox108), hseparator4, TRUE, TRUE, 0); + + scrolledwindow9 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow9); + gtk_box_pack_start (GTK_BOX (vbox36), scrolledwindow9, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow9), GTK_SHADOW_IN); + + hotkeys_list = gtk_tree_view_new (); + gtk_widget_show (hotkeys_list); + gtk_container_add (GTK_CONTAINER (scrolledwindow9), hotkeys_list); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (hotkeys_list), FALSE); + + hbuttonbox3 = gtk_hbutton_box_new (); + gtk_widget_show (hbuttonbox3); + gtk_box_pack_start (GTK_BOX (vbox36), hbuttonbox3, FALSE, TRUE, 0); + gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox3), GTK_BUTTONBOX_END); + + hotkey_add = gtk_button_new_with_mnemonic (_("Add")); + gtk_widget_show (hotkey_add); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), hotkey_add); + gtk_widget_set_can_default(hotkey_add, TRUE); + + hotkey_remove = gtk_button_new_with_mnemonic (_("Remove")); + gtk_widget_show (hotkey_remove); + gtk_container_add (GTK_CONTAINER (hbuttonbox3), hotkey_remove); + gtk_widget_set_can_default(hotkey_remove, TRUE); + + hbox105 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox105); + gtk_box_pack_start (GTK_BOX (vbox36), hbox105, FALSE, TRUE, 0); + + label133 = gtk_label_new (_("<b>Action</b>")); + gtk_widget_show (label133); + gtk_box_pack_start (GTK_BOX (hbox105), label133, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (label133), TRUE); + + hseparator2 = gtk_hseparator_new (); + gtk_widget_show (hseparator2); + gtk_box_pack_start (GTK_BOX (hbox105), hseparator2, TRUE, TRUE, 0); + + scrolledwindow10 = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolledwindow10); + gtk_box_pack_start (GTK_BOX (vbox36), scrolledwindow10, TRUE, TRUE, 0); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow10), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow10), GTK_SHADOW_IN); + + hotkeys_actions = gtk_tree_view_new (); + gtk_widget_show (hotkeys_actions); + gtk_container_add (GTK_CONTAINER (scrolledwindow10), hotkeys_actions); + + hbox106 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox106); + gtk_box_pack_start (GTK_BOX (vbox36), hbox106, FALSE, TRUE, 0); + + label134 = gtk_label_new (_("<b>Key</b>")); + gtk_widget_show (label134); + gtk_box_pack_start (GTK_BOX (hbox106), label134, FALSE, FALSE, 0); + gtk_label_set_use_markup (GTK_LABEL (label134), TRUE); + + hseparator3 = gtk_hseparator_new (); + gtk_widget_show (hseparator3); + gtk_box_pack_start (GTK_BOX (hbox106), hseparator3, TRUE, TRUE, 0); + + hbox107 = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox107); + gtk_box_pack_start (GTK_BOX (vbox36), hbox107, FALSE, TRUE, 0); + + hotkey_keycombo = gtk_entry_new (); + gtk_widget_show (hotkey_keycombo); + gtk_box_pack_start (GTK_BOX (hbox107), hotkey_keycombo, FALSE, TRUE, 0); + gtk_entry_set_invisible_char (GTK_ENTRY (hotkey_keycombo), 8226); + + hotkey_is_global = gtk_check_button_new_with_mnemonic (_("Global hotkey")); + gtk_widget_show (hotkey_is_global); + gtk_box_pack_start (GTK_BOX (hbox107), hotkey_is_global, FALSE, FALSE, 0); + + label132 = gtk_label_new (_("Hotkeys")); + gtk_widget_show (label132); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 6), label132); + hpaned1 = gtk_hpaned_new (); gtk_widget_show (hpaned1); gtk_container_add (GTK_CONTAINER (notebook), hpaned1); @@ -2578,7 +2696,7 @@ create_prefwin (void) label3 = gtk_label_new (_("Plugins")); gtk_widget_show (label3); - gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 6), label3); + gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), 7), label3); gtk_misc_set_alignment (GTK_MISC (label3), 0.48, 0.5); dialog_action_area2 = gtk_dialog_get_action_area (GTK_DIALOG (prefwin)); @@ -2758,6 +2876,27 @@ create_prefwin (void) g_signal_connect ((gpointer) useragent, "changed", G_CALLBACK (on_useragent_changed), NULL); + g_signal_connect ((gpointer) hotkeys_list, "cursor_changed", + G_CALLBACK (on_hotkeys_list_cursor_changed), + NULL); + g_signal_connect ((gpointer) hotkey_add, "clicked", + G_CALLBACK (on_hotkey_add_clicked), + NULL); + g_signal_connect ((gpointer) hotkey_remove, "clicked", + G_CALLBACK (on_hotkey_remove_clicked), + NULL); + g_signal_connect ((gpointer) hotkeys_actions, "cursor_changed", + G_CALLBACK (on_hotkeys_actions_cursor_changed), + NULL); + g_signal_connect ((gpointer) hotkey_keycombo, "changed", + G_CALLBACK (on_hotkey_keycombo_changed), + NULL); + g_signal_connect ((gpointer) hotkey_keycombo, "key_press_event", + G_CALLBACK (on_hotkey_keycombo_key_press_event), + NULL); + g_signal_connect ((gpointer) hotkey_is_global, "toggled", + G_CALLBACK (on_hotkey_is_global_toggled), + NULL); g_signal_connect ((gpointer) pref_pluginlist, "cursor_changed", G_CALLBACK (on_pref_pluginlist_cursor_changed), NULL); @@ -2905,6 +3044,27 @@ create_prefwin (void) GLADE_HOOKUP_OBJECT (prefwin, label131, "label131"); GLADE_HOOKUP_OBJECT (prefwin, useragent, "useragent"); GLADE_HOOKUP_OBJECT (prefwin, label16, "label16"); + GLADE_HOOKUP_OBJECT (prefwin, vbox36, "vbox36"); + GLADE_HOOKUP_OBJECT (prefwin, hbox108, "hbox108"); + GLADE_HOOKUP_OBJECT (prefwin, label135, "label135"); + GLADE_HOOKUP_OBJECT (prefwin, hseparator4, "hseparator4"); + GLADE_HOOKUP_OBJECT (prefwin, scrolledwindow9, "scrolledwindow9"); + GLADE_HOOKUP_OBJECT (prefwin, hotkeys_list, "hotkeys_list"); + GLADE_HOOKUP_OBJECT (prefwin, hbuttonbox3, "hbuttonbox3"); + GLADE_HOOKUP_OBJECT (prefwin, hotkey_add, "hotkey_add"); + GLADE_HOOKUP_OBJECT (prefwin, hotkey_remove, "hotkey_remove"); + GLADE_HOOKUP_OBJECT (prefwin, hbox105, "hbox105"); + GLADE_HOOKUP_OBJECT (prefwin, label133, "label133"); + GLADE_HOOKUP_OBJECT (prefwin, hseparator2, "hseparator2"); + GLADE_HOOKUP_OBJECT (prefwin, scrolledwindow10, "scrolledwindow10"); + GLADE_HOOKUP_OBJECT (prefwin, hotkeys_actions, "hotkeys_actions"); + GLADE_HOOKUP_OBJECT (prefwin, hbox106, "hbox106"); + GLADE_HOOKUP_OBJECT (prefwin, label134, "label134"); + GLADE_HOOKUP_OBJECT (prefwin, hseparator3, "hseparator3"); + GLADE_HOOKUP_OBJECT (prefwin, hbox107, "hbox107"); + GLADE_HOOKUP_OBJECT (prefwin, hotkey_keycombo, "hotkey_keycombo"); + GLADE_HOOKUP_OBJECT (prefwin, hotkey_is_global, "hotkey_is_global"); + GLADE_HOOKUP_OBJECT (prefwin, label132, "label132"); GLADE_HOOKUP_OBJECT (prefwin, hpaned1, "hpaned1"); GLADE_HOOKUP_OBJECT (prefwin, scrolledwindow2, "scrolledwindow2"); GLADE_HOOKUP_OBJECT (prefwin, pref_pluginlist, "pref_pluginlist"); diff --git a/plugins/gtkui/prefwin.c b/plugins/gtkui/prefwin.c index 546759a0..2a462c09 100644 --- a/plugins/gtkui/prefwin.c +++ b/plugins/gtkui/prefwin.c @@ -31,12 +31,12 @@ #include "callbacks.h" #include "drawing.h" #include "../hotkeys/hotkeys.h" -#include "support.h" #include "eq.h" #include "ddblistview.h" #include "pluginconf.h" #include "dspconfig.h" #include "wingeom.h" +#include "hotkeys.h" #define GLADE_HOOKUP_OBJECT(component,widget,name) \ g_object_set_data_full (G_OBJECT (component), name, \ @@ -679,10 +679,11 @@ on_preferences_activate (GtkMenuItem *menuitem, gtk_widget_set_sensitive (lookup_widget (prefwin, "configure_plugin"), FALSE); // hotkeys - DB_plugin_t *hotkeys = deadbeef->plug_get_for_id ("hotkeys"); - if (hotkeys) { - prefwin_add_hotkeys_tab (prefwin); - } +// DB_plugin_t *hotkeys = deadbeef->plug_get_for_id ("hotkeys"); +// if (hotkeys) { +// prefwin_add_hotkeys_tab (prefwin); +// } + prefwin_init_hotkeys (prefwin); deadbeef->conf_unlock (); gtk_dialog_run (GTK_DIALOG (prefwin)); |