[Gnucash-changes] r12026 - gnucash/trunk - Restore long lost functionality to customize the accelerator keys on

David Hampton hampton at cvs.gnucash.org
Wed Nov 23 18:28:45 EST 2005


Author: hampton
Date: 2005-11-23 18:28:44 -0500 (Wed, 23 Nov 2005)
New Revision: 12026
Trac: http://svn.gnucash.org/trac/changeset/12026

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/gnome-utils/gnc-main-window.c
   gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
   gnucash/trunk/src/gnome/top-level.c
Log:
Restore long lost functionality to customize the accelerator keys on
menu items.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2005-11-23 22:43:32 UTC (rev 12025)
+++ gnucash/trunk/ChangeLog	2005-11-23 23:28:44 UTC (rev 12026)
@@ -1,5 +1,10 @@
 2005-11-23  David Hampton  <hampton at employees.org>
 
+	* src/gnome-utils/ui/gnc-main-window-ui.xml:
+	* src/gnome-utils/gnc-main-window.c:
+	* src/gnome/top-level.c: Restore long lost functionality to
+	customize the accelerator keys on menu items.
+
 	* src/gnome-utils/druid-gconf-setup.c:
 	* src/engine/test/test-resolve-file-path.c:
 	* src/app-utils/gnc-ui-util.c:

Modified: gnucash/trunk/src/gnome/top-level.c
===================================================================
--- gnucash/trunk/src/gnome/top-level.c	2005-11-23 22:43:32 UTC (rev 12025)
+++ gnucash/trunk/src/gnome/top-level.c	2005-11-23 23:28:44 UTC (rev 12026)
@@ -46,6 +46,7 @@
 #include "gnc-engine.h"
 #include "gnc-gconf-utils.h"
 #include "gnc-file.h"
+#include "gnc-filepath-utils.h"
 #include "gnc-hooks.h"
 #include "gnc-main-window.h"
 #include "gnc-menu-extensions.h"
@@ -74,6 +75,8 @@
 #include "window-report.h"
 
 
+#define ACCEL_MAP_NAME "accelerator-map"
+
 /** PROTOTYPES ******************************************************/
 static void gnc_configure_date_format(void);
 
@@ -263,6 +266,7 @@
 {
   SCM ret = command_line;
   GncMainWindow *main_window;
+  gchar *map;
 
   ENTER (" ");
 
@@ -302,6 +306,10 @@
     main_window = gnc_main_window_new ();
     gtk_widget_show (GTK_WIDGET (main_window));
 
+    map = gnc_build_dotgnucash_path(ACCEL_MAP_NAME);
+    gtk_accel_map_load(map);
+    g_free(map);
+
     /* FIXME Remove this test code */
     gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (), gnc_plugin_account_tree_new ());
     gnc_plugin_manager_add_plugin (gnc_plugin_manager_get (), gnc_plugin_basic_commands_new ());
@@ -337,10 +345,16 @@
 void
 gnc_gui_shutdown (void)
 {
+  gchar *map;
+
   if (gnome_is_running && !gnome_is_terminating)
   {
     gnome_is_terminating = TRUE;
 
+    map = gnc_build_dotgnucash_path(ACCEL_MAP_NAME);
+    gtk_accel_map_save(map);
+    g_free(map);
+
     gtk_main_quit();
 
     gnc_gnome_shutdown ();

Modified: gnucash/trunk/src/gnome-utils/gnc-main-window.c
===================================================================
--- gnucash/trunk/src/gnome-utils/gnc-main-window.c	2005-11-23 22:43:32 UTC (rev 12025)
+++ gnucash/trunk/src/gnome-utils/gnc-main-window.c	2005-11-23 23:28:44 UTC (rev 12026)
@@ -117,6 +117,7 @@
 static void gnc_main_window_cmd_file_close (GtkAction *action, GncMainWindow *window);
 static void gnc_main_window_cmd_file_quit (GtkAction *action, GncMainWindow *window);
 static void gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window);
+static void gnc_main_window_cmd_edit_accelerator_keys (GtkToggleAction *action, GncMainWindow *window);
 static void gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window);
 static void gnc_main_window_cmd_view_toolbar (GtkAction *action, GncMainWindow *window);
 static void gnc_main_window_cmd_view_summary (GtkAction *action, GncMainWindow *window);
@@ -294,6 +295,9 @@
  *  code. */
 static GtkToggleActionEntry toggle_actions [] =
 {
+	{ "EditAcceleratorKeysAction", NULL, N_("Learn Accelerator Keys"), NULL,
+	  N_("Learn new accelerator key settings."),
+	  G_CALLBACK (gnc_main_window_cmd_edit_accelerator_keys), FALSE },
 	{ "ViewToolbarAction", NULL, N_("_Toolbar"), NULL,
 	  N_("Show/hide the toolbar on this window"),
 	  G_CALLBACK (gnc_main_window_cmd_view_toolbar), TRUE },
@@ -2586,6 +2590,17 @@
 }
 
 static void
+gnc_main_window_cmd_edit_accelerator_keys( GtkToggleAction *action, GncMainWindow *window )
+{
+  GtkSettings* settings;
+
+  settings = gtk_settings_get_default();
+  g_object_set(G_OBJECT(settings),
+	       "gtk-can-change-accels", gtk_toggle_action_get_active(action),
+	       (gchar*)NULL);
+}
+
+static void
 gnc_main_window_cmd_view_refresh (GtkAction *action, GncMainWindow *window)
 {
 }

Modified: gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml
===================================================================
--- gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml	2005-11-23 22:43:32 UTC (rev 12025)
+++ gnucash/trunk/src/gnome-utils/ui/gnc-main-window-ui.xml	2005-11-23 23:28:44 UTC (rev 12026)
@@ -45,6 +45,7 @@
       <placeholder name="EditFindPlaceholder"/>
       <separator name="EditSep4"/>
       <menuitem name="EditPreferences" action="EditPreferencesAction"/>
+      <menuitem name="EditAcceleratorKeys" action="EditAcceleratorKeysAction"/>
       <placeholder name="EditPreferencesPlaceholder"/>
       <separator name="EditSep5"/>
       <placeholder name="EditStyleSheetsPlaceholder"/>



More information about the gnucash-changes mailing list