diff options
author | 2013-10-27 18:49:16 +0100 | |
---|---|---|
committer | 2013-10-27 18:49:16 +0100 | |
commit | 476bb04cbbacee2d68bbe3e66de9a948e643f4eb (patch) | |
tree | 078889eac47b97ded2dfafdec4b63d92c5017637 /plugins/gtkui/hotkeys.c | |
parent | 7112a75378eae33fafb114cc7b8efafa2abc0d39 (diff) |
gtkui: automatically import global hotkeys from 0.5, fixed initializing hotkeys on 1st run
Diffstat (limited to 'plugins/gtkui/hotkeys.c')
-rw-r--r-- | plugins/gtkui/hotkeys.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/gtkui/hotkeys.c b/plugins/gtkui/hotkeys.c index 56b98574..33bf01e2 100644 --- a/plugins/gtkui/hotkeys.c +++ b/plugins/gtkui/hotkeys.c @@ -925,3 +925,29 @@ gtkui_set_default_hotkeys (void) { deadbeef->conf_save (); } +void +gtkui_import_0_5_global_hotkeys (void) { + int n = 40; + deadbeef->conf_lock (); + DB_conf_item_t *item = deadbeef->conf_find ("hotkeys.key", NULL); + while (item) { + char *val = strdupa (item->value); + char *colon = strchr (val, ':'); + if (colon) { + *colon++ = 0; + while (*colon && *colon == ' ') { + colon++; + } + if (*colon) { + char newkey[100]; + char newval[100]; + snprintf (newkey, sizeof (newkey), "hotkey.key%02d", n); + snprintf (newval, sizeof (newval), "\"%s\" 0 1 %s", val, colon); + deadbeef->conf_set_str (newkey, newval); + n++; + } + } + item = deadbeef->conf_find ("hotkeys.", item); + } + deadbeef->conf_unlock (); +} |