Restore long lost functionality to customize the accelerator keys on

menu items.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@12026 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2005-11-23 23:28:44 +00:00
parent 9771d0f80c
commit bab3c95b0e
4 changed files with 35 additions and 0 deletions

View File

@ -1,5 +1,10 @@
2005-11-23 David Hampton <hampton@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:

View File

@ -117,6 +117,7 @@ static void gnc_main_window_cmd_file_properties (GtkAction *action, GncMainWindo
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 @@ static guint gnc_menu_n_actions = G_N_ELEMENTS (gnc_menu_actions);
* 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 },
@ -2585,6 +2589,17 @@ gnc_main_window_cmd_edit_preferences (GtkAction *action, GncMainWindow *window)
gnc_preferences_dialog ();
}
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)
{

View File

@ -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"/>

View File

@ -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 @@ gnc_gui_init (SCM command_line)
{
SCM ret = command_line;
GncMainWindow *main_window;
gchar *map;
ENTER (" ");
@ -302,6 +306,10 @@ gnc_gui_init (SCM command_line)
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 @@ gnc_gui_init (SCM command_line)
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 ();