display: Use CcPanel.navigation instead of own navigation view

This commit is contained in:
Felipe Borges 2024-04-24 11:48:42 +02:00
parent d366789bfe
commit 8efbae3c8f
2 changed files with 264 additions and 274 deletions

View file

@ -100,7 +100,6 @@ struct _CcDisplayPanel
AdwBin *display_settings_bin;
GtkWidget *display_settings_group;
AdwNavigationPage *display_settings_page;
AdwNavigationView *nav_view;
AdwComboRow *primary_display_row;
AdwPreferencesGroup *single_display_settings_group;
@ -610,7 +609,6 @@ cc_display_panel_class_init (CcDisplayPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, display_settings_group);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, display_settings_page);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, escape_shortcut);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, nav_view);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_page);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, night_light_row);
gtk_widget_class_bind_template_child (widget_class, CcDisplayPanel, primary_display_row);
@ -662,7 +660,7 @@ on_monitor_row_activated_cb (CcDisplayPanel *self,
monitor = g_object_get_data (G_OBJECT (row), "monitor");
set_current_output (self, monitor, FALSE);
adw_navigation_view_push (self->nav_view, self->display_settings_page);
cc_panel_push_subpage (CC_PANEL (self), self->display_settings_page);
}
static void
@ -975,7 +973,7 @@ apply_current_configuration (CcDisplayPanel *self)
if (error)
g_warning ("Error applying configuration: %s", error->message);
adw_navigation_view_pop (self->nav_view);
cc_panel_pop_visible_subpage (CC_PANEL (self));
}
static void
@ -989,7 +987,7 @@ cancel_current_configuration (CcDisplayPanel *panel)
/* Closes the potentially open monitor page. */
if (selected == CC_DISPLAY_CONFIG_JOIN && cc_display_config_is_cloning (current))
adw_navigation_view_pop (panel->nav_view);
cc_panel_pop_visible_subpage (CC_PANEL (panel));
on_screen_changed (panel);
}

View file

