mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-18 09:00:34 +00:00
gtkmodelmenuitem: don't crash on missing action
This commit is contained in:
parent
8f5e8b2d0b
commit
bac58abec3
@ -238,14 +238,15 @@ gtk_model_menu_item_setup (GtkModelMenuItem *item,
|
|||||||
g_action_observable_register_observer (actions, item->action_name, G_ACTION_OBSERVER (item));
|
g_action_observable_register_observer (actions, item->action_name, G_ACTION_OBSERVER (item));
|
||||||
|
|
||||||
if (g_action_group_query_action (G_ACTION_GROUP (actions), item->action_name, &enabled, &type, NULL, NULL, &state))
|
if (g_action_group_query_action (G_ACTION_GROUP (actions), item->action_name, &enabled, &type, NULL, NULL, &state))
|
||||||
gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state);
|
{
|
||||||
|
gtk_model_menu_item_action_added (G_ACTION_OBSERVER (item), actions, item->action_name, type, enabled, state);
|
||||||
|
if (state != NULL)
|
||||||
|
g_variant_unref (state);
|
||||||
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
|
gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
|
||||||
|
|
||||||
if (state != NULL)
|
|
||||||
g_variant_unref (state);
|
|
||||||
|
|
||||||
path = _gtk_accel_path_for_action (item->action_name, item->target);
|
path = _gtk_accel_path_for_action (item->action_name, item->target);
|
||||||
gtk_menu_item_set_accel_path (GTK_MENU_ITEM (item), path);
|
gtk_menu_item_set_accel_path (GTK_MENU_ITEM (item), path);
|
||||||
g_free (path);
|
g_free (path);
|
||||||
|
Loading…
Reference in New Issue
Block a user