window: bind properties in UI file
This is possible, and allows us to clean up constructed a bit.
This commit is contained in:
parent
f49ef9b2d9
commit
f621fedbba
2 changed files with 2 additions and 13 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkHeaderBar" id="headerbar">
|
<object class="GtkHeaderBar" id="headerbar">
|
||||||
<property name="css-classes">titlebar</property>
|
<property name="css-classes">titlebar</property>
|
||||||
|
<property name="visible" bind-source="IvWindow" bind-property="fullscreened" bind-flags="sync-create|invert-boolean"/>
|
||||||
<child type="end">
|
<child type="end">
|
||||||
<object class="GtkMenuButton" id="menu_button">
|
<object class="GtkMenuButton" id="menu_button">
|
||||||
<property name="icon-name">open-menu-symbolic</property>
|
<property name="icon-name">open-menu-symbolic</property>
|
||||||
|
|
@ -40,6 +41,7 @@
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="IvImageView" id="image_view">
|
<object class="IvImageView" id="image_view">
|
||||||
|
<property name="header-visible" bind-source="IvWindow" bind-property="fullscreened" bind-flags="sync-create"/>
|
||||||
<property name="primary-menu-model">primary_menu</property>
|
<property name="primary-menu-model">primary_menu</property>
|
||||||
<property name="popover-menu-model">image_menu</property>
|
<property name="popover-menu-model">image_menu</property>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
||||||
|
|
@ -114,19 +114,6 @@ mod imp {
|
||||||
.connect_released(clone!(@weak obj => move |_, _, _, _| {
|
.connect_released(clone!(@weak obj => move |_, _, _, _| {
|
||||||
obj.pick_file();
|
obj.pick_file();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
obj.bind_property("fullscreened", &*self.image_view, "header-visible")
|
|
||||||
.flags(glib::BindingFlags::SYNC_CREATE | glib::BindingFlags::BIDIRECTIONAL)
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
obj.bind_property("fullscreened", &*self.headerbar, "visible")
|
|
||||||
.flags(
|
|
||||||
glib::BindingFlags::SYNC_CREATE
|
|
||||||
| glib::BindingFlags::BIDIRECTIONAL
|
|
||||||
| glib::BindingFlags::INVERT_BOOLEAN,
|
|
||||||
)
|
|
||||||
.build()
|
|
||||||
.unwrap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue