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
This commit is contained in:
Nick Treleaven 2006-05-24 16:56:14 +00:00
parent 764f99c131
commit ecc808190f
2 changed files with 21 additions and 10 deletions

View File

@ -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 <nick.treleaven@btinternet.com>

View File

@ -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);
}