@ -14,299 +14,291 @@
</object>
</child>
<property name="child">
<object class="AdwNavigationView" id="nav_view">
<child>
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Displays</property>
<property name="child">
<object class="AdwToolbarView">
<!-- Displays page -->
<child>
<object class="AdwNavigationPage">
<property name="title" translatable="yes">Displays</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar" id="apply_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton" id="cancel_button">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle" id="apply_titlebar_title_widget" />
</property>
<child type="end">
<object class="GtkButton" id="apply_button">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<style>
<class name="suggested-action" />
</style>
</object>
</child>
<child type="top">
<object class="AdwHeaderBar" id="apply_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton" id="cancel_button">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<!-- Displays page titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="displays_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<property name="content">
<object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup" id="display_settings_disabled_group">
<property name="visible">False</property>
<child>
<object class="AdwStatusPage">
<property name="vexpand">True</property>
<property name="icon-name">computer-symbolic</property>
<property name="title" translatable="yes">Display Settings Disabled</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="display_multiple_displays">
<!-- Config Type -->
<child>
<object class="AdwActionRow" id="config_type_switcher_row">
<property name="title" translatable="yes">Multiple Displays</property>
<child type="suffix">
<object class="GtkBox">
<property name="valign">center</property>
<style>
<class name="linked" />
</style>
<child>
<object class="GtkToggleButton" id="config_type_join">
<property name="label" translatable="yes" comments="'Join' as in 'Join displays'">_Join</property>
<property name="use-underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="on_config_type_toggled_cb" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToggleButton" id="config_type_mirror">
<property name="label" translatable="yes">_Mirror</property>
<property name="use-underline">True</property>
<property name="group">config_type_join</property>
<signal name="toggled" handler="on_config_type_toggled_cb" swapped="yes"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="display_settings_group">
<!-- Display Arrangement -->
<child>
<object class="AdwPreferencesRow" id="arrangement_row">
<property name="activatable">False</property>
<child>
<object class="AdwBin" id="arrangement_bin">
</object>
</child>
</object>
</child>
<!-- Primary Display -->
<child>
<object class="AdwComboRow" id="primary_display_row">
<property name="subtitle" translatable="yes">Contains top bar and Activities</property>
<property name="title" translatable="yes">_Primary Display</property>
<property name="use-underline">True</property>
<signal name="notify::selected-item" handler="on_primary_display_selected_item_changed_cb" swapped="yes"/>
</object>
</child>
</object>
</child>
<!-- Single Display Settings -->
<child>
<object class="AdwPreferencesGroup" id="single_display_settings_group">
<property name="visible">False</property>
</object>
</child>
<!-- Night Light -->
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="CcListRow" id="night_light_row">
<property name="title" translatable="yes" comments="This is the redshift functionality where we suppress blue light when the sun has gone down">_Night Light</property>
<property name="icon-name">night-light-symbolic</property>
<property name="show-arrow">True</property>
<property name="action-name">navigation.push</property>
<property name="action-target">'night-light'</property>
</object>
</child>
</object>
</child>
</object>
<property name="title-widget">
<object class="AdwWindowTitle" id="apply_titlebar_title_widget" />
</property>
</object>
</property>
</object>
</child>
<!-- Night Light page -->
<child>
<object class="AdwNavigationPage">
<property name="tag">night-light</property>
<property name="title" translatable="yes">Night Light</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="title" bind-source="apply_titlebar_title_widget" bind-property="title" bind-flags="sync-create"/>
<property name="subtitle" bind-source="apply_titlebar_title_widget" bind-property="subtitle" bind-flags="sync-create"/>
</object>
</property>
<child type="end">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<property name="sensitive" bind-source="apply_button" bind-property="sensitive" bind-flags="sync-create"/>
<style>
<class name="suggested-action" />
</style>
</object>
</child>
<child type="end">
<object class="GtkButton" id="apply_button">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<style>
<class name="suggested-action" />
</style>
</object>
</child>
<!-- Night Light titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="night_light_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<!-- Displays page titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="displays_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<property name="content">
<object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup" id="display_settings_disabled_group">
<property name="visible">False</property>
<child>
<object class="AdwStatusPage">
<property name="vexpand">True</property>
<property name="icon-name">computer-symbolic</property>
<property name="title" translatable="yes">Display Settings Disabled</property>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="display_multiple_displays">
<!-- Config Type -->
<child>
<object class="AdwActionRow" id="config_type_switcher_row">
<property name="title" translatable="yes">Multiple Displays</property>
<child type="suffix">
<object class="GtkBox">
<property name="valign">center</property>
<style>
<class name="linked" />
</style>
<child>
<object class="GtkToggleButton" id="config_type_join">
<property name="label" translatable="yes" comments="'Join' as in 'Join displays'">_Join</property>
<property name="use-underline">True</property>
<property name="active">True</property>
<signal name="toggled" handler="on_config_type_toggled_cb" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToggleButton" id="config_type_mirror">
<property name="label" translatable="yes">_Mirror</property>
<property name="use-underline">True</property>
<property name="group">config_type_join</property>
<signal name="toggled" handler="on_config_type_toggled_cb" swapped="yes"/>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="AdwPreferencesGroup" id="display_settings_group">
<!-- Display Arrangement -->
<child>
<object class="AdwPreferencesRow" id="arrangement_row">
<property name="activatable">False</property>
<child>
<object class="AdwBin" id="arrangement_bin">
</object>
</child>
</object>
</child>
<!-- Primary Display -->
<child>
<object class="AdwComboRow" id="primary_display_row">
<property name="subtitle" translatable="yes">Contains top bar and Activities</property>
<property name="title" translatable="yes">_Primary Display</property>
<property name="use-underline">True</property>
<signal name="notify::selected-item" handler="on_primary_display_selected_item_changed_cb" swapped="yes"/>
</object>
</child>
</object>
</child>
<!-- Single Display Settings -->
<child>
<object class="AdwPreferencesGroup" id="single_display_settings_group">
<property name="visible">False</property>
</object>
</child>
<!-- Night Light -->
<property name="content">
<object class="CcNightLightPage" id="night_light_page" />
</property>
</object>
</property>
</object>
</child>
<!-- Display Settings page -->
<child>
<object class="AdwNavigationPage" id="display_settings_page">
<property name="tag">display-settings</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="title" bind-source="apply_titlebar_title_widget" bind-property="title" bind-flags="sync-create"/>
<property name="subtitle" bind-source="apply_titlebar_title_widget" bind-property="subtitle" bind-flags="sync-create"/>
</object>
</property>
<child type="end">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<property name="sensitive" bind-source="apply_button" bind-property="sensitive" bind-flags="sync-create"/>
<style>
<class name="suggested-action" />
</style>
</object>
</child>
</object>
</child>
<!-- Display Settings titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="display_settings_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<!-- Display Settings -->
<property name="content">
<object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwBin" id="display_settings_bin" />
</child>
<object class="CcListRow" id="night_light_row">
<property name="title" translatable="yes" comments="This is the redshift functionality where we suppress blue light when the sun has gone down">_Night Light</property>
<property name="icon-name">night-light-symbolic</property>
<property name="show-arrow">True</property>
<property name="action-name">navigation.push</property>
<property name="action-target">'night-light'</property>
</object>
</child>
</object>
</property>
</child>
</object>
</property>
</object>
</child>
</property>
</object>
</property>
</child>
<!-- Night Light page -->
<child>
<object class="AdwNavigationPage">
<property name="tag">night-light</property>
<property name="title" translatable="yes">Night Light</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="title" bind-source="apply_titlebar_title_widget" bind-property="title" bind-flags="sync-create"/>
<property name="subtitle" bind-source="apply_titlebar_title_widget" bind-property="subtitle" bind-flags="sync-create"/>
</object>
</property>
<child type="end">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<property name="sensitive" bind-source="apply_button" bind-property="sensitive" bind-flags="sync-create"/>
<style>
<class name="suggested-action" />
</style>
</object>
</child>
</object>
</child>
<!-- Night Light titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="night_light_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<!-- Night Light -->
<property name="content">
<object class="CcNightLightPage" id="night_light_page" />
</property>
</object>
</property>
</object>
</child>
<!-- Display Settings page -->
<child>
<object class="AdwNavigationPage" id="display_settings_page">
<property name="tag">display-settings</property>
<property name="child">
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create"/>
<property name="show-start-title-buttons">False</property>
<property name="show-end-title-buttons">False</property>
<child type="start">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Cancel</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="cancel_current_configuration" object="CcDisplayPanel" swapped="yes" />
</object>
</child>
<property name="title-widget">
<object class="AdwWindowTitle">
<property name="title" bind-source="apply_titlebar_title_widget" bind-property="title" bind-flags="sync-create"/>
<property name="subtitle" bind-source="apply_titlebar_title_widget" bind-property="subtitle" bind-flags="sync-create"/>
</object>
</property>
<child type="end">
<object class="GtkButton">
<property name="use-underline">True</property>
<property name="label" translatable="yes">_Apply</property>
<property name="can-shrink">True</property>
<signal name="clicked" handler="apply_current_configuration" object="CcDisplayPanel" swapped="yes" />
<property name="sensitive" bind-source="apply_button" bind-property="sensitive" bind-flags="sync-create"/>
<style>
<class name="suggested-action" />
</style>
</object>
</child>
</object>
</child>
<!-- Display Settings titlebar -->
<child type="top">
<object class="AdwHeaderBar" id="display_settings_titlebar">
<property name="visible" bind-source="CcDisplayPanel" bind-property="showing-apply-titlebar" bind-flags="sync-create|invert-boolean"/>
</object>
</child>
<!-- Display Settings -->
<property name="content">
<object class="AdwPreferencesPage">
<child>
<object class="AdwPreferencesGroup">
<child>
<object class="AdwBin" id="display_settings_bin" />
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</child>
</template>
<object class="GtkSizeGroup">