window: Bind headerbar opacity to controls

No purpose yet, but will help when we want to implement
fading. Need to have support for closures in Rust first.
This commit is contained in:
Christopher Davis 2021-09-24 05:58:55 -07:00
parent e45b89f854
commit 293dc3c124
3 changed files with 16 additions and 1 deletions

View file

@ -14,7 +14,7 @@
</object>
</child>
<child type="overlay">
<object class="GtkBox">
<object class="GtkBox" id="controls">
<property name="vexpand">True</property>
<child>
<object class="GtkButton" id="prev_button">

View file

@ -15,6 +15,11 @@
<object class="GtkHeaderBar" id="headerbar">
<property name="css-classes">titlebar</property>
<property name="show_title_buttons" bind-source="IvWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
<binding name="opacity">
<lookup type="GtkWidget" name="opacity">
<lookup name="controls">image_view</lookup>
</lookup>
</binding>
<child type="end">
<object class="GtkMenuButton" id="menu_button">
<property name="icon-name">open-menu-symbolic</property>

View file

@ -44,6 +44,8 @@ mod imp {
#[template_child]
pub picture: TemplateChild<gtk::Picture>,
#[template_child]
pub controls: TemplateChild<gtk::Box>,
#[template_child]
pub popover: TemplateChild<gtk::PopoverMenu>,
#[template_child]
pub click_gesture: TemplateChild<gtk::GestureClick>,
@ -103,6 +105,13 @@ mod imp {
None,
glib::ParamFlags::READABLE,
),
glib::ParamSpec::new_object(
"controls",
"Controls",
"The controls for the image view",
gtk::Box::static_type(),
glib::ParamFlags::READABLE,
),
]
});
@ -133,6 +142,7 @@ mod imp {
match psec.name() {
"popover-menu-model" => self.popover_menu_model.borrow().to_value(),
"filename" => self.filename.borrow().to_value(),
"controls" => self.controls.to_value(),
_ => unimplemented!(),
}
}