window: Drop AdwFlap for Headerbar

Redo everything headerbar related with new Adw widgets
when there is a working concept.

Closes #112

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/192>
This commit is contained in:
Sophie Herold 2023-04-20 21:25:58 +02:00 • committed by Marge Bot
parent dab333e510
commit 2dbc7fa585
3 changed files with 7 additions and 35 deletions

View file

@ -67,22 +67,11 @@
</closure>
</binding>
<property name="content">
<object class="AdwFlap" id="flap">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="fold-policy">never</property>
<property name="swipe-to-open">False</property>
<property name="swipe-to-close">False</property>
<property name="locked">true</property>
<property name="modal">false</property>
<binding name="fold-policy">
<closure type="AdwFlapFoldPolicy" function="fold_policy">
<lookup name="fullscreened">LpWindow</lookup>
<lookup type="AdwFlap" name="reveal-flap">properties_flap</lookup>
</closure>
</binding>
<property name="flap">
<child>
<object class="GtkHeaderBar" id="headerbar">
<property name="show_title_buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
<property name="show-title-buttons" bind-source="LpWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
<child type="start">
<object class="GtkButton">
<property name="icon-name">edit-copy-symbolic</property>
@ -138,8 +127,8 @@
</object>
</child>
</object>
</property>
<property name="content">
</child>
<child>
<object class="AdwToastOverlay" id="toast_overlay">
<property name="child">
<object class="AdwFlap" id="properties_flap">
@ -197,10 +186,7 @@
</object>
</property>
</object>
</property>
<style>
<class name="fullscreen-widget"/>
</style>
</child>
</object>
</property>
<child>

View file

@ -4,7 +4,7 @@ button.osd.circular {
min-height: 42px;
}
flap.fullscreen-widget dimming, shadow, border, outline {
shadow, border, outline {
background: none;
}

View file

@ -68,8 +68,6 @@ mod imp {
// TemplateChild<T> wrapper, where T is the
// object type of the template child.
#[template_child]
pub(super) flap: TemplateChild<adw::Flap>,
#[template_child]
pub(super) headerbar: TemplateChild<gtk::HeaderBar>,
#[template_child]
pub(super) properties_button: TemplateChild<gtk::ToggleButton>,
@ -783,18 +781,6 @@ impl LpWindow {
}
}
// We also have a closure that returns `adw::FlapFoldPolicy`.
// if we aren't fullscreened, or if the properties are revealed,
// we unfold the main flap. Otherwise we're always folded.
#[template_callback]
fn fold_policy(&self, fullscreened: bool, properties_revealed: bool) -> adw::FlapFoldPolicy {
if !fullscreened || properties_revealed {
adw::FlapFoldPolicy::Never
} else {
adw::FlapFoldPolicy::Always
}
}
#[template_callback]
fn on_motion_cb(&self) {
let controller = &self.imp().motion_controller;