Skip to content

Commit f6a4d4a

Browse files
committed
[gtk] OptionsMenuButton: Use "prefix.name" instead of "prefix-name" for G_MENU_MODEL.
"prefix-name" worked before, but some GLib update seems to have broken it, resulting in all the menu options being disabled. Changing it to "prefix.name" fixes the problem. TODO: Figure out which GLib update broke this?
1 parent 5340785 commit f6a4d4a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
* Windows: Fix Windows XP compatibility.
3434
* Fixes #487: Installer fails on Windows XP
3535
* Reported by @ccawley2011.
36+
* GTK: Fix the Options menu when using G_MENU_MODEL. (GTK3/GTK4)
37+
* All menu options were disabled for some reason.
38+
* This broke with a "recent" GLib update. (Not sure which...)
3639

3740
* Other changes:
3841
* Swizzling "bgra" (red/blue swap only) is now faster on systems that

src/gtk/OptionsMenuButton.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ rp_options_menu_button_reinit_menu(RpOptionsMenuButton *widget,
556556

557557
// Create the menu item.
558558
g_menu_append(menuStdActs, pgettext_expr("RomDataView|Options", p.desc),
559-
fmt::format(FSTR("{:s}-{:d}"), s_prefix, p.id).c_str());
559+
fmt::format(FSTR("{:s}.{:d}"), s_prefix, p.id).c_str());
560560
}
561561

562562
/** ROM operations. **/
@@ -580,7 +580,7 @@ rp_options_menu_button_reinit_menu(RpOptionsMenuButton *widget,
580580
// Create the menu item.
581581
const string desc = convert_accel_to_gtk(op.desc);
582582
g_menu_append(menuRomOps, desc.c_str(),
583-
fmt::format(FSTR("{:s}-{:d}"), s_prefix, i).c_str());
583+
fmt::format(FSTR("{:s}.{:d}"), s_prefix, i).c_str());
584584

585585
// Next operation.
586586
i++;
@@ -689,7 +689,7 @@ rp_options_menu_button_update_op(RpOptionsMenuButton *widget,
689689
const string desc = convert_accel_to_gtk(op->desc);
690690
g_simple_action_set_enabled(action, !!(op->flags & RomData::RomOp::ROF_ENABLED));
691691
g_menu_insert(widget->menuRomOps, id, desc.c_str(),
692-
fmt::format(FSTR("{:p}-{:d}"), static_cast<void*>(widget), id).c_str());
692+
fmt::format(FSTR("{:p}.{:d}"), static_cast<void*>(widget), id).c_str());
693693
#else /* !USE_G_MENU_MODEL */
694694
GtkMenuItem *menuItem = nullptr;
695695
GList *l = gtk_container_get_children(GTK_CONTAINER(widget->menuOptions));

0 commit comments

Comments
 (0)