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:
parent
3223eca450
commit
a009c2b48e
@ -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>
|
2011-04-02 Colomban Wendling <colomban(at)geany(dot)org>
|
||||||
|
|
||||||
* src/tools.c, doc/geany.txt, doc/geany.html:
|
* src/tools.c, doc/geany.txt, doc/geany.html:
|
||||||
|
@ -1038,7 +1038,6 @@ gint main(gint argc, gchar **argv)
|
|||||||
ui_create_insert_menu_items();
|
ui_create_insert_menu_items();
|
||||||
ui_create_insert_date_menu_items();
|
ui_create_insert_date_menu_items();
|
||||||
keybindings_init();
|
keybindings_init();
|
||||||
tools_create_insert_custom_command_menu_items();
|
|
||||||
notebook_init();
|
notebook_init();
|
||||||
filetypes_init();
|
filetypes_init();
|
||||||
templates_init();
|
templates_init();
|
||||||
@ -1088,6 +1087,10 @@ gint main(gint argc, gchar **argv)
|
|||||||
/* load keybinding settings after plugins have added their groups */
|
/* load keybinding settings after plugins have added their groups */
|
||||||
keybindings_load_keyfile();
|
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 */
|
/* load any command line files or session files */
|
||||||
main_status.opening_session_files = TRUE;
|
main_status.opening_session_files = TRUE;
|
||||||
load_startup_files(argc, argv);
|
load_startup_files(argc, argv);
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "templates.h"
|
#include "templates.h"
|
||||||
#include "search.h"
|
#include "search.h"
|
||||||
#include "toolbar.h"
|
#include "toolbar.h"
|
||||||
|
#include "tools.h"
|
||||||
#include "stash.h"
|
#include "stash.h"
|
||||||
#include "keyfile.h"
|
#include "keyfile.h"
|
||||||
#include "filetypes.h"
|
#include "filetypes.h"
|
||||||
@ -1120,6 +1121,7 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
|||||||
if (edited)
|
if (edited)
|
||||||
{
|
{
|
||||||
kb_update();
|
kb_update();
|
||||||
|
tools_create_insert_custom_command_menu_items();
|
||||||
keybindings_write_to_file();
|
keybindings_write_to_file();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1342,7 +1344,7 @@ static gboolean kb_grab_key_dialog_key_press_cb(GtkWidget *dialog, GdkEventKey *
|
|||||||
gchar *str;
|
gchar *str;
|
||||||
gint state;
|
gint state;
|
||||||
|
|
||||||
state = event->state & gtk_accelerator_get_default_mod_mask();
|
state = event->state & gtk_accelerator_get_default_mod_mask();
|
||||||
|
|
||||||
if (event->keyval == GDK_Escape)
|
if (event->keyval == GDK_Escape)
|
||||||
return FALSE; /* close the dialog, don't allow escape when detecting keybindings. */
|
return FALSE; /* close the dialog, don't allow escape when detecting keybindings. */
|
||||||
|
@ -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;
|
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);
|
item = gtk_menu_item_new_with_label(label);
|
||||||
if (key_idx != -1)
|
if (key_idx != -1)
|
||||||
|
{
|
||||||
|
kb = keybindings_lookup_item(GEANY_KEY_GROUP_FORMAT, key_idx);
|
||||||
gtk_widget_add_accelerator(item, "activate", gtk_accel_group_new(),
|
gtk_widget_add_accelerator(item, "activate", gtk_accel_group_new(),
|
||||||
kb->key, kb->mods, GTK_ACCEL_VISIBLE);
|
kb->key, kb->mods, GTK_ACCEL_VISIBLE);
|
||||||
|
}
|
||||||
gtk_container_add(GTK_CONTAINER(me), item);
|
gtk_container_add(GTK_CONTAINER(me), item);
|
||||||
gtk_widget_show(item);
|
gtk_widget_show(item);
|
||||||
g_signal_connect(item, "activate", G_CALLBACK(cc_on_custom_command_activate),
|
g_signal_connect(item, "activate", G_CALLBACK(cc_on_custom_command_activate),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user