Skip to content

Commit

Permalink
Log's should be stored in ~/Logs and not user customizable
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef committed Feb 18, 2012
1 parent 3cf9e5f commit db12a15
Show file tree
Hide file tree
Showing 7 changed files with 1,697 additions and 1,901 deletions.
2 changes: 1 addition & 1 deletion Classes/Controllers/MenuController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,7 @@ - (void)onMemberShun:(id)sender

- (void)onWantToReadTextualLogs:(id)sender
{
NSString *path = [[Preferences transcriptFolder] stringByExpandingTildeInPath];
NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Logs"];

if ([_NSFileManager() fileExistsAtPath:path]) {
[_NSWorkspace() openURL:[NSURL fileURLWithPath:path]];
Expand Down
45 changes: 0 additions & 45 deletions Classes/Dialogs/Preferences/PreferencesController.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#define ADDONS_TOOLBAR_ITEM_INDEX 8

@interface PreferencesController (Private)
- (void)updateTranscriptFolder;
- (void)updateTheme;
- (void)updateAlert;

Expand Down Expand Up @@ -50,7 +49,6 @@ @implementation PreferencesController
@synthesize alertButton;
@synthesize alertSoundButton;
@synthesize highlightNicknameButton;
@synthesize transcriptFolderButton;
@synthesize addExcludeWordButton;
@synthesize useGrowlButton;
@synthesize disableAlertWhenAwayButton;
Expand Down Expand Up @@ -102,7 +100,6 @@ - (void)show
installedScriptsTable.dataSource = scriptsController;
[installedScriptsTable reloadData];

[self updateTranscriptFolder];
[self updateTheme];
[self updateAlert];

Expand Down Expand Up @@ -393,48 +390,6 @@ - (NSMutableArray *)sounds
return sounds;
}

#pragma mark -
#pragma mark Transcript Folder Popup

- (void)updateTranscriptFolder
{
NSString *path = [[Preferences transcriptFolder] stringByExpandingTildeInPath];

NSImage *icon = [_NSWorkspace() iconForFile:path];
[icon setSize:NSMakeSize(16, 16)];

NSMenuItem *item = [transcriptFolderButton itemAtIndex:0];

[item setTitle:[[path lastPathComponent] decodeURIFragement]];
[item setImage:icon];
}

- (void)onTranscriptFolderChanged:(id)sender
{
if ([transcriptFolderButton selectedTag] == 2) {
NSOpenPanel *d = [NSOpenPanel openPanel];

[d setCanChooseFiles:NO];
[d setCanChooseDirectories:YES];
[d setResolvesAliases:YES];
[d setAllowsMultipleSelection:NO];
[d setCanCreateDirectories:YES];

[d beginSheetModalForWindow:[NSApp keyWindow] completionHandler:^(NSInteger returnCode) {
[transcriptFolderButton selectItem:[transcriptFolderButton itemAtIndex:0]];

if (returnCode == NSOKButton) {
NSURL *pathURL = [[d URLs] safeObjectAtIndex:0];
NSString *path = [pathURL path];

[Preferences setTranscriptFolder:[path stringByAbbreviatingWithTildeInPath]];

[self updateTranscriptFolder];
}
}];
}
}

#pragma mark -
#pragma mark Theme

Expand Down
3 changes: 0 additions & 3 deletions Classes/Headers/Preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ typedef enum {
+ (NSInteger)maxLogLines;
+ (void)setMaxLogLines:(NSInteger)value;

+ (NSString *)transcriptFolder;
+ (void)setTranscriptFolder:(NSString *)value;

+ (BOOL)stopGrowlOnActive;

+ (NSString *)titleForEvent:(GrowlNotificationType)event;
Expand Down
3 changes: 0 additions & 3 deletions Classes/Headers/PreferencesController.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
IBOutlet NSArrayController *keywordsArrayController;
IBOutlet NSArrayController *excludeWordsArrayController;

IBOutlet NSPopUpButton *transcriptFolderButton;
IBOutlet NSPopUpButton *themeButton;
IBOutlet NSPopUpButton *alertButton;
IBOutlet NSPopUpButton *alertSoundButton;
Expand Down Expand Up @@ -83,7 +82,6 @@
@property (nonatomic, retain) NSTableView *installedScriptsTable;
@property (nonatomic, retain) NSArrayController *keywordsArrayController;
@property (nonatomic, retain) NSArrayController *excludeWordsArrayController;
@property (nonatomic, retain) NSPopUpButton *transcriptFolderButton;
@property (nonatomic, retain) NSPopUpButton *themeButton;
@property (nonatomic, retain) NSPopUpButton *alertButton;
@property (nonatomic, retain) NSPopUpButton *alertSoundButton;
Expand All @@ -108,7 +106,6 @@
- (void)onOpenPathToThemes:(id)sender;
- (void)onOpenPathToScripts:(id)sender;
- (void)onChangedTransparency:(id)sender;
- (void)onTranscriptFolderChanged:(id)sender;
- (void)onHighlightLoggingChanged:(id)sender;
- (void)onChangeAlert:(id)sender;
- (void)onUseGrowl:(id)sender;
Expand Down
2 changes: 1 addition & 1 deletion Classes/Library/FileLogger.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ - (void)open

- (NSString *)buildPath
{
NSString *base = [[Preferences transcriptFolder] stringByExpandingTildeInPath];
NSString *base = [NSHomeDirectory() stringByAppendingPathComponent:@"Logs"];

NSString *serv = [[client name] safeFileName];
NSString *chan = [[channel name] safeFileName];
Expand Down
14 changes: 0 additions & 14 deletions Classes/Preferences/Preferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -583,19 +583,6 @@ + (void)setMaxLogLines:(NSInteger)value
[_NSUserDefaults() setInteger:value forKey:@"Preferences.General.max_log_lines"];
}

#pragma mark -
#pragma mark Transcript Folder

+ (NSString *)transcriptFolder
{
return [_NSUserDefaults() objectForKey:@"Preferences.General.transcript_folder"];
}

+ (void)setTranscriptFolder:(NSString *)value
{
[_NSUserDefaults() setObject:value forKey:@"Preferences.General.transcript_folder"];
}

#pragma mark -
#pragma mark Events

Expand Down Expand Up @@ -1023,7 +1010,6 @@ + (void)initPreferences
[d setObject:DEFAULT_TEXTUAL_FONT forKey:@"Preferences.Theme.log_font_name"];
[d setObject:@"<%@%n>" forKey:@"Preferences.Theme.nick_format"];
[d setObject:@"[%H:%M:%S]" forKey:@"Preferences.Theme.timestamp_format"];
[d setObject:@"~/Documents/Textual Logs" forKey:@"Preferences.General.transcript_folder"];

[d setInteger:5 forKey:@"Preferences.General.autojoin_maxchans"];
[d setInteger:300 forKey:@"Preferences.General.max_log_lines"];
Expand Down
Loading

0 comments on commit db12a15

Please sign in to comment.