Skip to content

Commit 605227a

Browse files
committed
demo-app: Delete confusing ResetCollection command
1 parent 7db57a2 commit 605227a

File tree

2 files changed

+0
-21
lines changed

2 files changed

+0
-21
lines changed

demo-app/src/library/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ impl Library {
129129
self.update_music_dir(None);
130130
}
131131

132-
pub fn reset_collection(&self) {
133-
self.state.collection.reset();
134-
// Enforce restoring the collection from the selected music directory.
135-
self.state.settings.set_modified();
136-
}
137-
138132
pub fn spawn_rescan_collection_task(&mut self, rt: &tokio::runtime::Handle) -> bool {
139133
if let Some(rescan_collection_task) = self.pending_rescan_collection_task.as_ref() {
140134
if rescan_collection_task.is_finished() {

demo-app/src/main.rs

-15
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ fn run_app(rt: tokio::runtime::Handle, library: Library, config_dir: PathBuf) {
200200
|cx: &mut Context| Label::new(cx, "Rescan collection"),
201201
)
202202
.disabled(AppModel::collection_state.map(disable_rescan_collection));
203-
Button::new(
204-
cx,
205-
|ex| ex.emit(AppEvent::Command(AppCommand::ResetCollection)),
206-
|cx| Label::new(cx, "Reset collection"),
207-
)
208-
.disabled(AppModel::collection_state.map(disable_rescan_collection));
209203
});
210204
});
211205

@@ -235,11 +229,6 @@ const fn disable_select_music_dir(state: &CollectionState) -> bool {
235229
state.is_pending()
236230
}
237231

238-
#[must_use]
239-
fn disable_reset_collection(state: &CollectionState) -> bool {
240-
state.is_pending() || *state == CollectionState::Void
241-
}
242-
243232
#[must_use]
244233
const fn disable_rescan_collection(state: &CollectionState) -> bool {
245234
!state.is_ready()
@@ -293,7 +282,6 @@ enum AppCommand {
293282
SelectMusicDirectory,
294283
UpdateMusicDirectory(DirPath<'static>),
295284
ResetMusicDirectory,
296-
ResetCollection,
297285
RescanCollection,
298286
SearchTracks(String),
299287
}
@@ -393,9 +381,6 @@ impl Model for AppModel {
393381
AppCommand::ResetMusicDirectory => {
394382
self.app.library.reset_music_dir();
395383
}
396-
AppCommand::ResetCollection => {
397-
self.app.library.reset_collection();
398-
}
399384
AppCommand::RescanCollection => {
400385
self.app.library.spawn_rescan_collection_task(&self.app.rt);
401386
}

0 commit comments

Comments
 (0)