Commit 5fb6cff9 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: update singleton creation

parent 9632dfbb
......@@ -66,50 +66,50 @@ const NSTimeInterval HOLD_RECOGNITION_TIME_INTERVAL=0.4;
#pragma public interface
static AppleRemote *_o_sharedInstance = nil;
+ (AppleRemote *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
static AppleRemote *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [AppleRemote new];
});
return sharedInstance;
}
- (id)init
{
if (!_o_sharedInstance) {
_o_sharedInstance = [super init];
_openInExclusiveMode = YES;
queue = NULL;
hidDeviceInterface = NULL;
NSMutableDictionary * mutableCookieToButtonMapping = [[NSMutableDictionary alloc] init];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"33_31_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"33_32_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"33_22_21_20_2_33_22_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"33_23_21_20_2_33_23_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"33_24_21_20_2_33_24_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"33_25_21_20_2_33_25_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"33_21_20_14_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"33_21_20_13_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"33_21_20_2_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
if( OSX_SNOW_LEOPARD )
/* 10.6.2+ Snow Leopard cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
else
/* Lion cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"42_33_23_21_20_2_33_23_21_20_2_"];
_cookieToButtonMapping = [[NSDictionary alloc] initWithDictionary: mutableCookieToButtonMapping];
/* defaults */
_simulatesPlusMinusHold = YES;
_maximumClickCountTimeDifference = DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE;
}
return _o_sharedInstance;
_openInExclusiveMode = YES;
queue = NULL;
hidDeviceInterface = NULL;
NSMutableDictionary * mutableCookieToButtonMapping = [[NSMutableDictionary alloc] init];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Plus] forKey:@"33_31_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonVolume_Minus] forKey:@"33_32_30_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu] forKey:@"33_22_21_20_2_33_22_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay] forKey:@"33_23_21_20_2_33_23_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight] forKey:@"33_24_21_20_2_33_24_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft] forKey:@"33_25_21_20_2_33_25_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonRight_Hold] forKey:@"33_21_20_14_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonLeft_Hold] forKey:@"33_21_20_13_12_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonMenu_Hold] forKey:@"33_21_20_2_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteButtonPlay_Sleep] forKey:@"37_33_21_20_2_37_33_21_20_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonPlay] forKey:@"33_21_20_8_2_33_21_20_8_2_"];
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:k2009RemoteButtonFullscreen] forKey:@"33_21_20_3_2_33_21_20_3_2_"];
if( OSX_SNOW_LEOPARD )
/* 10.6.2+ Snow Leopard cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"19_"];
else
/* Lion cookies */
[mutableCookieToButtonMapping setObject:[NSNumber numberWithInt:kRemoteControl_Switched] forKey:@"42_33_23_21_20_2_33_23_21_20_2_"];
_cookieToButtonMapping = [[NSDictionary alloc] initWithDictionary: mutableCookieToButtonMapping];
/* defaults */
_simulatesPlusMinusHold = YES;
_maximumClickCountTimeDifference = DEFAULT_MAXIMUM_CLICK_TIME_DIFFERENCE;
}
- (void) dealloc {
......
......@@ -51,11 +51,17 @@
#pragma mark Initialization
@implementation VLCAudioEffects
static VLCAudioEffects *_o_sharedInstance = nil;
+ (VLCAudioEffects *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
static VLCAudioEffects *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCAudioEffects new];
});
return sharedInstance;
}
+ (void)initialize{
......@@ -94,13 +100,10 @@ static VLCAudioEffects *_o_sharedInstance = nil;
- (id)init
{
if (!_o_sharedInstance) {
p_intf = VLCIntf;
i_old_profile_index = -1;
_o_sharedInstance = [super init];
}
return _o_sharedInstance;
self = [super init];
p_intf = VLCIntf;
i_old_profile_index = -1;
return self;
}
- (void)awakeFromNib
......
......@@ -65,8 +65,6 @@
@implementation VLCConvertAndSave
static VLCConvertAndSave *_o_sharedInstance = nil;
#pragma mark -
#pragma mark Initialization
......@@ -120,15 +118,14 @@ static VLCConvertAndSave *_o_sharedInstance = nil;
+ (VLCConvertAndSave *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
static VLCConvertAndSave *sharedInstance = nil;
static dispatch_once_t pred;
- (id)init
{
if (!_o_sharedInstance)
_o_sharedInstance = [super init];
dispatch_once(&pred, ^{
sharedInstance = [VLCConvertAndSave new];
});
return _o_sharedInstance;
return sharedInstance;
}
- (void)awakeFromNib
......
......@@ -47,21 +47,19 @@
@end
@implementation VLCCoreInteraction
static VLCCoreInteraction *_o_sharedInstance = nil;
+ (VLCCoreInteraction *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
#pragma mark - Initialization
- (id)init
+ (VLCCoreInteraction *)sharedInstance
{
if (!_o_sharedInstance)
_o_sharedInstance = [super init];
static VLCCoreInteraction *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCCoreInteraction new];
});
return _o_sharedInstance;
return sharedInstance;
}
- (void)dealloc
......
......@@ -64,23 +64,27 @@ static void MsgCallback(void *data, int type, const vlc_log_t *item, const char
@implementation VLCDebugMessageVisualizer
static VLCDebugMessageVisualizer *_sharedMainInstance = nil;
+ (VLCDebugMessageVisualizer *)sharedInstance
{
return _sharedMainInstance ? _sharedMainInstance : [[self alloc] init];
static VLCDebugMessageVisualizer *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCDebugMessageVisualizer new];
});
return sharedInstance;
}
- (id)init
{
if (!_sharedMainInstance) {
_sharedMainInstance = [super init];
self = [super init];
if (self) {
_msg_lock = [[NSLock alloc] init];
_msg_arr = [NSMutableArray arrayWithCapacity:600];
BOOL loaded = [NSBundle loadNibNamed:@"DebugMessageVisualizer" owner:self];
}
return _sharedMainInstance;
return self;
}
- (void)awakeFromNib
......
......@@ -276,30 +276,36 @@ static int dialogCallback(vlc_object_t *p_this, const char *psz_variable,
@implementation ExtensionsDialogProvider
static ExtensionsDialogProvider *_o_sharedInstance = nil;
static ExtensionsDialogProvider *sharedInstance = nil;
+ (ExtensionsDialogProvider *)sharedInstance:(intf_thread_t *)_p_intf
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] initWithIntf:_p_intf];
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [[ExtensionsDialogProvider alloc] initWithIntf:_p_intf];
});
return sharedInstance;
}
+ (void)killInstance
{
_o_sharedInstance = nil;
sharedInstance = nil;
}
- (id)initWithIntf:(intf_thread_t *)_p_intf
{
if (!_o_sharedInstance) {
_o_sharedInstance = [super init];
self = [super init];
if (self) {
p_intf = _p_intf;
// The Cocoa interface already called dialog_Register()
var_Create(p_intf, "dialog-extension", VLC_VAR_ADDRESS);
var_AddCallback(p_intf, "dialog-extension", dialogCallback, NULL);
}
return _o_sharedInstance;
return self;
}
- (void)dealloc
......
......@@ -74,7 +74,7 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
break;
case INPUT_EVENT_STATISTICS:
dispatch_async(dispatch_get_main_queue(), ^{
[[[VLCMain sharedInstance] info] updateStatistics];
[[VLCInfo sharedInstance] updateStatistics];
});
break;
case INPUT_EVENT_ES:
......@@ -395,14 +395,14 @@ static int InputEvent(vlc_object_t *p_this, const char *psz_var,
- (void)updateMetaAndInfo
{
if (!p_current_input) {
[[o_main info] updatePanelWithItem:nil];
[[VLCInfo sharedInstance] updatePanelWithItem:nil];
return;
}
input_item_t *p_input_item = input_GetItem(p_current_input);
[[[o_main playlist] model] updateItem:p_input_item];
[[o_main info] updatePanelWithItem:p_input_item];
[[VLCInfo sharedInstance] updatePanelWithItem:p_input_item];
}
- (void)updateMainWindow
......
......@@ -55,7 +55,6 @@
@interface VLCMainMenu()
{
intf_thread_t *p_intf;
BOOL b_mainMenu_setup;
BOOL b_nib_videoeffects_loaded;
BOOL b_nib_audioeffects_loaded;
......@@ -81,20 +80,25 @@
@end
@implementation VLCMainMenu
static VLCMainMenu *_o_sharedInstance = nil;
+ (VLCMainMenu *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
static VLCMainMenu *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCMainMenu new];
});
return sharedInstance;
}
#pragma mark - Initialization
- (id)init
{
if (!_o_sharedInstance) {
_o_sharedInstance = [super init];
self = [super init];
if (self) {
o_ptc_translation_dict = [[NSDictionary alloc] initWithObjectsAndKeys:
_NS("Track Number"), TRACKNUM_COLUMN,
_NS("Title"), TITLE_COLUMN,
......@@ -114,8 +118,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
DESCRIPTION_COLUMN, DATE_COLUMN, LANGUAGE_COLUMN, URI_COLUMN,
FILESIZE_COLUMN,nil];
}
return _o_sharedInstance;
return self;
}
- (void)dealloc
......@@ -143,8 +146,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
[self setRateControlsEnabled:NO];
p_intf = VLCIntf;
#ifdef HAVE_SPARKLE
[o_mi_checkForUpdate setAction:@selector(checkForUpdates:)];
[o_mi_checkForUpdate setTarget:[SUUpdater sharedUpdater]];
......@@ -167,6 +168,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
return;
/* Get ExtensionsManager */
intf_thread_t *p_intf = VLCIntf;
o_extMgr = [ExtensionsManager getInstance:p_intf];
[self initStrings];
......@@ -332,7 +334,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
module_config_t *p_item;
[menu removeAllItems];
p_item = config_FindConfig(VLC_OBJECT(p_intf), psz_name);
p_item = config_FindConfig(VLC_OBJECT(VLCIntf), psz_name);
/* serious problem, if no item found */
assert(p_item);
......@@ -344,7 +346,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
else if (p_item->list.i[i])
mi = [[NSMenuItem alloc] initWithTitle: [NSString stringWithFormat: @"%d", p_item->list.i[i]] action:NULL keyEquivalent: @""];
else {
msg_Err(p_intf, "item %d of pref %s failed to be created", i, psz_name);
msg_Err(VLCIntf, "item %d of pref %s failed to be created", i, psz_name);
continue;
}
......@@ -566,8 +568,6 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)releaseRepresentedObjects:(NSMenu *)the_menu
{
if (!p_intf) return;
NSArray *menuitems_array = [the_menu itemArray];
NSUInteger menuItemCount = [menuitems_array count];
for (NSUInteger i=0; i < menuItemCount; i++) {
......@@ -583,7 +583,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (void)setupMenus
{
playlist_t * p_playlist = pl_Get(p_intf);
playlist_t * p_playlist = pl_Get(VLCIntf);
input_thread_t * p_input = playlist_CurrentInput(p_playlist);
if (p_input != NULL) {
[self setupVarMenuItem: o_mi_program target: (vlc_object_t *)p_input
......@@ -792,7 +792,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
playlist_t *p_playlist = pl_Get(VLCIntf);
bool b_value = !var_CreateGetBool(p_playlist, "play-and-exit");
var_SetBool(p_playlist, "play-and-exit", b_value);
config_PutInt(p_intf, "play-and-exit", b_value);
config_PutInt(VLCIntf, "play-and-exit", b_value);
}
- (IBAction)toggleRecord:(id)sender
......@@ -926,7 +926,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
vout_thread_t *p_vout = getVoutForActiveWindow();
if (p_vout) {
BOOL b_fs = var_ToggleBool(p_vout, "video-on-top");
var_SetBool(pl_Get(p_intf), "video-on-top", b_fs);
var_SetBool(pl_Get(VLCIntf), "video-on-top", b_fs);
vlc_object_release(p_vout);
}
......@@ -1030,7 +1030,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
int intValue = [sender tag];
NSString *representedObject = [sender representedObject];
config_PutInt(p_intf, [representedObject UTF8String], intValue);
config_PutInt(VLCIntf, [representedObject UTF8String], intValue);
NSMenu *menu = [sender menu];
NSUInteger count = (NSUInteger) [menu numberOfItems];
......@@ -1041,7 +1041,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (IBAction)switchSubtitleBackgroundOpacity:(id)sender
{
config_PutInt(p_intf, "freetype-background-opacity", [sender intValue]);
config_PutInt(VLCIntf, "freetype-background-opacity", [sender intValue]);
}
- (IBAction)telxTransparent:(id)sender
......@@ -1272,7 +1272,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
- (IBAction)showInformationPanel:(id)sender
{
[[[VLCMain sharedInstance] info] initPanel];
[[VLCInfo sharedInstance] initPanel];
}
#pragma mark - convinience stuff for other objects
......@@ -1528,7 +1528,7 @@ static VLCMainMenu *_o_sharedInstance = nil;
NSString *o_title = [o_mi title];
BOOL bEnabled = TRUE;
vlc_value_t val;
playlist_t * p_playlist = pl_Get(p_intf);
playlist_t * p_playlist = pl_Get(VLCIntf);
input_thread_t * p_input = playlist_CurrentInput(p_playlist);
if ([o_title isEqualToString: _NS("Stop")]) {
......
......@@ -77,34 +77,32 @@ static const float f_min_window_height = 307.;
@implementation VLCMainWindow
static VLCMainWindow *_o_sharedInstance = nil;
+ (VLCMainWindow *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
#pragma mark -
#pragma mark Initialization
- (id)init
static VLCMainWindow *sharedInstance = nil;
+ (VLCMainWindow *)sharedInstance
{
if (!_o_sharedInstance)
_o_sharedInstance = [super init];
return _o_sharedInstance;
return sharedInstance;
}
- (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)backingType defer:(BOOL)flag
- (id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)styleMask
backing:(NSBackingStoreType)backingType
defer:(BOOL)flag
{
self = [super initWithContentRect:contentRect styleMask:styleMask
backing:backingType defer:flag];
_o_sharedInstance = self;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [super initWithContentRect:contentRect
styleMask:styleMask
backing:backingType
defer:flag];
});
[[VLCMain sharedInstance] updateTogglePlaylistState];
return self;
return sharedInstance;
}
- (BOOL)isEvent:(NSEvent *)o_event forKey:(const char *)keyString
......
......@@ -23,21 +23,17 @@
#import "SharedDialogs.h"
static VLCEnterTextPanel *_textPanelInstance = nil;
static VLCSelectItemInPopupPanel *_selectItemPanelInstance = nil;
@implementation VLCEnterTextPanel
+ (VLCEnterTextPanel *)sharedInstance
{
return _textPanelInstance ? _textPanelInstance : [[self alloc] init];
}
static VLCEnterTextPanel *sharedInstance = nil;
static dispatch_once_t pred;
- (id)init
{
if (!_textPanelInstance)
_textPanelInstance = [super init];
dispatch_once(&pred, ^{
sharedInstance = [VLCEnterTextPanel new];
});
return _textPanelInstance;
return sharedInstance;
}
- (IBAction)windowElementAction:(id)sender
......@@ -77,15 +73,14 @@ static VLCSelectItemInPopupPanel *_selectItemPanelInstance = nil;
+ (VLCSelectItemInPopupPanel *)sharedInstance
{
return _selectItemPanelInstance ? _selectItemPanelInstance : [[self alloc] init];
}
static VLCSelectItemInPopupPanel *sharedInstance = nil;
static dispatch_once_t pred;
- (id)init
{
if (!_selectItemPanelInstance)
_selectItemPanelInstance = [super init];
dispatch_once(&pred, ^{
sharedInstance = [VLCSelectItemInPopupPanel new];
});
return _selectItemPanelInstance;
return sharedInstance;
}
- (IBAction)windowElementAction:(id)sender
......
......@@ -33,19 +33,17 @@
@implementation VLCStringUtility
static VLCStringUtility *_o_sharedInstance = nil;
+ (VLCStringUtility *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
static VLCStringUtility *sharedInstance = nil;
static dispatch_once_t pred;
- (id)init
{
if (!_o_sharedInstance)
_o_sharedInstance = [super init];
dispatch_once(&pred, ^{
sharedInstance = [VLCStringUtility new];
});
return _o_sharedInstance;
return sharedInstance;
}
#pragma mark -
......
......@@ -41,21 +41,24 @@
@end
@implementation VLCTrackSynchronization
static VLCTrackSynchronization *_o_sharedInstance = nil;
+ (VLCTrackSynchronization *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
static VLCTrackSynchronization *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCTrackSynchronization new];
});
return sharedInstance;
}
- (id)init
{
if (!_o_sharedInstance) {
p_intf = VLCIntf;
_o_sharedInstance = [super init];
}
return _o_sharedInstance;
self = [super init];
p_intf = VLCIntf;
return self;
}
- (void)awakeFromNib
......
......@@ -430,7 +430,7 @@
[[VLCVideoEffects sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCAudioEffects sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[[VLCMain sharedInstance] info] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCInfo sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCBookmarks sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[VLCTrackSynchronization sharedInstance] updateCocoaWindowLevel:currentStatusWindowLevel];
[[[VLCMain sharedInstance] resumeDialog] updateCocoaWindowLevel:currentStatusWindowLevel];
......
......@@ -39,11 +39,17 @@
#pragma mark Initialization
@implementation VLCVideoEffects
static VLCVideoEffects *_o_sharedInstance = nil;
+ (VLCVideoEffects *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
static VLCVideoEffects *sharedInstance = nil;
static dispatch_once_t pred;
dispatch_once(&pred, ^{
sharedInstance = [VLCVideoEffects new];
});
return sharedInstance;
}
+ (void)initialize
......@@ -55,13 +61,11 @@ static VLCVideoEffects *_o_sharedInstance = nil;
- (id)init
{
if (!_o_sharedInstance) {
p_intf = VLCIntf;
i_old_profile_index = -1;
_o_sharedInstance = [super init];
}
self = [super init];
p_intf = VLCIntf;
i_old_profile_index = -1;
return _o_sharedInstance;
return self;
}
- (void)awakeFromNib
......
......@@ -47,19 +47,16 @@
@implementation VLCBookmarks
static VLCBookmarks *_o_sharedInstance = nil;
+ (VLCBookmarks *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
static VLCBookmarks *sharedInstance = nil;
static dispatch_once_t pred;
- (id)init
{
if (!_o_sharedInstance)
_o_sharedInstance = [super init];
dispatch_once(&pred, ^{
sharedInstance = [VLCBookmarks new];
});
return _o_sharedInstance;
return sharedInstance;
}
/*****************************************************************************
......
......@@ -40,32 +40,27 @@
@implementation VLCCoreDialogProvider
static VLCCoreDialogProvider *_o_sharedInstance = nil;
+ (VLCCoreDialogProvider *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
static VLCCoreDialogProvider *sharedInstance = nil;
static dispatch_once_t pred;
-(id)init
{
if (!_o_sharedInstance) {
_o_sharedInstance = [super init];
_progressCancelled = NO;
}
dispatch_once(&pred, ^{
sharedInstance = [VLCCoreDialogProvider new];
});
return _o_sharedInstance;
return sharedInstance;
}
-(void)awakeFromNib
{
_progressCancelled = NO;
[o_auth_login_txt setStringValue: _NS("Username")];
[o_auth_pw_txt setStringValue: _NS("Password")];
[o_auth_cancel_btn setTitle: _NS("Cancel")];
[o_auth_ok_btn setTitle: _NS("OK")];
[o_prog_cancel_btn setTitle: _NS("Cancel")];
[o_prog_bar setUsesThreadedAnimation: YES];