summaryrefslogtreecommitdiff
path: root/plugins/gtkui/hotkeys.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-18 22:03:28 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-09-18 22:03:28 +0200
commit3d8d583773aaaed79382b3c7aac0f33e6b1f1e02 (patch)
tree6291f1447eaa5a43ac2d1bfd50b2950950ce3bb5 /plugins/gtkui/hotkeys.c
parent5f87651e3aa480a671ad3a0cb2cd1c93bcacb70f (diff)
gtkui: warn a user when he forgets to save hotkeys changes
Diffstat (limited to 'plugins/gtkui/hotkeys.c')
-rw-r--r--plugins/gtkui/hotkeys.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c
index 142b0164..5b204a1c 100644
--- a/plugins/gtkui/hotkeys.c
+++ b/plugins/gtkui/hotkeys.c
@@ -63,6 +63,8 @@ typedef struct
#include "hotkeys.h"
#include "../../strdupa.h"
+int gtkui_hotkeys_changed = 0;
+
void
on_hotkeys_actions_cursor_changed (GtkTreeView *treeview,
gpointer user_data);
@@ -401,6 +403,7 @@ on_hotkeys_actions_clicked (GtkButton *button,
void
prefwin_init_hotkeys (GtkWidget *_prefwin) {
+ gtkui_hotkeys_changed = 0;
ctx_names[DDB_ACTION_CTX_MAIN] = _("Main");
ctx_names[DDB_ACTION_CTX_SELECTION] = _("Selection");
ctx_names[DDB_ACTION_CTX_PLAYLIST] = _("Playlist");
@@ -508,6 +511,7 @@ on_hotkeys_list_cursor_changed (GtkTreeView *treeview,
if (path) {
gtk_tree_path_free (path);
}
+ gtkui_hotkeys_changed = 1;
}
@@ -524,6 +528,7 @@ on_hotkey_add_clicked (GtkButton *button,
gtk_tree_view_set_cursor (GTK_TREE_VIEW (hotkeys), path, NULL, FALSE);
gtk_tree_path_free (path);
gtk_widget_grab_focus (hotkeys);
+ gtkui_hotkeys_changed = 1;
}
@@ -538,6 +543,7 @@ on_hotkey_remove_clicked (GtkButton *button,
GtkTreeIter iter;
gtk_tree_model_get_iter (GTK_TREE_MODEL (hkstore), &iter, path);
gtk_list_store_remove (hkstore, &iter);
+ gtkui_hotkeys_changed = 1;
}
@@ -589,16 +595,15 @@ on_hotkey_is_global_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
// update the tree
- {
- GtkWidget *hotkeys = lookup_widget (prefwin, "hotkeys_list");
- GtkTreePath *path;
- 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)) {
- gtk_list_store_set (GTK_LIST_STORE (model), &iter, 3, gtk_toggle_button_get_active (togglebutton), -1);
- }
+ GtkWidget *hotkeys = lookup_widget (prefwin, "hotkeys_list");
+ GtkTreePath *path;
+ 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)) {
+ gtk_list_store_set (GTK_LIST_STORE (model), &iter, 3, gtk_toggle_button_get_active (togglebutton), -1);
}
+ gtkui_hotkeys_changed = 1;
}
typedef struct {
@@ -784,6 +789,7 @@ out:
gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
grabbed = 0;
+ gtkui_hotkeys_changed = 1;
return TRUE;
}
@@ -823,6 +829,7 @@ on_hotkeys_apply_clicked (GtkButton *button,
gpointer user_data)
{
hotkeys_save ();
+ gtkui_hotkeys_changed = 0;
}
@@ -831,5 +838,6 @@ on_hotkeys_revert_clicked (GtkButton *button,
gpointer user_data)
{
hotkeys_load ();
+ gtkui_hotkeys_changed = 0;
}