Use PBD::ffs for portability
[ardour.git] / gtk2_ardour / keyboard.cc
index bcdd551c0ab82a67e24de16b805aed5162dd2f8c..75a96ec98b3a0d4112cdd352cf798c8d58b7cd28 100644 (file)
 
 #include "ardour/filesystem_paths.h"
 
+#include "ardour_ui.h"
 #include "keyboard.h"
 #include "opts.h"
 
 #include "i18n.h"
 
+#ifdef SearchPath
+#undef SearchPath
+#endif
+
 using namespace std;
 using namespace Gtk;
 using namespace PBD;
@@ -38,9 +43,11 @@ accel_map_changed (GtkAccelMap* /*map*/,
                   gchar* /*path*/,
                   guint /*key*/,
                   GdkModifierType /*mod*/,
-                  gpointer /*arg*/)
+                  gpointer keyboard)
 {
+       ArdourKeyboard* me = (ArdourKeyboard*)keyboard;
        Keyboard::keybindings_changed ();
+       me->ui.setup_tooltips ();
 }
 
 void
@@ -56,11 +63,7 @@ ArdourKeyboard::setup_keybindings ()
 
        /* set up the per-user bindings path */
 
-       strs.push_back (Glib::get_home_dir());
-       strs.push_back (".ardour3");
-       strs.push_back ("ardour.bindings");
-
-       user_keybindings_path = Glib::build_filename (strs);
+       user_keybindings_path = Glib::build_filename (user_config_directory(), "ardour.bindings");
 
        if (Glib::file_test (user_keybindings_path, Glib::FILE_TEST_EXISTS)) {
                std::pair<string,string> newpair;
@@ -122,14 +125,12 @@ ArdourKeyboard::setup_keybindings ()
                if (!Glib::path_is_absolute (keybindings_path)) {
 
                        /* not absolute - look in the usual places */
-                       sys::path keybindings_file;
-
-                       SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path();
+                       std::string keybindings_file;
 
-                       if ( ! find_file_in_search_path (spath, keybindings_path, keybindings_file)) {
+                       if ( ! find_file_in_search_path (ardour_config_search_path(), keybindings_path, keybindings_file)) {
 
                                if (keybindings_path == default_bindings) {
-                                       error << _("Default keybindings not found - Ardour will be hard to use!") << endmsg;
+                                       error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg;
                                        return;
                                } else {
                                        warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"),
@@ -142,7 +143,7 @@ ArdourKeyboard::setup_keybindings ()
 
                                /* use it */
 
-                               keybindings_path = keybindings_file.to_string();
+                               keybindings_path = keybindings_file;
                                break;
 
                        }
@@ -153,7 +154,7 @@ ArdourKeyboard::setup_keybindings ()
 
                        if (!Glib::file_test (keybindings_path, Glib::FILE_TEST_EXISTS)) {
                                if (keybindings_path == default_bindings) {
-                                       error << _("Default keybindings not found - Ardour will be hard to use!") << endmsg;
+                                       error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg;
                                        return;
                                } else {
                                        warning << string_compose (_("Key bindings file \"%1\" not found. Default bindings used instead"),
@@ -173,7 +174,7 @@ ArdourKeyboard::setup_keybindings ()
        /* catch changes */
 
        GtkAccelMap* accelmap = gtk_accel_map_get();
-       g_signal_connect (accelmap, "changed", (GCallback) accel_map_changed, 0);
+       g_signal_connect (accelmap, "changed", (GCallback) accel_map_changed, this);
 }
 
 Selection::Operation