Skip to content

Commit

Permalink
Internal Name Cleanup
Browse files Browse the repository at this point in the history
Remove the "Delegate" suffix from class names since it doesn't add any
useful information. Almost everything is a delegate of something. Also
rename other classes that have unsuitable names.
  • Loading branch information
cbreak-black committed Aug 25, 2019
1 parent e19405e commit 7538e6d
Show file tree
Hide file tree
Showing 16 changed files with 97 additions and 110 deletions.
72 changes: 36 additions & 36 deletions ZetaWatch.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ZetaWatch/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@
<outlet property="zetaMenu" destination="Xld-Up-BZ8" id="YRA-tL-FBE"/>
</connections>
</customObject>
<customObject id="8rf-zp-5r9" userLabel="ZetaMenuDelegate" customClass="ZetaMenuDelegate">
<customObject id="8rf-zp-5r9" userLabel="ZetaMainMenu" customClass="ZetaMainMenu">
<connections>
<outlet property="_authorization" destination="GUh-uV-dxo" id="LTt-go-j7Z"/>
<outlet property="notificationCenter" destination="ZZj-pd-85j" id="DDy-Za-7rV"/>
<outlet property="poolWatcher" destination="Gim-eq-VbR" id="Sat-ah-3Qq"/>
<outlet property="zetaKeyLoader" destination="R7D-cp-kuE" id="aMW-DQ-FcT"/>
</connections>
</customObject>
<customObject id="geo-tu-CMM" userLabel="ZetaImportMenuDelegate" customClass="ZetaImportMenuDelegate">
<customObject id="geo-tu-CMM" userLabel="ZetaImportMenu" customClass="ZetaImportMenu">
<connections>
<outlet property="_authorization" destination="GUh-uV-dxo" id="Psx-ls-DeC"/>
<outlet property="autoImporter" destination="PVX-FU-gbc" id="Wpo-l0-uGC"/>
<outlet property="importMenu" destination="fE9-G4-NH4" id="jfo-ja-1Zj"/>
<outlet property="poolWatcher" destination="Gim-eq-VbR" id="aD3-N2-eyI"/>
</connections>
</customObject>
<customObject id="R7D-cp-kuE" userLabel="ZetaKeyLoaderDelegate" customClass="ZetaKeyLoaderDelegate">
<customObject id="R7D-cp-kuE" userLabel="ZetaKeyLoader" customClass="ZetaKeyLoader">
<connections>
<outlet property="_authorization" destination="GUh-uV-dxo" id="j1a-fu-F0a"/>
<outlet property="passwordField" destination="JpZ-yq-Swt" id="wki-ew-pno"/>
Expand Down
4 changes: 2 additions & 2 deletions ZetaWatch/ZetaAutoImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

#import <Cocoa/Cocoa.h>

#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"
#import "ZetaPoolWatcher.h"

#include "ZFSUtils.hpp"

#include <vector>

@interface ZetaAutoImporter : ZetaBaseDelegate<ZetaPoolWatcherDelegate>
@interface ZetaAutoImporter : ZetaMenuBase<ZetaPoolWatcherDelegate>

- (id)init;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ZetaFileSystemPropertyMenuDelegate.h
// ZetaFileSystemPropertyMenu.h
// ZetaWatch
//
// Created by cbreak on 19.06.22.
Expand All @@ -9,18 +9,14 @@
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>

#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"

#include "ZFSUtils.hpp"

NS_ASSUME_NONNULL_BEGIN

@interface ZetaFileSystemPropertyMenuDelegate : ZetaBaseDelegate <NSMenuDelegate>
@interface ZetaFileSystemPropertyMenu : ZetaMenuBase <NSMenuDelegate>

- (id)initWithFileSystem:(zfs::ZFileSystem &&)fs;

- (void)menuNeedsUpdate:(NSMenu*)menu;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// ZetaFileSystemPropertyMenuDelegate.mm
// ZetaFileSystemPropertyMenu.mm
// ZetaWatch
//
// Created by cbreak on 19.06.22.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#import "ZetaFileSystemPropertyMenuDelegate.h"
#import "ZetaFileSystemPropertyMenu.h"

