Chromium Updater
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.1 KiB

13 years ago
  1. //
  2. // MGMAdvancedPane.m
  3. // Chromatic
  4. //
  5. // Created by Mr. Gecko on 6/10/11.
  6. // Copyright (c) 2011 Mr. Gecko's Media (James Coleman). http://mrgeckosmedia.com/
  7. //
  8. // Permission to use, copy, modify, and/or distribute this software for any purpose
  9. // with or without fee is hereby granted, provided that the above copyright notice
  10. // and this permission notice appear in all copies.
  11. //
  12. // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  13. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  14. // FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
  15. // OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  16. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  17. // ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. //
  19. #import "MGMAdvancedPane.h"
  20. #import "MGMController.h"
  21. #import <MGMUsers/MGMUsers.h>
  22. @implementation MGMAdvancedPane
  23. - (id)initWithPreferences:(MGMPreferences *)thePreferences {
  24. if ((self = [super initWithPreferences:thePreferences])) {
  25. if (![NSBundle loadNibNamed:@"AdvancedPane" owner:self]) {
  26. NSLog(@"Unable to load Nib for Advanced Preferences");
  27. [self release];
  28. self = nil;
  29. } else {
  30. if ([preferences stringForKey:MGMCustomSnapshotURL]!=nil)
  31. [snapshotField setStringValue:[preferences stringForKey:MGMCustomSnapshotURL]];
  32. [trashButton setState:([preferences boolForKey:MGMMoveToTrash] ? NSOnState : NSOffState)];
  33. }
  34. }
  35. return self;
  36. }
  37. - (void)dealloc {
  38. [self save:self];
  39. [mainView release];
  40. [super dealloc];
  41. }
  42. + (void)setUpToolbarItem:(NSToolbarItem *)theItem {
  43. [theItem setLabel:[self title]];
  44. [theItem setPaletteLabel:[theItem label]];
  45. [theItem setImage:[NSImage imageNamed:@"Advanced"]];
  46. }
  47. + (NSString *)title {
  48. return @"Advanced";
  49. }
  50. - (NSView *)preferencesView {
  51. return mainView;
  52. }
  53. - (IBAction)save:(id)sender {
  54. [preferences setObject:[snapshotField stringValue] forKey:MGMCustomSnapshotURL];
  55. [preferences setBool:([trashButton state]==NSOnState) forKey:MGMMoveToTrash];
  56. }
  57. @end