ref: order code by appearance in UI
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface SettingsGeneral : NSViewController
|
@interface SettingsGeneral : NSViewController
|
||||||
- (void)changeHttpApplication:(NSPopUpButton *)sender;
|
|
||||||
- (void)clickHowToDefaults:(NSButton *)sender;
|
- (void)clickHowToDefaults:(NSButton *)sender;
|
||||||
|
- (void)changeHttpApplication:(NSPopUpButton *)sender;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -13,19 +13,21 @@
|
|||||||
|
|
||||||
- (void)loadView {
|
- (void)loadView {
|
||||||
self.view = [[SettingsGeneralView alloc] initWithController:self];
|
self.view = [[SettingsGeneralView alloc] initWithController:self];
|
||||||
// Default http application for opening the feed urls
|
|
||||||
NSPopUpButton *pop = self.view.popupHttpApplication;
|
|
||||||
[pop removeAllItems];
|
|
||||||
[pop addItemWithTitle:NSLocalizedString(@"System Default", @"Default web browser application")];
|
|
||||||
NSArray<NSString*> *browsers = CFBridgingRelease(LSCopyAllHandlersForURLScheme(CFSTR("https")));
|
|
||||||
for (NSString *bundleID in browsers) {
|
|
||||||
[pop addItemWithTitle: [self applicationNameForBundleId:bundleID]];
|
|
||||||
pop.lastItem.representedObject = bundleID;
|
|
||||||
}
|
|
||||||
[pop selectItemAtIndex:[pop indexOfItemWithRepresentedObject:UserPrefsString(Pref_defaultHttpApplication)]];
|
|
||||||
// Default RSS Reader application
|
// Default RSS Reader application
|
||||||
NSString *feedBundleId = CFBridgingRelease(LSCopyDefaultHandlerForURLScheme(CFSTR("feed")));
|
NSString *feedBundleId = CFBridgingRelease(LSCopyDefaultHandlerForURLScheme(CFSTR("feed")));
|
||||||
self.view.defaultReader.objectValue = [self applicationNameForBundleId:feedBundleId];
|
self.view.defaultReader.objectValue = [self applicationNameForBundleId:feedBundleId];
|
||||||
|
|
||||||
|
// Default http application for opening the feed urls
|
||||||
|
NSPopUpButton *defaultApp = self.view.popupHttpApplication;
|
||||||
|
[defaultApp removeAllItems];
|
||||||
|
[defaultApp addItemWithTitle:NSLocalizedString(@"System Default", @"Default web browser application")];
|
||||||
|
NSArray<NSString*> *browsers = CFBridgingRelease(LSCopyAllHandlersForURLScheme(CFSTR("https")));
|
||||||
|
for (NSString *bundleID in browsers) {
|
||||||
|
[defaultApp addItemWithTitle: [self applicationNameForBundleId:bundleID]];
|
||||||
|
defaultApp.lastItem.representedObject = bundleID;
|
||||||
|
}
|
||||||
|
[defaultApp selectItemAtIndex:[defaultApp indexOfItemWithRepresentedObject:UserPrefsString(Pref_defaultHttpApplication)]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get human readable application name such as 'Safari' or 'baRSS'
|
/// Get human readable application name such as 'Safari' or 'baRSS'
|
||||||
@@ -41,11 +43,6 @@
|
|||||||
|
|
||||||
#pragma mark - User interaction
|
#pragma mark - User interaction
|
||||||
|
|
||||||
// Callback method fired when user selects a different item from popup list
|
|
||||||
- (void)changeHttpApplication:(NSPopUpButton *)sender {
|
|
||||||
UserPrefsSet(Pref_defaultHttpApplication, sender.selectedItem.representedObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Callback method from round help button right of default feed reader text
|
// Callback method from round help button right of default feed reader text
|
||||||
- (void)clickHowToDefaults:(NSButton *)sender {
|
- (void)clickHowToDefaults:(NSButton *)sender {
|
||||||
NSAlert *alert = [[NSAlert alloc] init];
|
NSAlert *alert = [[NSAlert alloc] init];
|
||||||
@@ -63,4 +60,9 @@
|
|||||||
|
|
||||||
// x-apple.systempreferences:com.apple.preferences.users?startupItemsPref
|
// x-apple.systempreferences:com.apple.preferences.users?startupItemsPref
|
||||||
|
|
||||||
|
// Callback method fired when user selects a different item from popup list
|
||||||
|
- (void)changeHttpApplication:(NSPopUpButton *)sender {
|
||||||
|
UserPrefsSet(Pref_defaultHttpApplication, sender.selectedItem.representedObject);
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@interface SettingsGeneralView : NSView
|
@interface SettingsGeneralView : NSView
|
||||||
@property (strong) IBOutlet NSPopUpButton* popupHttpApplication;
|
|
||||||
@property (strong) IBOutlet NSTextField *defaultReader;
|
@property (strong) IBOutlet NSTextField *defaultReader;
|
||||||
|
@property (strong) IBOutlet NSPopUpButton* popupHttpApplication;
|
||||||
|
|
||||||
- (instancetype)initWithController:(SettingsGeneral*)controller NS_DESIGNATED_INITIALIZER;
|
- (instancetype)initWithController:(SettingsGeneral*)controller NS_DESIGNATED_INITIALIZER;
|
||||||
- (instancetype)initWithFrame:(NSRect)frameRect NS_UNAVAILABLE;
|
- (instancetype)initWithFrame:(NSRect)frameRect NS_UNAVAILABLE;
|
||||||
|
|||||||
Reference in New Issue
Block a user