From ecc808190fd04a8211c96b238052f150d14abca6 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Wed, 24 May 2006 16:56:14 +0000 Subject: [PATCH] Set shortcut for Replace and split keybindings_init code git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@362 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ src/keybindings.c | 29 +++++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1959b9d9..293ecddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,8 @@ * src/keybindings.c, src/keybindings.h: Add shortcuts for Find Previous, Go to line + * src/keybindings.c: + Set shortcut for Replace and split keybindings_init code 2006-05-23 Nick Treleaven diff --git a/src/keybindings.c b/src/keybindings.c index 6043ad8a..0ec69727 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -84,13 +84,8 @@ static void cb_func_edit_calltip(void); static void cb_func_edit_macrolist(void); static void cb_func_edit_suppresscompletion(void); +void keybindings_add_accels(); -#define GEANY_ADD_ACCEL(gkey, wid) \ - if (keys[(gkey)]->key != 0) \ - gtk_widget_add_accelerator( \ - lookup_widget(app->window, G_STRINGIFY(wid)), \ - "activate", accel_group, keys[(gkey)]->key, keys[(gkey)]->mods, \ - GTK_ACCEL_VISIBLE); void keybindings_init(void) { @@ -100,7 +95,6 @@ void keybindings_init(void) guint key; GdkModifierType mods; GKeyFile *config = g_key_file_new(); - GtkAccelGroup *accel_group = gtk_accel_group_new(); // init all fields of keys with default values keys[GEANY_KEYS_MENU_NEW] = fill(cb_func_menu_new, GDK_n, GDK_CONTROL_MASK, "menu_new"); @@ -160,6 +154,23 @@ void keybindings_init(void) } } + g_free(configfile); + g_key_file_free(config); + + keybindings_add_accels(); +} + + +#define GEANY_ADD_ACCEL(gkey, wid) \ + if (keys[(gkey)]->key != 0) \ + gtk_widget_add_accelerator( \ + lookup_widget(app->window, G_STRINGIFY(wid)), \ + "activate", accel_group, keys[(gkey)]->key, keys[(gkey)]->mods, \ + GTK_ACCEL_VISIBLE); + +void keybindings_add_accels() +{ + GtkAccelGroup *accel_group = gtk_accel_group_new(); // apply the settings if (keys[GEANY_KEYS_MENU_SAVEALL]->key != 0) @@ -183,6 +194,7 @@ void keybindings_init(void) keys[GEANY_KEYS_MENU_FIND_NEXT]->key, keys[GEANY_KEYS_MENU_FIND_NEXT]->mods, GTK_ACCEL_VISIBLE); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_FINDPREVIOUS, find_previous1) + GEANY_ADD_ACCEL(GEANY_KEYS_MENU_REPLACE, replace1) GEANY_ADD_ACCEL(GEANY_KEYS_MENU_GOTOLINE, go_to_line1) if (keys[GEANY_KEYS_MENU_FULLSCREEN]->key != 0) @@ -216,9 +228,6 @@ void keybindings_init(void) // the build menu items are set if the build menus are created gtk_window_add_accel_group(GTK_WINDOW(app->window), accel_group); - - g_free(configfile); - g_key_file_free(config); }