Browse Source

room-history: Visual fixes to the title

fractal-8
Kévin Commaille 2 years ago
parent
commit
64d514cfc7
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 5
      data/resources/style.css
  2. 2
      po/POTFILES.in
  3. 2
      src/components/mod.rs
  4. 155
      src/components/room_title.ui
  5. 7
      src/session/view/content/explore/mod.rs
  6. 2
      src/session/view/content/explore/mod.ui
  7. 7
      src/session/view/content/invite.rs
  8. 2
      src/session/view/content/invite.ui
  9. 16
      src/session/view/content/mod.rs
  10. 4
      src/session/view/content/mod.ui
  11. 16
      src/session/view/content/room_history/mod.rs
  12. 16
      src/session/view/content/room_history/mod.ui
  13. 120
      src/session/view/content/room_history/title.rs
  14. 155
      src/session/view/content/room_history/title.ui
  15. 9
      src/session/view/session_view.rs
  16. 7
      src/session/view/sidebar/mod.rs
  17. 8
      src/session/view/sidebar/mod.ui
  18. 2
      src/ui-resources.gresource.xml

5
data/resources/style.css

@ -406,6 +406,10 @@ setup-view .text-button {
/* Sidebar */
sidebar .collapse-spacing {
padding: 0;
}
.sidebar-list row {
margin: 0;
padding: 0;
@ -782,6 +786,7 @@ room-title {
margin-top: -6px;
margin-bottom: -6px;
min-height: 12px;
padding: 3px 0;
}
room-title menubutton, room-title menubutton .toggle {

2
po/POTFILES.in

@ -29,7 +29,6 @@ src/components/media/location_viewer.rs
src/components/reaction_chooser.ui
src/components/pill/at_room.rs
src/components/power_level_selection/popover.ui
src/components/room_title.ui
src/components/rows/loading_row.ui
src/components/user_page.rs
src/components/user_page.ui
@ -164,6 +163,7 @@ src/session/view/content/room_history/state_row/creation.ui
src/session/view/content/room_history/state_row/mod.rs
src/session/view/content/room_history/state_row/tombstone.rs
src/session/view/content/room_history/state_row/tombstone.ui
src/session/view/content/room_history/title.ui
src/session/view/content/room_history/typing_row.rs
src/session/view/content/room_history/verification_info_bar.rs
src/session/view/create_dm_dialog/mod.rs

2
src/components/mod.rs

@ -13,7 +13,6 @@ mod pill;
mod power_level_selection;
mod reaction_chooser;
mod role_badge;
mod room_title;
mod rows;
mod scale_revealer;
mod user_page;
@ -33,7 +32,6 @@ pub use self::{
power_level_selection::*,
reaction_chooser::ReactionChooser,
role_badge::RoleBadge,
room_title::RoomTitle,
rows::*,
scale_revealer::ScaleRevealer,
user_page::UserPage,

155
src/components/room_title.ui

@ -1,155 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="RoomTitle" parent="AdwBin">
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkStackPage">
<property name="name">title-only</property>
<property name="child">
<object class="GtkLabel">
<property name="focusable">True</property>
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="width-chars">5</property>
<property name="label" bind-source="RoomTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<property name="tooltip-markup" bind-source="RoomTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<style>
<class name="title"/>
</style>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">button</property>
<property name="child">
<object class="GtkMenuButton">
<style>
<class name="flat"/>
</style>
<property name="tooltip-text" translatable="yes">Click to Expand</property>
<property name="child">
<object class="GtkBox">
<property name="halign">center</property>
<property name="valign">center</property>
<property name="accessible-role">group</property>
<property name="spacing">6</property>
<child>
<!-- Widget to compensate for the arrow on the right for centering the title -->
<object class="AdwBin" id="start_bin">
<property name="halign">start</property>
<property name="accessible-role">presentation</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="accessible-role">group</property>
<child>
<object class="GtkLabel" id="title_excerpt_label">
<property name="focusable">True</property>
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="width-chars">5</property>
<property name="label" bind-source="RoomTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="label" bind-source="RoomTitle" bind-property="subtitle-excerpt" bind-flags="sync-create"/>
<style>
<class name="subtitle"/>
</style>
</object>
</child>
</object>
</child>
<child>
<object class="GtkImage" id="arrow_icon">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="icon-name">expander-arrow-symbolic</property>
<property name="accessible-role">presentation</property>
<style>
<class name="arrow" />
</style>
</object>
</child>
</object>
</property>
<property name="popover">
<object class="GtkPopover">
<property name="has-arrow">False</property>
<property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">True</property>
<property name="propagate-natural-width">True</property>
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">500</property>
<property name="tightening-threshold">500</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="accessible-role">group</property>
<property name="spacing">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkLabel">
<property name="focusable">True</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="use-markup">True</property>
<property name="selectable">True</property>
<property name="label" bind-source="RoomTitle" bind-property="title" bind-flags="sync-create"/>
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="focusable">True</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="use-markup">True</property>
<property name="selectable">True</property>
<property name="label" bind-source="RoomTitle" bind-property="subtitle" bind-flags="sync-create"/>
<style>
<class name="body"/>
</style>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</template>
</interface>

7
src/session/view/content/explore/mod.rs

@ -31,6 +31,8 @@ mod imp {
#[property(get, set = Self::set_session, explicit_notify)]
pub session: glib::WeakRef<Session>,
#[template_child]
pub header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub stack: TemplateChild<gtk::Stack>,
#[template_child]
pub search_entry: TemplateChild<gtk::SearchEntry>,
@ -176,6 +178,11 @@ impl Explore {
self.imp().search_entry.grab_focus();
}
/// The header bar of the explorer.
pub fn header_bar(&self) -> &adw::HeaderBar {
&self.imp().header_bar
}
/// Update the visible child according to the current state.
fn update_visible_child(&self) {
let imp = self.imp();

2
src/session/view/content/explore/mod.ui

@ -9,7 +9,7 @@
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="header_bar">
<child type="title">
<object class="AdwClamp">
<property name="maximum-size">400</property>

7
src/session/view/content/invite.rs

@ -29,6 +29,8 @@ mod imp {
pub decline_requests: RefCell<HashSet<Room>>,
pub category_handler: RefCell<Option<glib::SignalHandlerId>>,
#[template_child]
pub header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub room_alias: TemplateChild<gtk::Label>,
#[template_child]
pub room_topic: TemplateChild<gtk::Label>,
@ -195,6 +197,11 @@ impl Invite {
glib::Object::new()
}
/// The header bar of the invite.
pub fn header_bar(&self) -> &adw::HeaderBar {
&self.imp().header_bar
}
fn reset(&self) {
let imp = self.imp();
imp.accept_button.set_is_loading(false);

2
src/session/view/content/invite.ui

@ -6,7 +6,7 @@
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="header_bar">
<child type="title">
<object class="AdwWindowTitle">
<!-- Translators: This is a verb. -->

16
src/session/view/content/mod.rs

@ -65,8 +65,12 @@ mod imp {
#[template_child]
pub empty_page: TemplateChild<adw::ToolbarView>,
#[template_child]
pub empty_page_header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub verification_page: TemplateChild<adw::ToolbarView>,
#[template_child]
pub verification_page_header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub identity_verification_widget: TemplateChild<IdentityVerificationView>,
}
@ -255,4 +259,16 @@ impl Content {
_ => {}
}
}
/// All the header bars of the children of the content.
pub fn header_bars(&self) -> [&adw::HeaderBar; 5] {
let imp = self.imp();
[
&imp.empty_page_header_bar,
imp.room_history.header_bar(),
imp.invite.header_bar(),
imp.explore.header_bar(),
&imp.verification_page_header_bar,
]
}
}

4
src/session/view/content/mod.ui

@ -14,7 +14,7 @@
<property name="child">
<object class="AdwToolbarView" id="empty_page">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="empty_page_header_bar">
<property name="show-title">False</property>
</object>
</child>
@ -71,7 +71,7 @@
<property name="child">
<object class="AdwToolbarView" id="verification_page">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="verification_page_header_bar">
<property name="show-title">False</property>
</object>
</child>

16
src/session/view/content/room_history/mod.rs

@ -6,6 +6,7 @@ mod message_toolbar;
mod read_receipts_list;
mod sender_avatar;
mod state_row;
mod title;
mod typing_row;
mod verification_info_bar;
@ -24,12 +25,12 @@ use tracing::{error, warn};
use self::{
divider_row::DividerRow, item_row::ItemRow, message_row::MessageRow,
message_toolbar::MessageToolbar, read_receipts_list::ReadReceiptsList,
sender_avatar::SenderAvatar, state_row::StateRow, typing_row::TypingRow,
verification_info_bar::VerificationInfoBar,
sender_avatar::SenderAvatar, state_row::StateRow, title::RoomHistoryTitle,
typing_row::TypingRow, verification_info_bar::VerificationInfoBar,
};
use super::{room_details, RoomDetails};
use crate::{
components::{confirm_leave_room_dialog, DragOverlay, ReactionChooser, RoomTitle, Spinner},
components::{confirm_leave_room_dialog, DragOverlay, ReactionChooser, Spinner},
i18n::gettext_f,
prelude::*,
session::model::{
@ -82,7 +83,7 @@ mod imp {
#[template_child]
pub sender_menu_model: TemplateChild<gio::Menu>,
#[template_child]
pub room_title: TemplateChild<RoomTitle>,
pub header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub room_menu: TemplateChild<gtk::MenuButton>,
#[template_child]
@ -125,6 +126,7 @@ mod imp {
type ParentType = adw::Bin;
fn class_init(klass: &mut Self::Class) {
RoomHistoryTitle::ensure_type();
ItemRow::ensure_type();
VerificationInfoBar::ensure_type();
Timeline::ensure_type();
@ -537,6 +539,12 @@ impl RoomHistory {
glib::Object::new()
}
/// The header bar of the room history.
pub fn header_bar(&self) -> &adw::HeaderBar {
&self.imp().header_bar
}
/// The message toolbar of the room history.
fn message_toolbar(&self) -> &MessageToolbar {
&self.imp().message_toolbar
}

16
src/session/view/content/room_history/mod.ui

@ -132,24 +132,16 @@
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="header_bar">
<property name="centering-policy">strict</property>
<child type="title">
<object class="RoomTitle" id="room_title">
<binding name="title">
<lookup name="display-name">
<lookup name="room">ContentRoomHistory</lookup>
</lookup>
</binding>
<binding name="subtitle">
<lookup name="topic">
<lookup name="room">ContentRoomHistory</lookup>
</lookup>
</binding>
<object class="RoomHistoryTitle">
<property name="room" bind-source="ContentRoomHistory" bind-property="room" bind-flags="sync-create" />
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="room_menu">
<property name="valign">center</property>
<property name="icon-name">menu-secondary-symbolic</property>
<property name="menu-model">room-menu-model</property>
<property name="primary" bind-source="ContentRoomHistory" bind-property="only-view" bind-flags="sync-create"/>

120
src/components/room_title.rs → src/session/view/content/room_history/title.rs

@ -1,27 +1,35 @@
use adw::{prelude::*, subclass::prelude::*};
use gtk::{glib, CompositeTemplate};
use gtk::{glib, glib::clone, CompositeTemplate};
use crate::{prelude::*, utils::string::linkify};
use crate::{
components::Avatar,
prelude::*,
session::model::Room,
utils::{string::linkify, BoundObjectWeakRef},
};
mod imp {
use std::cell::{OnceCell, RefCell};
use std::cell::RefCell;
use glib::subclass::InitializingObject;
use super::*;
#[derive(Debug, Default, CompositeTemplate, glib::Properties)]
#[template(resource = "/org/gnome/Fractal/ui/components/room_title.ui")]
#[properties(wrapper_type = super::RoomTitle)]
pub struct RoomTitle {
#[template(resource = "/org/gnome/Fractal/ui/session/view/content/room_history/title.ui")]
#[properties(wrapper_type = super::RoomHistoryTitle)]
pub struct RoomHistoryTitle {
// The room to present the title of.
#[property(get, set = Self::set_room, explicit_notify, nullable)]
pub room: BoundObjectWeakRef<Room>,
// The title of the room.
#[property(get, set = Self::set_title, explicit_notify)]
#[property(get)]
pub title: RefCell<Option<String>>,
// The title of the room that can be presented on a single line.
#[property(get)]
pub title_excerpt: RefCell<Option<String>>,
// The subtitle of the room.
#[property(get, set = Self::set_subtitle, explicit_notify)]
#[property(get)]
pub subtitle: RefCell<Option<String>>,
// The subtitle of the room that can be presented on a single line.
#[property(get)]
@ -31,20 +39,22 @@ mod imp {
#[template_child]
pub title_excerpt_label: TemplateChild<gtk::Label>,
#[template_child]
pub start_bin: TemplateChild<adw::Bin>,
pub popover: TemplateChild<gtk::Popover>,
#[template_child]
pub arrow_icon: TemplateChild<gtk::Image>,
size_group: OnceCell<gtk::SizeGroup>,
pub title_label: TemplateChild<gtk::Label>,
}
#[glib::object_subclass]
impl ObjectSubclass for RoomTitle {
const NAME: &'static str = "RoomTitle";
type Type = super::RoomTitle;
impl ObjectSubclass for RoomHistoryTitle {
const NAME: &'static str = "RoomHistoryTitle";
type Type = super::RoomHistoryTitle;
type ParentType = adw::Bin;
fn class_init(klass: &mut Self::Class) {
Avatar::ensure_type();
Self::bind_template(klass);
Self::Type::bind_template_callbacks(klass);
klass.set_css_name("room-title");
}
@ -55,24 +65,55 @@ mod imp {
}
#[glib::derived_properties]
impl ObjectImpl for RoomTitle {
impl ObjectImpl for RoomHistoryTitle {
fn constructed(&self) {
self.parent_constructed();
let size_group = self
.size_group
.get_or_init(|| gtk::SizeGroup::new(gtk::SizeGroupMode::Horizontal));
size_group.add_widget(&*self.start_bin);
size_group.add_widget(&*self.arrow_icon);
self.popover.set_offset(0, 5);
}
}
impl WidgetImpl for RoomTitle {}
impl BinImpl for RoomTitle {}
impl WidgetImpl for RoomHistoryTitle {}
impl BinImpl for RoomHistoryTitle {}
impl RoomHistoryTitle {
/// Set the room to present the title of.
fn set_room(&self, room: Option<Room>) {
if self.room.obj() == room {
return;
}
self.room.disconnect_signals();
if let Some(room) = room {
let display_name_handler = room.connect_display_name_notify(clone!(
#[weak(rename_to = imp)]
self,
move |_| {
imp.update_title();
}
));
let topic_handler = room.connect_topic_notify(clone!(
#[weak(rename_to = imp)]
self,
move |_| {
imp.update_subtitle();
}
));
self.room
.set(&room, vec![display_name_handler, topic_handler]);
}
self.obj().notify_room();
self.update_title();
self.update_subtitle();
}
/// Update the title of the room.
fn update_title(&self) {
let original_title = self.room.obj().map(|r| r.display_name());
impl RoomTitle {
/// Set the title of the room.
fn set_title(&self, original_title: Option<String>) {
let title = original_title.as_deref().map(|s| {
// Detect links.
let mut s = linkify(s);
@ -104,8 +145,10 @@ mod imp {
self.title_excerpt_label.set_visible(has_title);
}
/// Set the subtitle of the room.
pub fn set_subtitle(&self, original_subtitle: Option<String>) {
/// Update the subtitle of the room.
fn update_subtitle(&self) {
let original_subtitle = self.room.obj().and_then(|r| r.topic());
let subtitle = original_subtitle.as_deref().map(|s| {
// Detect links.
let mut s = linkify(s);
@ -146,17 +189,34 @@ mod imp {
glib::wrapper! {
/// A widget to show a room's title and topic in a header bar.
pub struct RoomTitle(ObjectSubclass<imp::RoomTitle>)
pub struct RoomHistoryTitle(ObjectSubclass<imp::RoomHistoryTitle>)
@extends gtk::Widget, adw::Bin, @implements gtk::Accessible;
}
impl RoomTitle {
#[gtk::template_callbacks]
impl RoomHistoryTitle {
/// Construct a new empty `RoomHistoryTitle`.
pub fn new() -> Self {
glib::Object::new()
}
/// Handle when the title's label was mapped.
#[template_callback]
fn title_mapped(&self) {
let imp = self.imp();
// Put the cursor at the beginning of the title instead of having the title
// selected.
glib::idle_add_local_once(clone!(
#[weak]
imp,
move || {
imp.title_label.select_region(0, 0);
}
));
}
}
impl Default for RoomTitle {
impl Default for RoomHistoryTitle {
fn default() -> Self {
Self::new()
}

155
src/session/view/content/room_history/title.ui

@ -0,0 +1,155 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="RoomHistoryTitle" parent="AdwBin">
<child>
<object class="GtkStack" id="stack">
<child>
<object class="GtkStackPage">
<property name="name">title-only</property>
<property name="child">
<object class="GtkLabel">
<property name="focusable">True</property>
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="width-chars">5</property>
<property name="label" bind-source="RoomHistoryTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<property name="tooltip-markup" bind-source="RoomHistoryTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<style>
<class name="title"/>
</style>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">button</property>
<property name="child">
<object class="GtkMenuButton">
<style>
<class name="flat"/>
</style>
<property name="tooltip-text" translatable="yes">Click to Expand</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="accessible-role">group</property>
<child>
<object class="GtkLabel" id="title_excerpt_label">
<property name="focusable">True</property>
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="width-chars">5</property>
<property name="label" bind-source="RoomHistoryTitle" bind-property="title-excerpt" bind-flags="sync-create"/>
<style>
<class name="title"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="ellipsize">end</property>
<property name="halign">center</property>
<property name="wrap">False</property>
<property name="single-line-mode">True</property>
<property name="label" bind-source="RoomHistoryTitle" bind-property="subtitle-excerpt" bind-flags="sync-create"/>
<style>
<class name="subtitle"/>
</style>
</object>
</child>
</object>
</property>
<property name="popover">
<object class="GtkPopover" id="popover">
<property name="has-arrow">False</property>
<property name="child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="propagate-natural-height">True</property>
<property name="propagate-natural-width">True</property>
<property name="child">
<object class="AdwClamp">
<property name="maximum-size">500</property>
<property name="tightening-threshold">500</property>
<property name="child">
<object class="GtkBox">
<property name="accessible-role">group</property>
<property name="margin-top">6</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>
<property name="spacing">8</property>
<child>
<object class="Avatar">
<property name="valign">start</property>
<property name="size">36</property>
<property name="accessible-role">presentation</property>
<binding name="data">
<lookup name="avatar-data">
<lookup name="room">RoomHistoryTitle</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="accessible-role">group</property>
<property name="spacing">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkLabel" id="title_label">
<property name="focusable">True</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="use-markup">True</property>
<property name="selectable">True</property>
<property name="xalign">0.0</property>
<property name="hexpand">True</property>
<property name="label" bind-source="RoomHistoryTitle" bind-property="title" bind-flags="sync-create"/>
<signal name="map" handler="title_mapped" swapped="true" />
<style>
<class name="heading"/>
</style>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="focusable">True</property>
<property name="wrap">True</property>
<property name="wrap-mode">word-char</property>
<property name="use-markup">True</property>
<property name="selectable">True</property>
<property name="xalign">0.0</property>
<property name="hexpand">True</property>
<property name="label" bind-source="RoomHistoryTitle" bind-property="subtitle" bind-flags="sync-create"/>
<style>
<class name="body"/>
</style>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</property>
</object>
</child>
</object>
</child>
</template>
</interface>

9
src/session/view/session_view.rs

@ -174,6 +174,15 @@ mod imp {
));
obj.imp().window_active_handler_id.replace(Some(handler_id));
});
// Make sure all header bars on the same screen have the same height.
// Necessary when the text scaling changes.
let size_group = gtk::SizeGroup::new(gtk::SizeGroupMode::Vertical);
size_group.add_widget(self.sidebar.header_bar());
for header_bar in self.content.header_bars() {
size_group.add_widget(header_bar);
}
}
fn dispose(&self) {

7
src/session/view/sidebar/mod.rs

@ -38,6 +38,8 @@ mod imp {
#[template(resource = "/org/gnome/Fractal/ui/session/view/sidebar/mod.ui")]
#[properties(wrapper_type = super::Sidebar)]
pub struct Sidebar {
#[template_child]
pub header_bar: TemplateChild<adw::HeaderBar>,
#[template_child]
pub security_banner: TemplateChild<adw::Banner>,
#[template_child]
@ -430,4 +432,9 @@ impl Sidebar {
popover
})
}
/// The `adw::HeaderBar` of the sidebar.
pub fn header_bar(&self) -> &adw::HeaderBar {
&self.imp().header_bar
}
}

8
src/session/view/sidebar/mod.ui

@ -79,13 +79,16 @@
<child>
<object class="AdwToolbarView">
<child type="top">
<object class="AdwHeaderBar">
<object class="AdwHeaderBar" id="header_bar">
<property name="show-title">False</property>
<child type="start">
<object class="AccountSwitcherButton"/>
<object class="AccountSwitcherButton">
<property name="valign">center</property>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="appmenu_button">
<property name="valign">center</property>
<property name="icon-name">menu-primary-symbolic</property>
<property name="menu-model">primary_menu</property>
<property name="primary">True</property>
@ -94,6 +97,7 @@
</child>
<child type="end">
<object class="GtkToggleButton" id="search_button">
<property name="valign">center</property>
<property name="icon-name">system-search-symbolic</property>
<property name="active" bind-source="room_search" bind-property="search-mode-enabled" bind-flags="sync-create"/>
<property name="action-name">session.toggle-room-search</property>

2
src/ui-resources.gresource.xml

@ -29,7 +29,6 @@
<file compressed="true" preprocess="xml-stripblanks">components/power_level_selection/popover.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/power_level_selection/row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/reaction_chooser.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/room_title.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/rows/button_count_row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/rows/button_row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">components/rows/check_loading_row.ui</file>
@ -126,6 +125,7 @@
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/state_row/creation.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/state_row/mod.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/state_row/tombstone.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/title.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/typing_row.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/content/room_history/verification_info_bar.ui</file>
<file compressed="true" preprocess="xml-stripblanks">session/view/create_dm_dialog/mod.ui</file>

Loading…
Cancel
Save