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> </closure>
</binding> </binding>
<property name="content"> <property name="content">
<object class="AdwFlap" id="flap"> <object class="GtkBox">
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="fold-policy">never</property> <child>
<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">
<object class="GtkHeaderBar" id="headerbar"> <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"> <child type="start">
<object class="GtkButton"> <object class="GtkButton">
<property name="icon-name">edit-copy-symbolic</property> <property name="icon-name">edit-copy-symbolic</property>
@ -138,8 +127,8 @@
</object> </object>
</child> </child>
</object> </object>
</property> </child>
<property name="content"> <child>
<object class="AdwToastOverlay" id="toast_overlay"> <object class="AdwToastOverlay" id="toast_overlay">
<property name="child"> <property name="child">
<object class="AdwFlap" id="properties_flap"> <object class="AdwFlap" id="properties_flap">
@ -197,10 +186,7 @@
</object> </object>
</property> </property>
</object> </object>
</property> </child>
<style>
<class name="fullscreen-widget"/>
</style>
</object> </object>
</property> </property>
<child> <child>

View file

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

View file

@ -68,8 +68,6 @@ mod imp {
// TemplateChild<T> wrapper, where T is the // TemplateChild<T> wrapper, where T is the
// object type of the template child. // object type of the template child.
#[template_child] #[template_child]
pub(super) flap: TemplateChild<adw::Flap>,
#[template_child]
pub(super) headerbar: TemplateChild<gtk::HeaderBar>, pub(super) headerbar: TemplateChild<gtk::HeaderBar>,
#[template_child] #[template_child]
pub(super) properties_button: TemplateChild<gtk::ToggleButton>, 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] #[template_callback]
fn on_motion_cb(&self) { fn on_motion_cb(&self) {
let controller = &self.imp().motion_controller; let controller = &self.imp().motion_controller;