Changeset 1200c74


Ignore:
Timestamp:
06/05/07 20:09:13 (9 years ago)
Author:
cleaner <mika.ryynanen@…>
Branches:
master
Children:
98d438e
Parents:
7ff9af9
Message:

Moved initialization of default preferences from awakeFromNib? to class method registerUserDefaults?, which is called from [HBController init].
This fixes problem with preferences when using HB for the first time, or after deleting the user defaults file.

git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@599 b64f7644-9d1e-0410-96f1-a4d463321fa5

Location:
macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • macosx/Controller.mm

    re9fd0fa r1200c74  
    88#include "a52dec/a52.h"
    99#import "HBOutputPanelController.h"
     10#import "PrefsController.h"
    1011
    1112#define _(a) NSLocalizedString(a,NULL)
     
    3637- init
    3738{
    38     self    = [super init];
     39    self = [super init];
     40    [PrefsController registerUserDefaults];
    3941    fHandle = NULL;
    40         outputPanel = [[HBOutputPanelController alloc] init];
     42    outputPanel = [[HBOutputPanelController alloc] init];
    4143    return self;
    4244}
     
    33883390- (IBAction)showDebugOutputPanel:(id)sender
    33893391{
    3390         [outputPanel showOutputPanel:nil];
    3391 }
    3392 
     3392    [outputPanel showOutputPanel:nil];
     3393}
    33933394
    33943395@end
  • macosx/PrefsController.h

    r5c320cb5 r1200c74  
    1 /* PrefsController */
     1/**
     2 * @file
     3 * Interface of class PrefsController.
     4 */
    25
    36#include <Cocoa/Cocoa.h>
     
    2225}
    2326
     27+ (void)registerUserDefaults;
     28
    2429- (IBAction) OpenPanel:    (id) sender;
    2530- (IBAction) ClosePanel:   (id) sender;
  • macosx/PrefsController.m

    r7f232a9 r1200c74  
     1/**
     2 * @file
     3 * Implementation of class PrefsController.
     4 */
     5
    16#import "PrefsController.h"
    27
    38@implementation PrefsController
    49
    5 - (void) awakeFromNib
    6 {
    7     NSUserDefaults * defaults;
    8     NSDictionary   * appDefaults;
     10/**
     11 * Registers default values to user defaults. This is called immediately
     12 * when HandBrake starts, from [HBController init].
     13 */
     14+ (void)registerUserDefaults
     15{
     16    NSString *desktopDirectory =  [@"~/Desktop" stringByExpandingTildeInPath];
    917   
    10     /* Unless the user specified otherwise, default is to check
    11        for update  DefAdvancedx264Flags*/
    12     defaults    = [NSUserDefaults standardUserDefaults];
    13 
    14         NSString *defDestDirectory =  @"~/Desktop";
    15         defDestDirectory = [defDestDirectory stringByExpandingTildeInPath];
    16        
    17         NSString *defSrcDirectory =  @"~/Desktop";
    18         defSrcDirectory = [defSrcDirectory stringByExpandingTildeInPath];
    19 
    20     appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
     18    [[NSUserDefaults standardUserDefaults] registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
    2119        @"YES",             @"CheckForUpdates",
    2220        @"English",         @"DefaultLanguage",
     
    2927        @"",                @"DefAdvancedx264Flags",
    3028        @"YES",             @"DefaultPresetsDrawerShow",
    31         defDestDirectory,   @"LastDestinationDirectory",
    32         defSrcDirectory,    @"LastSourceDirectory",
     29        desktopDirectory,   @"LastDestinationDirectory",
     30        desktopDirectory,   @"LastSourceDirectory",
    3331        @"NO",              @"DefaultAutoNaming",
    3432        @"NO",              @"DefaultChapterMarkers",
    3533        @"NO",              @"ShowVerboseOutput",
    36         nil];
    37    
    38         [defaults registerDefaults: appDefaults];
     34        nil]];
     35}
     36
     37- (void) awakeFromNib
     38{
     39    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    3940
    4041        /* fUpdateCheck Check or uncheck according to the preferences */
Note: See TracChangeset for help on using the changeset viewer.