Skip to content

Commit

Permalink
Make URL support for loading prefs explicit in ui. Improve error mess…
Browse files Browse the repository at this point in the history
…age on failed URL prefs load. Fix URL prefs loading.
  • Loading branch information
gnachman committed Aug 11, 2011
1 parent beb1c87 commit 247a06e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
12 changes: 6 additions & 6 deletions English.lproj/PreferencePanel.xib
Expand Up @@ -12,7 +12,7 @@
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1947"/>
<integer value="1924"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand Down Expand Up @@ -973,13 +973,13 @@
<object class="NSButton" id="731675876">
<reference key="NSNextResponder" ref="505411774"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{64, 54}, {261, 18}}</string>
<string key="NSFrame">{{64, 54}, {354, 18}}</string>
<reference key="NSSuperview" ref="505411774"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="71661080">
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Load preferences from custom folder:</string>
<string key="NSContents">Load preferences from a user-defined folder or URL:</string>
<reference key="NSSupport" ref="966507434"/>
<reference key="NSControlView" ref="731675876"/>
<int key="NSButtonFlags">1211912703</int>
Expand Down Expand Up @@ -1032,13 +1032,13 @@
<object class="NSButton" id="916346445">
<reference key="NSNextResponder" ref="505411774"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{434, 20}, {234, 32}}</string>
<string key="NSFrame">{{434, 20}, {184, 32}}</string>
<reference key="NSSuperview" ref="505411774"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="53419469">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags">-2080244224</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Copy Curent Settings to Folder</string>
<string key="NSContents">Save Settings to Folder</string>
<reference key="NSSupport" ref="966507434"/>
<reference key="NSControlView" ref="916346445"/>
<int key="NSButtonFlags">-2038284033</int>
Expand Down
8 changes: 5 additions & 3 deletions PreferencePanel.m
Expand Up @@ -1255,7 +1255,7 @@ - (void)run
[showWindowBorder setState:defaultShowWindowBorder?NSOnState:NSOffState];
[lionStyleFullscreen setState:defaultLionStyleFullscreen?NSOnState:NSOffState];
[loadPrefsFromCustomFolder setState:defaultLoadPrefsFromCustomFolder?NSOnState:NSOffState];
[prefsCustomFolder setStringValue:defaultPrefsCustomFolder];
[prefsCustomFolder setStringValue:defaultPrefsCustomFolder ? defaultPrefsCustomFolder : @""];

[self showWindow: self];
[[self window] setLevel:NSNormalWindowLevel];
Expand Down Expand Up @@ -1910,8 +1910,10 @@ - (BOOL)loadPrefs
if ([folder hasPrefix:@"http://"] ||
[folder hasPrefix:@"https://"]) {

filename = folder;

// Download the URL's contents.
NSURL *url = [NSURL URLWithString:folder];
NSURL *url = [NSURL URLWithString:filename];
const NSTimeInterval kFetchTimeout = 5.0;
NSURLRequest *req = [NSURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy
Expand Down Expand Up @@ -2679,7 +2681,7 @@ - (IBAction)pushToCustomFolder:(id)sender
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"To make it available, manually copy ~/Library/Preferences/com.googlecode.iterm2.plist to your hosting provider to be served at %@", folder] runModal];
informativeTextWithFormat:@"To make it available, first quit iTerm2 and then manually copy ~/Library/Preferences/com.googlecode.iterm2.plist to your hosting provider."] runModal];
return;
}
isOk = [myDict writeToFile:filename atomically:YES];
Expand Down
2 changes: 1 addition & 1 deletion iTermApplicationDelegate.m
Expand Up @@ -92,8 +92,8 @@ - (void)applicationWillFinishLaunching:(NSNotification *)aNotification

// read preferences
[PreferencePanel migratePreferences];
[ITAddressBookMgr sharedInstance];
[PreferencePanel sharedInstance];
[ITAddressBookMgr sharedInstance];

[self setFutureApplicationPresentationOptions:NSApplicationPresentationFullScreen unset:0];
}
Expand Down

0 comments on commit 247a06e

Please sign in to comment.