shell, cc-panel: Add CcPanel.get_visible_subpage () method

So that hub panels can dynamically query what's been shown, since they
lost control over the navigation directly.

This is useful in Privacy, for example, where we check for the current
visible subpage to decide which documentation page to show.
This commit is contained in:
Felipe Borges 2024-04-24 11:11:11 +02:00
parent 12b93138e0
commit ae00f58136
2 changed files with 13 additions and 0 deletions

View file

@ -307,3 +307,13 @@ cc_panel_push_subpage (CcPanel *panel,
adw_navigation_view_push (priv->navigation, subpage);
}
AdwNavigationPage *
cc_panel_get_visible_subpage (CcPanel *panel)
{
CcPanelPrivate *priv = cc_panel_get_instance_private (panel);
g_return_val_if_fail (CC_IS_PANEL (panel), NULL);
return adw_navigation_view_get_visible_page (priv->navigation);
}

View file

@ -92,4 +92,7 @@ void cc_panel_deactivate (CcPanel *panel);
void cc_panel_push_subpage (CcPanel *panel,
AdwNavigationPage *subpage);
AdwNavigationPage *cc_panel_get_visible_subpage (CcPanel *panel);
G_END_DECLS