invite_user.ui: Clean up headerbar
Use 'title' property for title, and pack buttons into the headerbar itself.
This commit is contained in:
parent
a75144b2b7
commit
f65a4e3f42
2 changed files with 29 additions and 55 deletions
|
@ -108,60 +108,34 @@
|
|||
</object>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar">
|
||||
<object class="GtkHeaderBar" id="invite_headerbar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child type="title">
|
||||
<object class="GtkBox">
|
||||
<property name="title" translatable="yes">Invite</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_invite">
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel_invite">
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="invite_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="label" translatable="yes">Invite</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="invite_button">
|
||||
<property name="label" translatable="yes">Invite</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="invite_button">
|
||||
<property name="label" translatable="yes">Invite</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack_type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -126,17 +126,17 @@ impl AppOp {
|
|||
let scroll = self.ui.builder
|
||||
.get_object::<gtk::Widget>("user_search_scroll")
|
||||
.expect("Can't find user_search_scroll in ui file.");
|
||||
let title = self.ui.builder
|
||||
.get_object::<gtk::Label>("invite_title")
|
||||
.expect("Can't find invite_title in ui file.");
|
||||
let headerbar = self.ui.builder
|
||||
.get_object::<gtk::HeaderBar>("invite_headerbar")
|
||||
.expect("Can't find invite_headerbar in ui file.");
|
||||
self.search_type = SearchType::Invite;
|
||||
|
||||
if let Some(aroom) = self.active_room.clone() {
|
||||
if let Some(r) = self.rooms.get(&aroom) {
|
||||
if let &Some(ref name) = &r.name {
|
||||
title.set_text(&i18n_k("Invite to {name}", &[("name", name)]));
|
||||
headerbar.set_title(i18n_k("Invite to {name}", &[("name", name)]).as_str());
|
||||
} else {
|
||||
title.set_text(i18n("Invite").as_str());
|
||||
headerbar.set_title(i18n("Invite").as_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue