Revision d8426ffb pithos-macos/PithosActivityFacility.m

b/pithos-macos/PithosActivityFacility.m
2 2
//  PithosActivityFacility.m
3 3
//  pithos-macos
4 4
//
5
// Copyright 2011 GRNET S.A. All rights reserved.
5
// Copyright 2011-2012 GRNET S.A. All rights reserved.
6 6
//
7 7
// Redistribution and use in source and binary forms, with or
8 8
// without modification, are permitted provided that the following
......
36 36
// or implied, of GRNET S.A.
37 37

  
38 38
#import "PithosActivityFacility.h"
39
#import "PithosAccount.h"
39 40

  
40 41
static PithosActivityFacility *defaultPithosActivityFacility = nil;
41 42

  
......
172 173
            }
173 174
            pickedRunning = YES;
174 175
        }
175
        if (activity && activity.message)
176
            [info setObject:activity.message forKey:@"message"];
176
        if (activity && activity.message) {
177
            if (activity.pithosAccount)
178
                [info setObject:[NSString stringWithFormat:@"[%@] %@", activity.pithosAccount.name, activity.message] forKey:@"message"];
179
            else
180
                [info setObject:activity.message forKey:@"message"];
181
        }
177 182
        [info setObject:[NSNumber numberWithUnsignedInteger:[runningActivities count]] forKey:@"runningActivitiesCount"];
178 183
        [info setObject:[NSNumber numberWithUnsignedInteger:[endingActivities count]] forKey:@"endingActivitiesCount"];
179 184
        [info setObject:[NSNumber numberWithUnsignedInteger:totalUploadBytes] forKey:@"totalUploadBytes"];
......
193 198
- (PithosActivity *)startActivityWithType:(PithosActivityType)type 
194 199
                                  message:(NSString *)message 
195 200
                               totalBytes:(NSUInteger)totalBytes 
196
                               currentBytes:(NSUInteger)currentBytes {
197
    PithosActivity *activity = [[[PithosActivity alloc] initWithType:type] autorelease];
201
                             currentBytes:(NSUInteger)currentBytes 
202
                            pithosAccount:(PithosAccount *)pithosAccount {
203
    PithosActivity *activity = [[[PithosActivity alloc] initWithType:type pithosAccount:pithosAccount] autorelease];
198 204
    activity.message = message;
199 205
    activity.totalBytes = totalBytes;
200 206
    activity.currentBytes = currentBytes;
......
226 232
}
227 233

  
228 234
- (PithosActivity *)startActivityWithType:(PithosActivityType)type 
235
                                  message:(NSString *)message 
236
                               totalBytes:(NSUInteger)totalBytes 
237
                             currentBytes:(NSUInteger)currentBytes {
238
    return [self startActivityWithType:type message:message totalBytes:totalBytes currentBytes:currentBytes pithosAccount:nil];
239
}
240

  
241
- (PithosActivity *)startActivityWithType:(PithosActivityType)type 
242
                                  message:(NSString *)message 
243
                            pithosAccount:(PithosAccount *)pithosAccount {
244
    return [self startActivityWithType:type message:message totalBytes:0 currentBytes:0 pithosAccount:pithosAccount];
245
}
246

  
247
- (PithosActivity *)startActivityWithType:(PithosActivityType)type 
229 248
                                  message:(NSString *)message {
230
    return [self startActivityWithType:type message:message totalBytes:0 currentBytes:0];
249
    return [self startActivityWithType:type message:message pithosAccount:nil];
231 250
}
232 251

  
233
- (PithosActivity *)startAndEndActivityWithType:(PithosActivityType)type message:(NSString *)message {
234
    PithosActivity *activity = [[[PithosActivity alloc] initWithType:type] autorelease];
252
- (PithosActivity *)startAndEndActivityWithType:(PithosActivityType)type 
253
                                        message:(NSString *)message 
254
                                  pithosAccount:(PithosAccount *)pithosAccount {
255
    PithosActivity *activity = [[[PithosActivity alloc] initWithType:type pithosAccount:pithosAccount] autorelease];
235 256
    activity.message = message;
236 257
    activity.totalBytes = 0;
237 258
    activity.currentBytes = 0;
......
243 264
    return activity;
244 265
}
245 266

  
267
- (PithosActivity *)startAndEndActivityWithType:(PithosActivityType)type message:(NSString *)message {
268
    return [self startAndEndActivityWithType:type message:message pithosAccount:nil];
269
}
270

  
246 271
- (void)updateActivity:(PithosActivity *)activity 
247 272
           withMessage:(NSString *)message 
248 273
            totalBytes:(NSUInteger)totalBytes 

Also available in: Unified diff