Revision 544b6f52 pithos-macos/pithos_macosAppDelegate.m

b/pithos-macos/pithos_macosAppDelegate.m
46 46
#import "LastCompletedSyncTransformer.h"
47 47

  
48 48
@implementation pithos_macosAppDelegate
49
@synthesize pithosBrowserController, alwaysNo, activated, currentPithosAccount, pithosAccounts, pithosAccountsDictionary, syncPithosAccount;
49
@synthesize pithosBrowserController, alwaysNo, activated, currentPithosAccount, pithosAccounts, pithosAccountsDictionary, syncPithosAccount, activityFacilityTimeInterval;
50 50

  
51 51
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
52 52
    [[NSAppleEventManager sharedAppleEventManager] setEventHandler:self 
......
62 62
        [userDefaults setDouble:syncTimeInterval forKey:@"syncTimeInterval"];
63 63
        [userDefaults synchronize];
64 64
    }
65
    
65

  
66
    activityFacilityTimeInterval = [userDefaults doubleForKey:@"activityFacilityTimeInterval"];
67
    if (activityFacilityTimeInterval <= 0.0) {
68
        activityFacilityTimeInterval = 0.05;
69
        [userDefaults setDouble:activityFacilityTimeInterval forKey:@"activityFacilityTimeInterval"];
70
        [userDefaults synchronize];
71
    }
72

  
66 73
    NSData *tmpData = [userDefaults objectForKey:@"pithosAccounts"];
67 74
    NSArray *tmpArray;
68 75
    if (tmpData && (tmpArray = [NSKeyedUnarchiver unarchiveObjectWithData:tmpData]))
......
224 231
                             [[[[LastCompletedSyncTransformer alloc] init] autorelease] transformedValue:pithosAccount.syncLastCompleted]];
225 232
            if ([pithosAccount isEqualTo:syncPithosAccount] && [pithosAccount.syncDaemon isSyncing])
226 233
                menuItemTitle = [menuItemTitle stringByAppendingString:@" (syncing)"];
227
            menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle 
228
                                                   action:@selector(menuChangeSyncActive:) 
229
                                            keyEquivalent:@""] autorelease];
230
            [menuItem setRepresentedObject:pithosAccount];
231
            [menuItem setEnabled:pithosAccount.active];
232
            [menuItem setState:((pithosAccount.active && pithosAccount.syncActive) ? NSOnState : NSOffState)];
234
//            menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle 
235
//                                                   action:@selector(menuChangeSyncActive:) 
236
//                                            keyEquivalent:@""] autorelease];
237
//            [menuItem setRepresentedObject:pithosAccount];
238
//            [menuItem setEnabled:pithosAccount.active];
239
//            [menuItem setState:((pithosAccount.active && pithosAccount.syncActive) ? NSOnState : NSOffState)];
240
            menuItem = [[[NSMenuItem alloc] initWithTitle:menuItemTitle action:nil keyEquivalent:@""] autorelease];
241
            [menuItem setEnabled:NO];
242
            [menuItem setState:NO];
233 243
            [menu addItem:menuItem];
234 244
        }
235 245
        [menu addItem:[NSMenuItem separatorItem]];
......
373 383
    }
374 384
}
375 385

  
376
- (void)menuChangeSyncActive:(NSMenuItem *)sender {
377
    PithosAccount *pithosAccount = (PithosAccount *)[sender representedObject];
378
    if (!pithosAccount.active)
379
        return;
380
    pithosAccount.syncActive = !pithosAccount.syncActive;
381
    if (pithosPreferencesController && [pithosPreferencesController.selectedPithosAccount isEqualTo:pithosAccount])
382
        pithosPreferencesController.syncActive = pithosAccount.syncActive;
383
    [self savePithosAccounts:self];
384
}
386
//- (void)menuChangeSyncActive:(NSMenuItem *)sender {
387
//    PithosAccount *pithosAccount = (PithosAccount *)[sender representedObject];
388
//    if (!pithosAccount.active)
389
//        return;
390
//    pithosAccount.syncActive = !pithosAccount.syncActive;
391
//    if (pithosPreferencesController && [pithosPreferencesController.selectedPithosAccount isEqualTo:pithosAccount])
392
//        pithosPreferencesController.syncActive = pithosAccount.syncActive;
393
//    [self savePithosAccounts:self];
394
//}
385 395

  
386 396
@end

Also available in: Unified diff