Revision: 362 Author: ntrel Date: 2006-05-24 09:56:14 -0700 (Wed, 24 May 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=362&view=rev
Log Message: ----------- Set shortcut for Replace and split keybindings_init code
Modified Paths: -------------- trunk/ChangeLog trunk/src/keybindings.c Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-05-24 13:18:42 UTC (rev 361) +++ trunk/ChangeLog 2006-05-24 16:56:14 UTC (rev 362) @@ -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
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2006-05-24 13:18:42 UTC (rev 361) +++ trunk/src/keybindings.c 2006-05-24 16:56:14 UTC (rev 362) @@ -84,13 +84,8 @@ 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 @@ 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,7 +154,24 @@ } }
+ 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) gtk_widget_add_accelerator(lookup_widget(app->window, "menu_save_all1"), "activate", accel_group, @@ -183,6 +194,7 @@ 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 @@ // 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); }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.