@implementation ZetaFileSystemPropertyMenuDelegate
@implementation ZetaFileSystemPropertyMenu
{
zfs::ZFileSystem _fs;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//
// ZetaImportMenuDelegate.h
// ZetaImportMenu.h
// ZetaWatch
//
// Created by cbreak on 19.06.02.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#ifndef ZetaImportMenuDelegate_h
#define ZetaImportMenuDelegate_h
#ifndef ZetaImportMenu_h
#define ZetaImportMenu_h

#import <Cocoa/Cocoa.h>

#import "ZetaAuthorization.h"
#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"
#import "ZetaAutoImporter.h"

@class ZetaPoolWatcher;

@interface ZetaImportMenuDelegate : ZetaBaseDelegate <NSMenuDelegate>
@interface ZetaImportMenu : ZetaMenuBase <NSMenuDelegate>

@property (weak) IBOutlet NSMenu * importMenu;
@property (weak) IBOutlet ZetaPoolWatcher * poolWatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
//
// ZetaImportMenuDelegate.m
// ZetaImportMenu.m
// ZetaWatch
//
// Created by cbreak on 19.06.02.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#import "ZetaImportMenuDelegate.h"
#import "ZetaImportMenu.h"

#import "ZetaAuthorization.h"
#import "ZetaPoolWatcher.h"

#include "ZFSStrings.hpp"

@implementation ZetaImportMenuDelegate
@implementation ZetaImportMenu

- (void)menuNeedsUpdate:(NSMenu*)menu
{
Expand Down
10 changes: 3 additions & 7 deletions ZetaWatch/ZetaKeyLoaderDelegate.h → ZetaWatch/ZetaKeyLoader.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ZetaKeyLoaderDelegate.h
// ZetaKeyLoader.h
// ZetaWatch
//
// Created by cbreak on 19.06.16.
Expand All @@ -8,12 +8,10 @@

#import <Cocoa/Cocoa.h>

#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"
#import "ZetaPoolWatcher.h"

NS_ASSUME_NONNULL_BEGIN

@interface ZetaKeyLoaderDelegate : ZetaBaseDelegate <NSPopoverDelegate,ZetaPoolWatcherDelegate>
@interface ZetaKeyLoader : ZetaMenuBase <NSPopoverDelegate,ZetaPoolWatcherDelegate>

@property (weak) NSStatusItem * statusItem;
@property (weak) IBOutlet NSPopover * popover;
Expand All @@ -32,5 +30,3 @@ NS_ASSUME_NONNULL_BEGIN
- (BOOL)popoverShouldDetach:(NSPopover *)popover;

@end

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
//
// ZetaKeyLoaderDelegate.m
// ZetaKeyLoader.m
// ZetaWatch
//
// Created by cbreak on 19.06.16.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#import "ZetaKeyLoaderDelegate.h"
#import "ZetaKeyLoader.h"

#include <deque>

@interface ZetaKeyLoaderDelegate ()
@interface ZetaKeyLoader ()
{
std::deque<NSString*> filesystems;
}

@end

@implementation ZetaKeyLoaderDelegate
@implementation ZetaKeyLoader

- (void)awakeFromNib
{
Expand Down
10 changes: 5 additions & 5 deletions ZetaWatch/ZetaMenuDelegate.h → ZetaWatch/ZetaMainMenu.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ZetaMenuDelegate.h
// ZetaMainMenu.h
// ZetaWatch
//
// Created by Gerhard Röthlin on 2015.12.20.
Expand All @@ -13,10 +13,10 @@
#import <Cocoa/Cocoa.h>

#import "ZetaPoolWatcher.h"
#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"
#import "ZetaPoolWatcher.h"
#import "ZetaAutoImporter.h"
#import "ZetaKeyLoaderDelegate.h"
#import "ZetaKeyLoader.h"

@class ZetaNotificationCenter;

Expand All @@ -26,10 +26,10 @@ enum ZetaMenuTags
ActionAnchorMenuTag = 101
};

@interface ZetaMenuDelegate : ZetaBaseDelegate <NSMenuDelegate>
@interface ZetaMainMenu : ZetaMenuBase <NSMenuDelegate>

@property (weak) IBOutlet ZetaPoolWatcher * poolWatcher;
@property (weak) IBOutlet ZetaKeyLoaderDelegate * zetaKeyLoader;
@property (weak) IBOutlet ZetaKeyLoader * zetaKeyLoader;
@property (weak) IBOutlet ZetaNotificationCenter * notificationCenter;

- (IBAction)mountAllFilesystems:(id)sender;
Expand Down
24 changes: 12 additions & 12 deletions ZetaWatch/ZetaMenuDelegate.mm → ZetaWatch/ZetaMainMenu.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// ZetaMenuDelegate.mm
// ZetaMainMenu.mm
// ZetaWatch
//
// Created by Gerhard Röthlin on 2015.12.20.
Expand All @@ -10,12 +10,12 @@
// Additional licensing options are described in the README file.
//

#import "ZetaMenuDelegate.h"
#import "ZetaImportMenuDelegate.h"
#import "ZetaMainMenu.h"
#import "ZetaImportMenu.h"
#import "ZetaPoolWatcher.h"
#import "ZetaAuthorization.h"
#import "ZetaFileSystemPropertyMenuDelegate.h"
#import "ZetaPoolPropertyMenuDelegate.h"
#import "ZetaFileSystemPropertyMenu.h"
#import "ZetaPoolPropertyMenu.h"
#import "ZetaNotificationCenter.h"

#include "ZFSUtils.hpp"
Expand All @@ -28,15 +28,15 @@
#include <sstream>
#include <chrono>

@interface ZetaMenuDelegate ()
@interface ZetaMainMenu ()
{
NSMutableArray * _dynamicMenus;
DASessionRef _diskArbitrationSession;
}

@end

@implementation ZetaMenuDelegate
@implementation ZetaMainMenu

- (id)init
{
Expand Down Expand Up @@ -105,7 +105,7 @@ - (void)menuNeedsUpdate:(NSMenu*)menu

#pragma mark ZFS Inspection

NSMenu * createFSMenu(zfs::ZFileSystem && fs, ZetaMenuDelegate * delegate)
NSMenu * createFSMenu(zfs::ZFileSystem && fs, ZetaMainMenu * delegate)
{
NSMenu * fsMenu = [[NSMenu alloc] init];
[fsMenu setAutoenablesItems:NO];
Expand Down Expand Up @@ -163,7 +163,7 @@ - (void)menuNeedsUpdate:(NSMenu*)menu
// All Properties
[fsMenu addItem:[NSMenuItem separatorItem]];
NSMenu * allProps = [[NSMenu alloc] initWithTitle:@"All Properties"];
ZetaFileSystemPropertyMenuDelegate * pd = [[ZetaFileSystemPropertyMenuDelegate alloc] initWithFileSystem:std::move(fs)];
ZetaFileSystemPropertyMenu * pd = [[ZetaFileSystemPropertyMenu alloc] initWithFileSystem:std::move(fs)];
allProps.delegate = pd;
NSMenuItem * allPropsItem = [[NSMenuItem alloc] initWithTitle:@"All Properties" action:nullptr keyEquivalent:@""];
allPropsItem.submenu = allProps;
Expand Down Expand Up @@ -195,7 +195,7 @@ - (void)menuNeedsUpdate:(NSMenu*)menu
}

NSMenuItem * addVdev(zfs::ZPool const & pool, zfs::NVList const & device,
NSMenu * menu, DASessionRef daSession, ZetaMenuDelegate * delegate)
NSMenu * menu, DASessionRef daSession, ZetaMainMenu * delegate)
{
// Menu Item
auto stat = zfs::vdevStat(device);
Expand Down Expand Up @@ -237,7 +237,7 @@ - (void)menuNeedsUpdate:(NSMenu*)menu
return item;
}

NSMenu * createVdevMenu(zfs::ZPool && pool, ZetaMenuDelegate * delegate, DASessionRef daSession)
NSMenu * createVdevMenu(zfs::ZPool && pool, ZetaMainMenu * delegate, DASessionRef daSession)
{
NSMenu * vdevMenu = [[NSMenu alloc] init];
[vdevMenu setAutoenablesItems:NO];
Expand Down Expand Up @@ -366,7 +366,7 @@ - (void)menuNeedsUpdate:(NSMenu*)menu
// All Properties
[vdevMenu addItem:[NSMenuItem separatorItem]];
NSMenu * allProps = [[NSMenu alloc] initWithTitle:@"All Properties"];
ZetaPoolPropertyMenuDelegate * pd = [[ZetaPoolPropertyMenuDelegate alloc] initWithPool:std::move(pool)];
ZetaPoolPropertyMenu * pd = [[ZetaPoolPropertyMenu alloc] initWithPool:std::move(pool)];
allProps.delegate = pd;
NSMenuItem * allPropsItem = [[NSMenuItem alloc] initWithTitle:@"All Properties" action:nullptr keyEquivalent:@""];
allPropsItem.submenu = allProps;
Expand Down
12 changes: 6 additions & 6 deletions ZetaWatch/ZetaBaseDelegate.h → ZetaWatch/ZetaMenuBase.h
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
//
// ZetaBaseDelegate.h
// ZetaMenuBase.h
// ZetaWatch
//
// Created by cbreak on 19.06.02.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#ifndef ZetaBaseDelegate_h
#define ZetaBaseDelegate_h
#ifndef ZetaMenuBase_h
#define ZetaMenuBase_h

#import <Cocoa/Cocoa.h>

#import "ZetaAuthorization.h"

#include "ZetaFormatHelpers.hpp"

@interface ZetaBaseDelegate : NSObject
@interface ZetaMenuBase : NSObject
{
IBOutlet ZetaAuthorization * _authorization;
}
Expand Down Expand Up @@ -51,7 +51,7 @@ NSString * formatNSString(NSString * format, T const & t, U const & u, V const &
}

template<typename... T>
NSMenuItem * addMenuItem(NSMenu * menu, ZetaBaseDelegate * delegate,
NSMenuItem * addMenuItem(NSMenu * menu, ZetaMenuBase * delegate,
NSString * format, T const & ... t)
{
auto title = formatNSString(format, t...);
Expand All @@ -61,4 +61,4 @@ NSMenuItem * addMenuItem(NSMenu * menu, ZetaBaseDelegate * delegate,
return item;
}

#endif /* ZetaBaseDelegate_h */
#endif /* ZetaMenuBase_h */
6 changes: 3 additions & 3 deletions ZetaWatch/ZetaBaseDelegate.mm → ZetaWatch/ZetaMenuBase.mm
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//
// ZetaBaseDelegate.mm
// ZetaMenuBase.mm
// ZetaWatch
//
// Created by cbreak on 19.06.02.
// Copyright © 2019 the-color-black.net. All rights reserved.
//

#import "ZetaBaseDelegate.h"
#import "ZetaMenuBase.h"

@implementation ZetaBaseDelegate
@implementation ZetaMenuBase

- (void)errorFromHelper:(NSError*)error
{
Expand Down
Loading

0 comments on commit 7538e6d

Please sign in to comment.