[PATCH] save and restore custom keyboard shortcuts
- From: Holger Berndt <berndth gmx de>
- Subject: [PATCH] save and restore custom keyboard shortcuts
- Date: Sat, 28 Mar 2009 23:14:35 +0100
---
libnautilus-private/nautilus-file-utilities.c | 17 +++++++++++++++++
libnautilus-private/nautilus-file-utilities.h | 2 ++
src/nautilus-main.c | 9 +++++++++
3 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/libnautilus-private/nautilus-file-utilities.c b/libnautilus-private/nautilus-file-utilities.c
index 5ce1bdc..2e7baa2 100644
--- a/libnautilus-private/nautilus-file-utilities.c
+++ b/libnautilus-private/nautilus-file-utilities.c
@@ -49,6 +49,8 @@
#define LEGACY_DESKTOP_DIRECTORY_NAME ".gnome-desktop"
#define DEFAULT_DESKTOP_DIRECTORY_MODE (0755)
+#define NAUTILUS_ACCEL_MAP_FILE_NAME "accel_map"
+
static void update_xdg_dir_cache (void);
static void schedule_user_dirs_changed (void);
static void desktop_dir_changed (void);
@@ -111,6 +113,21 @@ 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.
+ **/
+char *
+nautilus_get_accel_map_file (void)
+{
+ return g_build_filename (nautilus_get_user_directory (),
+ G_DIR_SEPARATOR_S, NAUTILUS_ACCEL_MAP_FILE_NAME, 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..dfb2c95 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,10 @@ main (int argc, char *argv[])
uris);
g_strfreev (uris);
+ accel_map_filename = nautilus_get_accel_map_file ();
+ gtk_accel_map_load(accel_map_filename);
+ g_free (accel_map_filename);
+
if (is_event_loop_needed ()) {
gtk_main ();
}
@@ -527,5 +533,8 @@ main (int argc, char *argv[])
eel_debug_shut_down ();
+ accel_map_filename = nautilus_get_accel_map_file ();
+ gtk_accel_map_save (accel_map_filename);
+ g_free (accel_map_filename);
return EXIT_SUCCESS;
}
--
1.5.6.3
--MP_/tK7F/b/z3kz2lY5I_222AI5--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]