menutrackeritem: Be more careful with accel changes

In some cases (such as when getting a new parent), the
action muxer doesn't know exactly which detailed actions
have changed accels, so we call primary_accel_changed with
just an action name.

Make the menu tracker item handle that case by matching
either against the detailed name or the the action name.
This commit is contained in:
Matthias Clasen 2021-06-17 08:42:03 -04:00
parent 15c65595b8
commit db93090ea8

View File

@ -463,8 +463,12 @@ gtk_menu_tracker_item_primary_accel_changed (GtkActionObserver *observer,
const char *action_and_target)
{
GtkMenuTrackerItem *self = GTK_MENU_TRACKER_ITEM (observer);
const char *action;
if (g_str_equal (action_and_target, self->action_and_target))
action = strrchr (self->action_and_target, '|') + 1;
if ((action_and_target && g_str_equal (action_and_target, self->action_and_target)) ||
(action_name && g_str_equal (action_name, action)))
g_object_notify_by_pspec (G_OBJECT (self), gtk_menu_tracker_item_pspecs[PROP_ACCEL]);
}