Fix loading and updating menu accelerators for custom commands

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5679 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Colomban Wendling 2011-04-03 15:53:48 +00:00
parent 3223eca450
commit a009c2b48e
4 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2011-04-03 Colomban Wendling <colomban(at)geany(dot)org>
* src/main.c, src/prefs.c, src/tools.c:
Fix loading and updating menu accelerators for custom commands.
2011-04-02 Colomban Wendling <colomban(at)geany(dot)org>
* src/tools.c, doc/geany.txt, doc/geany.html:

View File

@ -1038,7 +1038,6 @@ gint main(gint argc, gchar **argv)
ui_create_insert_menu_items();
ui_create_insert_date_menu_items();
keybindings_init();
tools_create_insert_custom_command_menu_items();
notebook_init();
filetypes_init();
templates_init();
@ -1088,6 +1087,10 @@ gint main(gint argc, gchar **argv)
/* load keybinding settings after plugins have added their groups */
keybindings_load_keyfile();
/* create the custom command menu after the keybindings have been loaded to have the proper
* accelerator shown for the menu items */
tools_create_insert_custom_command_menu_items();
/* load any command line files or session files */
main_status.opening_session_files = TRUE;
load_startup_files(argc, argv);

View File

@ -59,6 +59,7 @@
#include "templates.h"
#include "search.h"
#include "toolbar.h"
#include "tools.h"
#include "stash.h"
#include "keyfile.h"
#include "filetypes.h"
@ -1120,6 +1121,7 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
if (edited)
{
kb_update();
tools_create_insert_custom_command_menu_items();
keybindings_write_to_file();
}

View File

@ -660,13 +660,13 @@ static void cc_insert_custom_command_items(GtkMenu *me, gchar *label, gint idx)
case 2: key_idx = GEANY_KEYS_FORMAT_SENDTOCMD3; break;
}
if (key_idx != -1)
kb = keybindings_lookup_item(GEANY_KEY_GROUP_FORMAT, key_idx);
item = gtk_menu_item_new_with_label(label);
if (key_idx != -1)
{
kb = keybindings_lookup_item(GEANY_KEY_GROUP_FORMAT, key_idx);
gtk_widget_add_accelerator(item, "activate", gtk_accel_group_new(),
kb->key, kb->mods, GTK_ACCEL_VISIBLE);
}
gtk_container_add(GTK_CONTAINER(me), item);
gtk_widget_show(item);
g_signal_connect(item, "activate", G_CALLBACK(cc_on_custom_command_activate),