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.
 
 
 
 

72 lines
1.6 KiB

  1. /*
  2. Copyright 2017 Virgil Dupras
  3. This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
  4. which should be included with this package. The terms are also available at
  5. http://www.gnu.org/licenses/gpl-3.0.html
  6. */
  7. #import "DeletionOptions.h"
  8. #import "HSPyUtil.h"
  9. @implementation DeletionOptions
  10. @synthesize messageTextField;
  11. @synthesize linkButton;
  12. @synthesize linkTypeRadio;
  13. @synthesize directButton;
  14. - (id)initWithPyRef:(PyObject *)aPyRef
  15. {
  16. self = [super initWithWindowNibName:@"DeletionOptions"];
  17. [self window];
  18. model = [[PyDeletionOptions alloc] initWithModel:aPyRef];
  19. [model bindCallback:createCallback(@"DeletionOptionsView", self)];
  20. return self;
  21. }
  22. - (void)dealloc
  23. {
  24. [model release];
  25. [super dealloc];
  26. }
  27. - (IBAction)updateOptions:(id)sender
  28. {
  29. [model setLinkDeleted:[linkButton state] == NSControlStateValueOn];
  30. [model setUseHardlinks:[linkTypeRadio selectedColumn] == 1];
  31. [model setDirect:[directButton state] == NSControlStateValueOn];
  32. }
  33. - (IBAction)proceed:(id)sender
  34. {
  35. [NSApp stopModalWithCode:NSModalResponseOK];
  36. }
  37. - (IBAction)cancel:(id)sender
  38. {
  39. [NSApp stopModalWithCode:NSModalResponseCancel];
  40. }
  41. /* model --> view */
  42. - (void)updateMsg:(NSString *)msg
  43. {
  44. [messageTextField setStringValue:msg];
  45. }
  46. - (BOOL)show
  47. {
  48. [linkButton setState:NSControlStateValueOff];
  49. [directButton setState:NSControlStateValueOff];
  50. [linkTypeRadio selectCellAtRow:0 column:0];
  51. NSInteger r = [NSApp runModalForWindow:[self window]];
  52. [[self window] close];
  53. return r == NSModalResponseOK;
  54. }
  55. - (void)setHardlinkOptionEnabled:(BOOL)enabled
  56. {
  57. [linkTypeRadio setEnabled:enabled];
  58. }
  59. @end