Remove set_ prefix for List setters

This commit is contained in:
Marshall Bowers 2023-10-24 14:18:51 +02:00
parent 24e21a4c29
commit cf380a9f62
6 changed files with 171 additions and 171 deletions

View file

@ -37,20 +37,18 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
List::new(static_collab_panel_current_call())
.header(
ListHeader::new("CRDB")
.set_left_icon(Icon::Hash.into())
.set_toggle(ToggleState::Toggled),
.left_icon(Icon::Hash.into())
.toggle(ToggleState::Toggled),
)
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
),
)
.child(
v_stack().id("channels").py_1().child(
List::new(static_collab_panel_channels())
.header(
ListHeader::new("CHANNELS").set_toggle(ToggleState::Toggled),
)
.header(ListHeader::new("CHANNELS").toggle(ToggleState::Toggled))
.empty_message("No channels yet. Add a channel to get started.")
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
),
)
.child(
@ -58,9 +56,9 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
List::new(static_collab_panel_current_call())
.header(
ListHeader::new("CONTACTS ONLINE")
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
)
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
),
)
.child(
@ -68,9 +66,9 @@ impl<S: 'static + Send + Sync> CollabPanel<S> {
List::new(static_collab_panel_current_call())
.header(
ListHeader::new("CONTACTS OFFLINE")
.set_toggle(ToggleState::NotToggled),
.toggle(ToggleState::NotToggled),
)
.set_toggle(ToggleState::NotToggled),
.toggle(ToggleState::NotToggled),
),
),
)

View file

@ -11,9 +11,9 @@ impl<S: 'static + Send + Sync> ContextMenuItem<S> {
fn to_list_item(self) -> ListItem<S> {
match self {
ContextMenuItem::Header(label) => ListSubHeader::new(label).into(),
ContextMenuItem::Entry(label) => ListEntry::new(label)
.set_variant(ListItemVariant::Inset)
.into(),
ContextMenuItem::Entry(label) => {
ListEntry::new(label).variant(ListItemVariant::Inset).into()
}
ContextMenuItem::Separator => ListSeparator::new().into(),
}
}
@ -57,7 +57,7 @@ impl<S: 'static + Send + Sync> ContextMenu<S> {
.map(ContextMenuItem::to_list_item)
.collect(),
)
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
)
}
}

View file

@ -39,17 +39,17 @@ impl<S: 'static + Send + Sync> ListHeader<S> {
}
}
pub fn set_toggle(mut self, toggle: ToggleState) -> Self {
pub fn toggle(mut self, toggle: ToggleState) -> Self {
self.toggleable = toggle.into();
self
}
pub fn set_toggleable(mut self, toggleable: Toggleable) -> Self {
pub fn toggleable(mut self, toggleable: Toggleable) -> Self {
self.toggleable = toggleable;
self
}
pub fn set_left_icon(mut self, left_icon: Option<Icon>) -> Self {
pub fn left_icon(mut self, left_icon: Option<Icon>) -> Self {
self.left_icon = left_icon;
self
}
@ -283,46 +283,48 @@ impl<S: 'static + Send + Sync> ListEntry<S> {
overflow: OverflowStyle::Hidden,
}
}
pub fn set_variant(mut self, variant: ListItemVariant) -> Self {
pub fn variant(mut self, variant: ListItemVariant) -> Self {
self.variant = variant;
self
}
pub fn set_indent_level(mut self, indent_level: u32) -> Self {
pub fn indent_level(mut self, indent_level: u32) -> Self {
self.indent_level = indent_level;
self
}
pub fn set_toggle(mut self, toggle: ToggleState) -> Self {
pub fn toggle(mut self, toggle: ToggleState) -> Self {
self.toggle = Some(toggle);
self
}
pub fn set_left_content(mut self, left_content: LeftContent) -> Self {
pub fn left_content(mut self, left_content: LeftContent) -> Self {
self.left_content = Some(left_content);
self
}
pub fn set_left_icon(mut self, left_icon: Icon) -> Self {
pub fn left_icon(mut self, left_icon: Icon) -> Self {
self.left_content = Some(LeftContent::Icon(left_icon));
self
}
pub fn set_left_avatar(mut self, left_avatar: impl Into<SharedString>) -> Self {
pub fn left_avatar(mut self, left_avatar: impl Into<SharedString>) -> Self {
self.left_content = Some(LeftContent::Avatar(left_avatar.into()));
self
}
pub fn set_state(mut self, state: InteractionState) -> Self {
pub fn state(mut self, state: InteractionState) -> Self {
self.state = state;
self
}
pub fn set_size(mut self, size: ListEntrySize) -> Self {
pub fn size(mut self, size: ListEntrySize) -> Self {
self.size = size;
self
}
pub fn set_disclosure_control_style(
pub fn disclosure_control_style(
mut self,
disclosure_control_style: DisclosureControlVisibility,
) -> Self {
@ -572,7 +574,7 @@ impl<S: 'static + Send + Sync> List<S> {
self
}
pub fn set_toggle(mut self, toggle: ToggleState) -> Self {
pub fn toggle(mut self, toggle: ToggleState) -> Self {
self.toggleable = toggle.into();
self
}
@ -595,7 +597,7 @@ impl<S: 'static + Send + Sync> List<S> {
.children(
self.header
.take()
.map(|header| header.set_toggleable(self.toggleable)),
.map(|header| header.toggleable(self.toggleable)),
)
.child(list_content)
}

View file

@ -36,14 +36,14 @@ impl<S: 'static + Send + Sync> NotificationsPanel<S> {
.overflow_y_scroll()
.child(
List::new(static_new_notification_items())
.header(ListHeader::new("NEW").set_toggle(ToggleState::Toggled))
.set_toggle(ToggleState::Toggled),
.header(ListHeader::new("NEW").toggle(ToggleState::Toggled))
.toggle(ToggleState::Toggled),
)
.child(
List::new(static_read_notification_items())
.header(ListHeader::new("EARLIER").set_toggle(ToggleState::Toggled))
.header(ListHeader::new("EARLIER").toggle(ToggleState::Toggled))
.empty_message("No new notifications")
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
),
)
}

View file

@ -38,15 +38,15 @@ impl<S: 'static + Send + Sync> ProjectPanel<S> {
.overflow_y_scroll()
.child(
List::new(static_project_panel_single_items())
.header(ListHeader::new("FILES").set_toggle(ToggleState::Toggled))
.header(ListHeader::new("FILES").toggle(ToggleState::Toggled))
.empty_message("No files in directory")
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
)
.child(
List::new(static_project_panel_project_items())
.header(ListHeader::new("PROJECT").set_toggle(ToggleState::Toggled))
.header(ListHeader::new("PROJECT").toggle(ToggleState::Toggled))
.empty_message("No folders in directory")
.set_toggle(ToggleState::Toggled),
.toggle(ToggleState::Toggled),
),
)
.child(