summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2013-08-24 20:38:35 +0200
committerGravatar waker <wakeroid@gmail.com>2013-08-24 20:38:35 +0200
commit4cfa42c8d2e50f2c2ddf9af83013c9761a8dcc6d (patch)
tree417014b1453717bad80fe7f8bc24594d2dff12aa /plugins
parent92439c330fa3b08b34c5fe9bfb38ba8a10b0caf4 (diff)
gtkui: hotkeys preferences: moved actions tree to a separate dialog
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/callbacks.h5
-rw-r--r--plugins/gtkui/deadbeef.glade481
-rw-r--r--plugins/gtkui/hotkeys.c96
-rw-r--r--plugins/gtkui/hotkeys.h3
-rw-r--r--plugins/gtkui/interface.c64
-rw-r--r--plugins/gtkui/widgets.c33
6 files changed, 307 insertions, 375 deletions
diff --git a/plugins/gtkui/callbacks.h b/plugins/gtkui/callbacks.h
index c5b2ff6a..c1a4a5c7 100644
--- a/plugins/gtkui/callbacks.h
+++ b/plugins/gtkui/callbacks.h
@@ -1282,3 +1282,8 @@ on_button3_clicked (GtkButton *button,
void
on_ctmapping_reset_clicked (GtkButton *button,
gpointer user_data);
+
+
+void
+on_hotkeys_actions_clicked (GtkButton *button,
+ gpointer user_data);
diff --git a/plugins/gtkui/deadbeef.glade b/plugins/gtkui/deadbeef.glade
index 12c81dc6..bbb7ccf9 100644
--- a/plugins/gtkui/deadbeef.glade
+++ b/plugins/gtkui/deadbeef.glade
@@ -5062,89 +5062,46 @@ SOCKS5_HOSTNAME</property>
</child>
<child>
- <widget class="GtkVPaned" id="vpaned1">
+ <widget class="GtkVBox" id="vbox36">
+ <property name="border_width">12</property>
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
<child>
- <widget class="GtkVBox" id="vbox36">
- <property name="border_width">12</property>
+ <widget class="GtkHBox" id="hbox108">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child>
- <widget class="GtkHBox" id="hbox108">
+ <widget class="GtkLabel" id="label135">
<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">&lt;b&gt;Assigned hotkeys&lt;/b&gt;</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>
+ <property name="label" translatable="yes">&lt;b&gt;Assigned hotkeys&lt;/b&gt;</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">True</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow9">
+ <widget class="GtkHSeparator" id="hseparator4">
<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>
@@ -5152,281 +5109,251 @@ SOCKS5_HOSTNAME</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="GtkHButtonBox" id="hbuttonbox3">
+ <widget class="GtkTreeView" id="hotkeys_list">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</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="GtkButton" id="hotkey_add">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-add</property>
- <property name="use_stock">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="GtkHButtonBox" id="hbuttonbox3">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">8</property>
- <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">gtk-remove</property>
- <property name="use_stock">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>
+ <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">gtk-add</property>
+ <property name="use_stock">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">gtk-remove</property>
+ <property name="use_stock">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>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
</child>
</widget>
<packing>
- <property name="shrink">False</property>
- <property name="resize">False</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox37">
- <property name="border_width">12</property>
+ <widget class="GtkHBox" id="hbox105">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child>
- <widget class="GtkHBox" id="hbox105">
+ <widget class="GtkLabel" id="label133">
<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">&lt;b&gt;Action&lt;/b&gt;</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>
+ <property name="label" translatable="yes">Action:</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">True</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkScrolledWindow" id="scrolledwindow10">
+ <widget class="GtkButton" id="hotkeys_actions">
<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">False</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>
+ <property name="label" translatable="yes">&lt;Not set&gt;</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_hotkeys_actions_clicked" last_modification_time="Sat, 24 Aug 2013 18:19:52 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</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">False</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="GtkHBox" id="hbox106">
+ <widget class="GtkLabel" id="label134">
<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">&lt;b&gt;Key&lt;/b&gt;</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>
+ <property name="label" translatable="yes">Key:</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">True</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox107">
+ <widget class="GtkButton" id="hotkeys_set_key">
<property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkButton" id="hotkeys_set_key">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;Not set&gt;</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_hotkeys_set_key_clicked" last_modification_time="Tue, 06 Nov 2012 20:30:58 GMT"/>
- <signal name="key_press_event" handler="on_hotkeys_set_key_key_press_event" last_modification_time="Tue, 06 Nov 2012 20:44:01 GMT"/>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</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>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">&lt;Not set&gt;</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_hotkeys_set_key_clicked" last_modification_time="Tue, 06 Nov 2012 20:30:58 GMT"/>
+ <signal name="key_press_event" handler="on_hotkeys_set_key_key_press_event" last_modification_time="Tue, 06 Nov 2012 20:44:01 GMT"/>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
- <property name="fill">True</property>
+ <property name="fill">False</property>
</packing>
</child>
<child>
- <widget class="GtkHButtonBox" id="hbuttonbox4">
+ <widget class="GtkCheckButton" id="hotkey_is_global">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
-
- <child>
- <widget class="GtkButton" id="hotkeys_apply">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="on_hotkeys_apply_clicked" last_modification_time="Sun, 04 Nov 2012 14:52:51 GMT"/>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="hotkeys_revert">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-revert-to-saved</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="focus_on_click">True</property>
- <signal name="clicked" handler="on_hotkeys_revert_clicked" last_modification_time="Sun, 04 Nov 2012 14:53:09 GMT"/>
- </widget>
- </child>
+ <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">True</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
<packing>
- <property name="shrink">False</property>
- <property name="resize">True</property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHButtonBox" id="hbuttonbox4">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="spacing">8</property>
+
+ <child>
+ <widget class="GtkButton" id="hotkeys_apply">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-apply</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="on_hotkeys_apply_clicked" last_modification_time="Sat, 24 Aug 2013 18:17:31 GMT"/>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="hotkeys_revert">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-revert-to-saved</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="on_hotkeys_revert_clicked" last_modification_time="Sat, 24 Aug 2013 18:17:19 GMT"/>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c
index e95f0a3c..e2d68ce8 100644
--- a/plugins/gtkui/hotkeys.c
+++ b/plugins/gtkui/hotkeys.c
@@ -54,10 +54,15 @@ typedef struct
#include "../../gettext.h"
#include "support.h"
#include "gtkui.h"
+#include "interface.h"
#include "../libparser/parser.h"
#include "../hotkeys/hotkeys.h"
#include <X11/Xlib.h> // only for the KeySym type
+void
+on_hotkeys_actions_cursor_changed (GtkTreeView *treeview,
+ gpointer user_data);
+
static GtkWidget *prefwin;
static guint last_accel_key = 0;
static guint last_accel_mask = 0;
@@ -345,6 +350,52 @@ init_action_tree (GtkWidget *actions, const char *act, int ctx) {
}
void
+on_hotkeys_actions_clicked (GtkButton *button,
+ gpointer user_data)
+{
+ GtkTreePath *path;
+ GtkWidget *hotkeys = lookup_widget (prefwin, "hotkeys_list");
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (hotkeys), &path, NULL);
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (hotkeys));
+ GtkTreeIter iter;
+ if (!path || !gtk_tree_model_get_iter (model, &iter, path)) {
+ return;
+ }
+ // get action name from iter
+ GValue val_name = {0,}, val_ctx = {0,};
+ gtk_tree_model_get_value (model, &iter, 4, &val_name);
+ gtk_tree_model_get_value (model, &iter, 5, &val_ctx);
+ const char *act = g_value_get_string (&val_name);
+ int ctx = g_value_get_int (&val_ctx);
+
+ GtkWidget *dlg = create_select_action ();
+ GtkWidget *treeview = lookup_widget (dlg, "actions");
+ init_action_tree (treeview, act, ctx);
+ int response = gtk_dialog_run (GTK_DIALOG (dlg));
+ if (response == GTK_RESPONSE_OK) {
+ on_hotkeys_actions_cursor_changed (treeview, NULL);
+
+ GtkTreePath *path;
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (treeview), &path, NULL);
+ GtkTreeModel *model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
+ GtkTreeIter iter;
+ const char *name = NULL;
+ int ctx = -1;
+ if (path && gtk_tree_model_get_iter (model, &iter, path)) {
+ GValue val = {0,};
+ gtk_tree_model_get_value (model, &iter, 1, &val);
+ name = g_value_get_string (&val);
+ GValue val_ctx = {0,};
+ gtk_tree_model_get_value (model, &iter, 2, &val_ctx);
+ ctx = g_value_get_int (&val_ctx);
+ }
+ set_button_action_label (name, ctx, lookup_widget (prefwin, "hotkeys_actions"));
+ }
+ gtk_widget_destroy (dlg);
+}
+
+
+void
prefwin_init_hotkeys (GtkWidget *_prefwin) {
ctx_names[DDB_ACTION_CTX_MAIN] = _("Main");
ctx_names[DDB_ACTION_CTX_SELECTION] = _("Selection");
@@ -353,7 +404,6 @@ prefwin_init_hotkeys (GtkWidget *_prefwin) {
prefwin = _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);
@@ -383,16 +433,38 @@ prefwin_init_hotkeys (GtkWidget *_prefwin) {
gtk_tree_view_set_model (GTK_TREE_VIEW (hotkeys), GTK_TREE_MODEL (hkstore));
int n_hotkeys = hotkeys_load ();
+}
- // setup action tree
- init_action_tree (actions, NULL, -1);
- if (n_hotkeys > 0) {
- GtkTreePath *path = gtk_tree_path_new_first ();
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (hotkeys), path, NULL, FALSE);
- gtk_tree_path_free (path);
+void
+set_button_action_label (const char *act, int action_ctx, GtkWidget *button) {
+ if (act && action_ctx >= 0) {
+ DB_plugin_action_t *action = find_action_by_name (act);
+ if (action) {
+ const char *ctx_str = NULL;
+ switch (action_ctx) {
+ case DDB_ACTION_CTX_MAIN:
+ break;
+ case DDB_ACTION_CTX_SELECTION:
+ ctx_str = _("Selected tracks");
+ break;
+ case DDB_ACTION_CTX_PLAYLIST:
+ ctx_str = _("Tracks in current playlist");
+ break;
+ case DDB_ACTION_CTX_NOWPLAYING:
+ ctx_str = _("Currently playing track");
+ break;
+ }
+ char s[200];
+ snprintf (s, sizeof (s), "%s%s%s", ctx_str ? ctx_str : "", ctx_str ? " ⇒ ": "", action->title);
+ gtk_button_set_label (GTK_BUTTON (button), s);
+ return;
+ }
}
+
+ gtk_button_set_label (GTK_BUTTON (button), _("<Not set>"));
}
+
void
on_hotkeys_list_cursor_changed (GtkTreeView *treeview,
gpointer user_data)
@@ -409,14 +481,8 @@ on_hotkeys_list_cursor_changed (GtkTreeView *treeview,
gtk_tree_model_get_value (model, &iter, 4, &val_name);
gtk_tree_model_get_value (model, &iter, 5, &val_ctx);
const char *name = g_value_get_string (&val_name);
- // find in the action list and set as current
- GtkTreeModel *actmodel = gtk_tree_view_get_model (GTK_TREE_VIEW (actions));
- actionbinding_t binding = {
- .name = name,
- .ctx = g_value_get_int (&val_ctx),
- .treeview = actions
- };
- gtk_tree_model_foreach (actmodel, set_current_action, (void*)&binding);
+
+ set_button_action_label (name, g_value_get_int (&val_ctx), actions);
gtk_widget_set_sensitive (lookup_widget (prefwin, "hotkey_is_global"), TRUE);
GValue val_isglobal = {0,};
diff --git a/plugins/gtkui/hotkeys.h b/plugins/gtkui/hotkeys.h
index d20b90b0..591c1b78 100644
--- a/plugins/gtkui/hotkeys.h
+++ b/plugins/gtkui/hotkeys.h
@@ -33,5 +33,8 @@ init_action_tree (GtkWidget *actions, const char *act, int ctx);
DB_plugin_action_t *
find_action_by_name (const char *command);
+void
+set_button_action_label (const char *act, int action_ctx, GtkWidget *button);
+
#endif // __GTKUI_HOTKEYS_H
diff --git a/plugins/gtkui/interface.c b/plugins/gtkui/interface.c
index 87bf48c9..ea1435eb 100644
--- a/plugins/gtkui/interface.c
+++ b/plugins/gtkui/interface.c
@@ -1749,7 +1749,6 @@ create_prefwin (void)
GtkWidget *hseparator5;
GtkWidget *edit_content_type_mapping;
GtkWidget *label16;
- GtkWidget *vpaned1;
GtkWidget *vbox36;
GtkWidget *hbox108;
GtkWidget *label135;
@@ -1759,16 +1758,11 @@ create_prefwin (void)
GtkWidget *hbuttonbox3;
GtkWidget *hotkey_add;
GtkWidget *hotkey_remove;
- GtkWidget *vbox37;
GtkWidget *hbox105;
GtkWidget *label133;
- GtkWidget *hseparator2;
- GtkWidget *scrolledwindow10;
GtkWidget *hotkeys_actions;
GtkWidget *hbox106;
GtkWidget *label134;
- GtkWidget *hseparator3;
- GtkWidget *hbox107;
GtkWidget *hotkeys_set_key;
GtkWidget *hotkey_is_global;
GtkWidget *hbuttonbox4;
@@ -2479,13 +2473,9 @@ 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);
- vpaned1 = gtk_vpaned_new ();
- gtk_widget_show (vpaned1);
- gtk_container_add (GTK_CONTAINER (notebook), vpaned1);
-
vbox36 = gtk_vbox_new (FALSE, 8);
gtk_widget_show (vbox36);
- gtk_paned_pack1 (GTK_PANED (vpaned1), vbox36, FALSE, FALSE);
+ gtk_container_add (GTK_CONTAINER (notebook), vbox36);
gtk_container_set_border_width (GTK_CONTAINER (vbox36), 12);
hbox108 = gtk_hbox_new (FALSE, 8);
@@ -2528,63 +2518,39 @@ create_prefwin (void)
gtk_container_add (GTK_CONTAINER (hbuttonbox3), hotkey_remove);
gtk_widget_set_can_default(hotkey_remove, TRUE);
- vbox37 = gtk_vbox_new (FALSE, 8);
- gtk_widget_show (vbox37);
- gtk_paned_pack2 (GTK_PANED (vpaned1), vbox37, TRUE, FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (vbox37), 12);
-
hbox105 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox105);
- gtk_box_pack_start (GTK_BOX (vbox37), hbox105, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox36), hbox105, FALSE, FALSE, 0);
- label133 = gtk_label_new (_("<b>Action</b>"));
+ label133 = gtk_label_new (_("Action:"));
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 (vbox37), 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 ();
+ hotkeys_actions = gtk_button_new_with_mnemonic (_("<Not set>"));
gtk_widget_show (hotkeys_actions);
- gtk_container_add (GTK_CONTAINER (scrolledwindow10), hotkeys_actions);
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (hotkeys_actions), FALSE);
+ gtk_box_pack_start (GTK_BOX (hbox105), hotkeys_actions, FALSE, FALSE, 0);
hbox106 = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox106);
- gtk_box_pack_start (GTK_BOX (vbox37), hbox106, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox36), hbox106, FALSE, FALSE, 0);
- label134 = gtk_label_new (_("<b>Key</b>"));
+ label134 = gtk_label_new (_("Key:"));
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 (vbox37), hbox107, FALSE, TRUE, 0);
-
hotkeys_set_key = gtk_button_new_with_mnemonic (_("<Not set>"));
gtk_widget_show (hotkeys_set_key);
- gtk_box_pack_start (GTK_BOX (hbox107), hotkeys_set_key, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (hbox106), hotkeys_set_key, FALSE, FALSE, 0);
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);
+ gtk_box_pack_start (GTK_BOX (hbox106), hotkey_is_global, FALSE, FALSE, 0);
hbuttonbox4 = gtk_hbutton_box_new ();
gtk_widget_show (hbuttonbox4);
- gtk_box_pack_start (GTK_BOX (vbox37), hbuttonbox4, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox36), hbuttonbox4, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox4), GTK_BUTTONBOX_END);
gtk_box_set_spacing (GTK_BOX (hbuttonbox4), 8);
@@ -2897,8 +2863,8 @@ create_prefwin (void)
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),
+ g_signal_connect ((gpointer) hotkeys_actions, "clicked",
+ G_CALLBACK (on_hotkeys_actions_clicked),
NULL);
g_signal_connect ((gpointer) hotkeys_set_key, "clicked",
G_CALLBACK (on_hotkeys_set_key_clicked),
@@ -3064,7 +3030,6 @@ create_prefwin (void)
GLADE_HOOKUP_OBJECT (prefwin, hseparator5, "hseparator5");
GLADE_HOOKUP_OBJECT (prefwin, edit_content_type_mapping, "edit_content_type_mapping");
GLADE_HOOKUP_OBJECT (prefwin, label16, "label16");
- GLADE_HOOKUP_OBJECT (prefwin, vpaned1, "vpaned1");
GLADE_HOOKUP_OBJECT (prefwin, vbox36, "vbox36");
GLADE_HOOKUP_OBJECT (prefwin, hbox108, "hbox108");
GLADE_HOOKUP_OBJECT (prefwin, label135, "label135");
@@ -3074,16 +3039,11 @@ create_prefwin (void)
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, vbox37, "vbox37");
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, hotkeys_set_key, "hotkeys_set_key");
GLADE_HOOKUP_OBJECT (prefwin, hotkey_is_global, "hotkey_is_global");
GLADE_HOOKUP_OBJECT (prefwin, hbuttonbox4, "hbuttonbox4");
diff --git a/plugins/gtkui/widgets.c b/plugins/gtkui/widgets.c
index 9576ac65..9f72928c 100644
--- a/plugins/gtkui/widgets.c
+++ b/plugins/gtkui/widgets.c
@@ -2930,35 +2930,6 @@ w_button_destroy (ddb_gtkui_widget_t *w) {
}
static void
-set_button_action_label (w_button_t *b, GtkWidget *button) {
- if (b->action && b->action_ctx >= 0) {
- DB_plugin_action_t *action = find_action_by_name (b->action);
- if (action) {
- const char *ctx_str = NULL;
- switch (b->action_ctx) {
- case DDB_ACTION_CTX_MAIN:
- break;
- case DDB_ACTION_CTX_SELECTION:
- ctx_str = _("Selected tracks");
- break;
- case DDB_ACTION_CTX_PLAYLIST:
- ctx_str = _("Tracks in current playlist");
- break;
- case DDB_ACTION_CTX_NOWPLAYING:
- ctx_str = _("Currently playing track");
- break;
- }
- char s[200];
- snprintf (s, sizeof (s), "%s%s%s", ctx_str ? ctx_str : "", ctx_str ? " ⇒ ": "", action->title);
- gtk_button_set_label (GTK_BUTTON (button), s);
- return;
- }
- }
-
- gtk_button_set_label (GTK_BUTTON (button), _("<Not set>"));
-}
-
-static void
on_button_set_action_clicked (GtkButton *button,
gpointer user_data)
{
@@ -2989,7 +2960,7 @@ on_button_set_action_clicked (GtkButton *button,
b->action_ctx = ctx;
}
}
- set_button_action_label (b, GTK_WIDGET (button));
+ set_button_action_label (b->action, b->action_ctx, GTK_WIDGET (button));
}
gtk_widget_destroy (dlg);
}
@@ -3010,7 +2981,7 @@ on_button_config (GtkMenuItem *menuitem, gpointer user_data) {
gtk_color_button_set_color (GTK_COLOR_BUTTON (textcolor), &b->textcolor);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (use_textcolor), b->use_textcolor);
gtk_entry_set_text (GTK_ENTRY (label), b->label ? b->label : "");
- set_button_action_label (b, action);
+ set_button_action_label (b->action, b->action_ctx, action);
g_signal_connect ((gpointer) action, "clicked",
G_CALLBACK (on_button_set_action_clicked),
user_data);