@@ -973,20 +973,20 @@ def _create_menu(self, sections):
973973 else :
974974 if cb_data is not None :
975975 cb_data = GLib .Variant .new_string (cb_data )
976- accel = accel .replace ('_' , '-' )
976+ gtk_compliant_accel = accel .replace ('_' , '-' )
977977 if cb is not None :
978- action = Gio .SimpleAction .new (accel , cb_data and cb_data .get_type ())
978+ cb_data_type = cb_data and cb_data .get_type ()
979+ action = Gio .SimpleAction .new (gtk_compliant_accel , cb_data_type )
979980 action .connect ('activate' , cb )
980981 self .add_action (action )
981982 item = Gio .MenuItem .new (label )
982- item .set_action_and_target_value ('win.' + accel , cb_data )
983+ item .set_action_and_target_value ('win.' + gtk_compliant_accel , cb_data )
983984 key_binding = theResources .getKeyBindings ('menu' , accel )
984985 if len (key_binding ) > 0 :
985- key , modifier = key_binding [0 ]
986- self .get_application ().set_accels_for_action (
987- Gio .Action .print_detailed_name ('win.' + accel , cb_data ),
988- [Gtk .accelerator_name (key , modifier )],
989- )
986+ action_name = 'win.' + gtk_compliant_accel
987+ detailed_action_name = Gio .Action .print_detailed_name (action_name , cb_data )
988+ accels = [Gtk .accelerator_name (* key_binding [0 ])]
989+ self .get_application ().set_accels_for_action (detailed_action_name , accels )
990990 section_menu .append_item (item )
991991 menu .append_section (None , section_menu )
992992 return menu
0 commit comments