summaryrefslogtreecommitdiff
path: root/libs/gtkmm2ext/keyboard.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2015-08-04 22:44:20 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2016-02-22 15:31:23 -0500
commit04a9ce757c018f8db7f2e4f2a293bc693fa5c118 (patch)
tree260dd674bfe92e3ed2724fdd5ee8989bbbf3840e /libs/gtkmm2ext/keyboard.cc
parent4d5cf08bb73fba3cb1afa7e8c18dc76ec012a5ea (diff)
initial compilable version of saving key bindings with "new" scheme
Diffstat (limited to 'libs/gtkmm2ext/keyboard.cc')
-rw-r--r--libs/gtkmm2ext/keyboard.cc26
1 files changed, 24 insertions, 2 deletions
diff --git a/libs/gtkmm2ext/keyboard.cc b/libs/gtkmm2ext/keyboard.cc
index 7e1473931f..0b7ac47471 100644
--- a/libs/gtkmm2ext/keyboard.cc
+++ b/libs/gtkmm2ext/keyboard.cc
@@ -38,8 +38,9 @@
#include "pbd/debug.h"
#include "pbd/unwind.h"
-#include "gtkmm2ext/keyboard.h"
#include "gtkmm2ext/actions.h"
+#include "gtkmm2ext/bindings.h"
+#include "gtkmm2ext/keyboard.h"
#include "gtkmm2ext/debug.h"
#include "i18n.h"
@@ -704,7 +705,28 @@ Keyboard::read_keybindings (string const & path)
int
Keyboard::store_keybindings (string const & path)
{
- return 0;
+ XMLNode* node = new XMLNode (X_("BindingSet"));
+ XMLNode* bnode;
+ int ret = 0;
+
+ for (map<string,Bindings*>::const_iterator c = Bindings::bindings_for_state.begin(); c != Bindings::bindings_for_state.end(); ++c) {
+ bnode = new XMLNode (X_("Bindings"));
+ bnode->add_property (X_("name"), c->first);
+ c->second->save (*bnode);
+ node->add_child_nocopy (*bnode);
+ }
+
+ XMLTree tree;
+ tree.set_root (node);
+
+ if (!tree.write (path)) {
+ error << string_compose (_("Cannot save key bindings to %1"), path) << endmsg;
+ ret = -1;
+ }
+
+ delete node;
+
+ return ret;
}
int