The second patch used a file in the nautilus user directory for save/restore of the accelerator map. I have now seen that other Gnome programs use files in $HOME/.gnome2/accels/ for that. Attached is a revised patch which stores the map into "$HOME/.gnome2/accels/nautilus". The first patch is re-attached unmodified for completeness. Holger
From 1700a83cab70179ccb188fd86431db254ca575cd Mon Sep 17 00:00:00 2001 From: Holger Berndt <berndth gmx de> Date: Sat, 28 Mar 2009 18:17:52 +0100 Subject: [PATCH] allow setting shortcuts for scripts --- src/file-manager/fm-directory-view.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 1a12f7f..b2ebdc5 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -5039,8 +5039,8 @@ add_script_to_scripts_menus (FMDirectoryView *directory_view, launch_parameters, (GClosureNotify)script_launch_parameters_free, 0); - gtk_action_group_add_action (directory_view->details->scripts_action_group, - action); + gtk_action_group_add_action_with_accel (directory_view->details->scripts_action_group, + action, NULL); g_object_unref (action); ui_manager = nautilus_window_info_get_ui_manager (directory_view->details->window); -- 1.5.6.3
From d2da137ac6e017b389518654f334ed526a6eb62b Mon Sep 17 00:00:00 2001 From: Holger Berndt <berndth gmx de> Date: Sat, 28 Mar 2009 23:14:35 +0100 Subject: [PATCH] save and restore custom keyboard shortcuts --- libnautilus-private/nautilus-file-utilities.c | 26 +++++++++++++++++++++++++ libnautilus-private/nautilus-file-utilities.h | 2 + src/nautilus-main.c | 13 ++++++++++++ 3 files changed, 41 insertions(+), 0 deletions(-) diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c index 5ce1bdc..34fa71c 100644 --- a/libnautilus-private/nautilus-file-utilities.c +++ b/libnautilus-private/nautilus-file-utilities.c @@ -111,6 +111,32 @@ nautilus_get_user_directory (void) return user_directory; } +/** + * nautilus_get_accel_map_file: + * + * Get the path for the filename containing nautilus accelerator map. + * The filename need not exist. + * + * Return value: the filename path, or NULL if the home directory could not be found + **/ +char * +nautilus_get_accel_map_file (void) +{ + const gchar *home; + + home = g_get_home_dir(); + if (home != NULL) + { + return g_build_filename (home, + ".gnome2", + "accels", + "nautilus", + NULL); + } + + return NULL; +} + typedef struct { char *type; char *path; diff --git a/libnautilus-private/nautilus-file-utilities.h b/libnautilus-private/nautilus-file-utilities.h index a349970..0482aae 100644 --- a/libnautilus-private/nautilus-file-utilities.h +++ b/libnautilus-private/nautilus-file-utilities.h @@ -96,4 +96,6 @@ GFile * nautilus_find_existing_uri_in_hierarchy (GFile *location); GFile * nautilus_find_file_insensitive (GFile *parent, const gchar *name); +char * nautilus_get_accel_map_file (void); + #endif /* NAUTILUS_FILE_UTILITIES_H */ diff --git a/src/nautilus-main.c b/src/nautilus-main.c index 485d4e1..f9ff819 100644 --- a/src/nautilus-main.c +++ b/src/nautilus-main.c @@ -50,6 +50,7 @@ #include <libnautilus-private/nautilus-global-preferences.h> #include <libnautilus-private/nautilus-lib-self-check-functions.h> #include <libnautilus-private/nautilus-icon-names.h> +#include <libnautilus-private/nautilus-file-utilities.h> #include <libxml/parser.h> #ifdef HAVE_LOCALE_H #include <locale.h> @@ -322,6 +323,7 @@ main (int argc, char *argv[]) GPtrArray *uris_array; GError *error; int i; + char *accel_map_filename; const GOptionEntry options[] = { #ifndef NAUTILUS_OMIT_SELF_CHECK @@ -514,6 +516,12 @@ main (int argc, char *argv[]) uris); g_strfreev (uris); + accel_map_filename = nautilus_get_accel_map_file (); + if (accel_map_filename) { + gtk_accel_map_load(accel_map_filename); + g_free (accel_map_filename); + } + if (is_event_loop_needed ()) { gtk_main (); } @@ -527,5 +535,10 @@ main (int argc, char *argv[]) eel_debug_shut_down (); + accel_map_filename = nautilus_get_accel_map_file (); + if (accel_map_filename) { + gtk_accel_map_save (accel_map_filename); + g_free (accel_map_filename); + } return EXIT_SUCCESS; } -- 1.5.6.3
Attachment:
signature.asc
Description: PGP signature