gtk can have *only* a single accelerator group attached or it goes bang

svn path=/trunk/netsurf/; revision=11598
This commit is contained in:
Vincent Sanders 2011-02-01 23:11:29 +00:00
parent ad69ae0923
commit 726881c2ad
3 changed files with 13 additions and 16 deletions

View File

@ -449,9 +449,9 @@ static struct nsgtk_help_menu *nsgtk_menu_help_submenu(GtkAccelGroup *group)
*
* Generate the main menu structure and attach it to a menubar widget.
*/
struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkWindow *window)
struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkAccelGroup *group)
{
GtkAccelGroup *group;
;
struct nsgtk_bar_submenu *nmenu;
nmenu = malloc(sizeof(struct nsgtk_bar_submenu));
@ -462,9 +462,6 @@ struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkWindow
nmenu->bar_menu = GTK_MENU_BAR(menubar);
group = gtk_accel_group_new();
gtk_window_add_accel_group(window, group);
nmenu->file_submenu = nsgtk_menu_file_submenu(group);
ATTACH_PARENT(menubar, gtkFile, nmenu->file_submenu->file, group);
@ -487,9 +484,8 @@ struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkWindow
* Generate right click menu menu.
*
*/
struct nsgtk_popup_submenu *nsgtk_menu_popup_create(GtkWindow *window)
struct nsgtk_popup_submenu *nsgtk_menu_popup_create(GtkAccelGroup *group)
{
GtkAccelGroup *group;
struct nsgtk_popup_submenu *nmenu;
nmenu = malloc(sizeof(struct nsgtk_popup_submenu));
@ -498,9 +494,6 @@ struct nsgtk_popup_submenu *nsgtk_menu_popup_create(GtkWindow *window)
return NULL;
}
group = gtk_accel_group_new();
gtk_window_add_accel_group(window, group);
nmenu->popup_menu = GTK_MENU(gtk_menu_new());
IMAGE_ITEM(popup, file, gtkFile, nmenu, group);

View File

@ -189,7 +189,7 @@ struct nsgtk_popup_submenu {
};
struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkWindow *window);
struct nsgtk_popup_submenu *nsgtk_menu_popup_create(GtkWindow *window);
struct nsgtk_bar_submenu *nsgtk_menu_bar_create(GtkMenuShell *menubar, GtkAccelGroup *group);
struct nsgtk_popup_submenu *nsgtk_menu_popup_create(GtkAccelGroup *group);
#endif

View File

@ -1563,11 +1563,11 @@ static void nsgtk_attach_menu_handlers(struct gtk_scaffolding *g)
* \param g scaffoliding to attach popup menu to.
* \return true on success or false on error.
*/
static bool nsgtk_new_scaffolding_popup(struct gtk_scaffolding *g)
static bool nsgtk_new_scaffolding_popup(struct gtk_scaffolding *g, GtkAccelGroup *group)
{
struct nsgtk_popup_submenu *nmenu;
nmenu = nsgtk_menu_popup_create(g->window);
nmenu = nsgtk_menu_popup_create(group);
if (nmenu == NULL)
return false;
@ -1610,6 +1610,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
struct gtk_scaffolding *g = malloc(sizeof(*g));
char *searchname;
int i;
GtkAccelGroup *group;
if (g == NULL) {
warn_user("NoMemory", 0);
@ -1677,7 +1678,10 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
nsgtk_toolbar_customization_load(g);
nsgtk_toolbar_set_physical(g);
g->menu_bar = nsgtk_menu_bar_create(GTK_MENU_SHELL(glade_xml_get_widget(g->xml, "menubar")), g->window);
group = gtk_accel_group_new();
gtk_window_add_accel_group(g->window, group);
g->menu_bar = nsgtk_menu_bar_create(GTK_MENU_SHELL(glade_xml_get_widget(g->xml, "menubar")), group);
g->preferences_dialog = NULL;
@ -1848,7 +1852,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
nsgtk_window_tool_bar_clicked, g);
/* create popup menu */
nsgtk_new_scaffolding_popup(g);
nsgtk_new_scaffolding_popup(g, group);
/* set up the menu signal handlers */
nsgtk_scaffolding_toolbar_init(g);