Permalink
Browse files

Disable 'show file name' pref for pre 10.10

Instead of removing the UI element completely I chose
to simply disable the button if the OS is pre 10.10.

It seemed like the easiest fix and the UI doesn't look
'unbalanced' if i just disable it.

Fixes #73
  • Loading branch information...
trevershick committed Nov 17, 2015
1 parent c85bf6c commit 53f333b275ac27d746b1a64ff3b5acb40cdde68d
Showing with 25 additions and 3 deletions.
  1. +5 −3 Preferences.xib
  2. +2 −0 Source/PreferenceController.h
  3. +18 −0 Source/PreferenceController.m
View
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment version="1060" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PreferenceController">
@@ -14,13 +14,14 @@
<outlet property="hotkeysView" destination="106" id="107"/>
<outlet property="remoteIntervalSlider" destination="159" id="167"/>
<outlet property="remoteView" destination="156" id="157"/>
+ <outlet property="showHostFileNameButton" destination="jeQ-Jp-Iks" id="klK-gR-qYN"/>
<outlet property="updateHotkey" destination="170" id="173"/>
<outlet property="updateView" destination="47" id="52"/>
<outlet property="window" destination="1" id="13"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
- <customObject id="-3" userLabel="Application"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" hidesOnDeactivate="YES" oneShot="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="1" userLabel="Preferences">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" bottomStrut="YES"/>
@@ -131,6 +132,7 @@
</button>
</subviews>
<animations/>
+ <point key="canvasLocation" x="474" y="443"/>
</customView>
<customObject id="58" customClass="SUUpdater"/>
<customView id="95" userLabel="Editor">
@@ -26,6 +26,8 @@
IBOutlet NSView *generalView, *editorView, *hotkeysView, *updateView, *remoteView;
LoginItem *loginItem;
+ __unsafe_unretained IBOutlet NSButton *showHostFileNameButton;
+
// Remote
IBOutlet NSSlider *remoteIntervalSlider;
NSDictionary *remoteIntervals;
@@ -25,6 +25,7 @@
#import "Preferences+Remote.h"
#import "LoginItem.h"
#import "Hotkey.h"
+#import "Util.h"
#define TOOLBAR_GENERAL @"TOOLBAR_GENERAL"
#define TOOLBAR_EDITOR @"TOOLBAR_EDITOR"
@@ -42,6 +43,10 @@ @interface PreferenceController (Hotkeys)
- (void)initHotkeys;
@end
+@interface PreferenceController (General)
+- (void)initGeneral;
+@end
+
@implementation PreferenceController
- (id)init
@@ -69,6 +74,7 @@ - (void) awakeFromNib
loginItem = [LoginItem new];
[loginItem bind:@"enabled" toObject:[Preferences instance] withKeyPath:@"values.openAtLogin" options:nil];
+ [self initGeneral];
[self initRemote];
[self initHotkeys];
}
@@ -153,6 +159,18 @@ - (void) setPreferenceView:(id)sender
@end
+@implementation PreferenceController (General)
+/**
+ * OS X 10.10 and later support the NSStatusItemBar button which is what the
+ * "Show Host File Name in Status Bar" feature is built upon. So if we're
+ * not 10.10 or above, then we need to disable the preference selection.
+ */
+- (void) initGeneral
+{
+ showHostFileNameButton.enabled = ![Util isPre10_10];
+}
+@end
+
@implementation PreferenceController (Remote)
- (void)initRemote

0 comments on commit 53f333b

Please sign in to comment.