Hidden GMenuItem SECTION

HI

Is it possible to hide a MenuItem type section?

If I create a GMenuItem of type item or submenu I can add the attribute “hidden-when” to hide it

GMenuItem * menu_item = g_menu_item_new_submenu("submenu", G_MENU_MODEL(menu_x));
g_menu_item_set_detailed_action(menu_item, "my.action");
g_menu_item_set_attribute(menu_item, "hidden-when", "s", "action-disabled");

or

GMenuItem * menu_item = g_menu_item_new ("menu_item", NULL);
g_menu_item_set_detailed_action(menu_item, "my.action");
g_menu_item_set_attribute(menu_item, "hidden-when", "s", "action-disabled");

and when I enable/disable the action (my.action) the item is hidden.

but it doesn’t hide when I create a "g_menu_item_new_section"

GMenu * menu = g_menu_new();
g_menu_append (menu, "menu item 1", NULL);
g_menu_append (menu, "menu item 2", NULL);

GMenuItem * menu_item = g_menu_item_new_section ("My section", G_MENU_MODEL(menu));
g_menu_item_set_detailed_action(menu_item, "my.action");
g_menu_item_set_attribute(menu_item, "hidden-when", "s", "action-disabled");

Any idea how to hide a section?
Otherwise I have to apply the “hidden-when” attribute to each item within the section.

Thanks

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.