1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-22 07:42:37 +00:00

refactor: rename "UpdateQueue" to "UpdateTorrentsState" (#6613)

This commit is contained in:
Cœur 2024-05-26 01:43:08 +02:00 committed by GitHub
parent bf0119dd3f
commit 92478ec849
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 17 deletions

View file

@ -381,14 +381,14 @@ static void removeKeRangerRansomware()
[NSValueTransformer setValueTransformer:iconTransformer forName:@"ExpandedPathToIconTransformer"]; [NSValueTransformer setValueTransformer:iconTransformer forName:@"ExpandedPathToIconTransformer"];
} }
void onStartQueue(tr_session* /*session*/, tr_torrent* tor, void* vself) void onStartQueue(tr_session* /*session*/, tr_torrent* /*tor*/, void* /*vself*/)
{ {
auto* controller = (__bridge Controller*)(vself);
auto const hashstr = @(tr_torrentView(tor).hash_string);
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
auto* const torrent = [controller torrentForHash:hashstr]; //posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
[torrent startQueue]; [NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateTorrentsState" object:nil]
postingStyle:NSPostASAP
coalesceMask:NSNotificationCoalescingOnName
forModes:nil];
}); });
} }
@ -812,8 +812,7 @@ void onTorrentCompletenessChanged(tr_torrent* tor, tr_completeness status, bool
[nc addObserver:self.fWindow selector:@selector(makeKeyWindow) name:@"MakeWindowKey" object:nil]; [nc addObserver:self.fWindow selector:@selector(makeKeyWindow) name:@"MakeWindowKey" object:nil];
#warning rename [nc addObserver:self selector:@selector(fullUpdateUI) name:@"UpdateTorrentsState" object:nil];
[nc addObserver:self selector:@selector(fullUpdateUI) name:@"UpdateQueue" object:nil];
[nc addObserver:self selector:@selector(applyFilter) name:@"ApplyFilter" object:nil]; [nc addObserver:self selector:@selector(applyFilter) name:@"ApplyFilter" object:nil];

View file

@ -463,7 +463,7 @@ typedef NS_ENUM(NSUInteger, FilePriorityMenuTag) { //
[FileRenameSheetController presentSheetForTorrent:torrent modalForWindow:self.fOutline.window completionHandler:^(BOOL didRename) { [FileRenameSheetController presentSheetForTorrent:torrent modalForWindow:self.fOutline.window completionHandler:^(BOOL didRename) {
if (didRename) if (didRename)
{ {
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self]; [NSNotificationCenter.defaultCenter postNotificationName:@"UpdateTorrentsState" object:nil];
[NSNotificationCenter.defaultCenter postNotificationName:@"ResetInspector" object:self [NSNotificationCenter.defaultCenter postNotificationName:@"ResetInspector" object:self
userInfo:@{ @"Torrent" : torrent }]; userInfo:@{ @"Torrent" : torrent }];
} }

View file

@ -879,7 +879,7 @@ static NSString* const kWebUIURLFormat = @"http://localhost:%ld/";
tr_sessionSetQueueEnabled(self.fHandle, TR_UP, [self.fDefaults boolForKey:@"QueueSeed"]); tr_sessionSetQueueEnabled(self.fHandle, TR_UP, [self.fDefaults boolForKey:@"QueueSeed"]);
//handle if any transfers switch from queued to paused //handle if any transfers switch from queued to paused
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self]; [NSNotificationCenter.defaultCenter postNotificationName:@"UpdateTorrentsState" object:nil];
} }
- (void)setQueueNumber:(id)sender - (void)setQueueNumber:(id)sender

View file

@ -42,7 +42,6 @@ extern NSString* const kTorrentDidChangeGroupNotification;
- (void)startTransfer; - (void)startTransfer;
- (void)startMagnetTransferAfterMetaDownload; - (void)startMagnetTransferAfterMetaDownload;
- (void)stopTransfer; - (void)stopTransfer;
- (void)startQueue;
- (void)sleep; - (void)sleep;
- (void)wakeUp; - (void)wakeUp;
- (void)idleLimitHit; - (void)idleLimitHit;

View file

@ -251,7 +251,7 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
if (wasTransmitting != self.transmitting) if (wasTransmitting != self.transmitting)
{ {
//posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time //posting asynchronously with coalescing to prevent stack overflow on lots of torrents changing state at the same time
[NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateQueue" object:self] [NSNotificationQueue.defaultQueue enqueueNotification:[NSNotification notificationWithName:@"UpdateTorrentsState" object:nil]
postingStyle:NSPostASAP postingStyle:NSPostASAP
coalesceMask:NSNotificationCoalescingOnName coalesceMask:NSNotificationCoalescingOnName
forModes:nil]; forModes:nil];
@ -1982,11 +1982,6 @@ bool trashDataFile(char const* filename, void* /*user_data*/, tr_error* error)
}]; }];
} }
- (void)startQueue
{
[NSNotificationCenter.defaultCenter postNotificationName:@"UpdateQueue" object:self];
}
- (void)completenessChange:(tr_completeness)status wasRunning:(BOOL)wasRunning - (void)completenessChange:(tr_completeness)status wasRunning:(BOOL)wasRunning
{ {
self.fStat = tr_torrentStat(self.fHandle); //don't call update yet to avoid auto-stop self.fStat = tr_torrentStat(self.fHandle); //don't call update yet to avoid auto-stop