@@ -40,6 +40,8 @@ @interface AppDelegate ()
4040
4141@property (nonatomic ,strong ) NSMenu *dockMenu;
4242
43+ @property bool isLoadItunesMedia;
44+
4345@end
4446
4547
@@ -161,12 +163,14 @@ - (IBAction)cmdOpenDirectory:(id)sender
161163
162164 dojobInBkgnd (
163165 ^{
166+ self.isLoadItunesMedia = true ;
164167 postEvent (EventID_importing_tracks_begin, nil );
165168 [list addTrackInfoItems: enumAudioFiles (fileName)];
166169 } ,
167170 ^{
168171 postEvent (EventID_importing_tracks_end, nil );
169172 postEvent (EventID_to_reload_tracklist, list);
173+ self.isLoadItunesMedia = false ;
170174 });
171175
172176 }
@@ -185,6 +189,7 @@ -(void)reloadiTunesMedia
185189
186190- (IBAction )cmdReloadiTunesMedia : (id )sender
187191{
192+
188193 NSString *alertSuppressionKey = @" ReloadiTunesMedia" ;
189194 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults ];
190195
@@ -202,14 +207,21 @@ - (IBAction)cmdReloadiTunesMedia:(id)sender
202207 [alert addButtonWithTitle: NSLocalizedString(@" Cancel" ,nil )];
203208 alert.showsSuppressionButton = YES ;
204209
205- if ( [alert runModal ] == NSAlertFirstButtonReturn )
210+ NSModalResponse resp = [alert runModal ];
211+
212+ if ( resp == NSAlertFirstButtonReturn )
206213 [self reloadiTunesMedia ];
207214
215+
216+
208217 if (alert.suppressionButton .state == NSOnState )
209218 [defaults setBool: YES forKey: alertSuppressionKey];
219+
210220 }
221+
211222}
212223
224+
213225- (IBAction )cmdFind : (id )sender
214226{
215227 WindowController *vc = [NSApplication sharedApplication ].mainWindow .windowController ;
@@ -394,12 +406,14 @@ -(void)loadiTunesMedia
394406
395407 dojobInBkgnd (
396408 ^{
409+ self.isLoadItunesMedia = true ;
397410 postEvent (EventID_importing_tracks_begin, nil );
398411 [list addTrackInfoItems: enumAudioFiles ( userMusic )];
399412 } ,
400413 ^{
401414 postEvent (EventID_importing_tracks_end, nil );
402415 postEvent (EventID_to_reload_tracklist, list);
416+ self.isLoadItunesMedia = false ;
403417 });
404418}
405419
@@ -510,13 +524,15 @@ -(void)playerErrorHandler:(NSNotification*)n
510524 [[NSAlert alertWithError: error] runModal ];
511525}
512526
513-
514- -(BOOL )importDirectoryEnabled
527+ -(bool )isMediaItemReloadItunesEnabled
515528{
516- return [player ().document.playerlList getSelectedItem ].type != type_temporary ;
529+ // only enabled when not temp playlist, nor not loading itunes media.
530+ return [player ().document.playerlList getSelectedItem ].type != type_temporary && self.isLoadItunesMedia == false ;
517531}
518532
519533
534+
535+
520536- (IBAction )cmdLastFm_Love : (id )sender
521537{
522538 postEvent (EventID_to_love_item, nil );
0 commit comments