From 46fa89880712849ecf46bfa755991ea3dbd38cd1 Mon Sep 17 00:00:00 2001 From: relikd Date: Fri, 24 Oct 2025 00:15:14 +0200 Subject: [PATCH] ref: order code by appearance in UI --- .../Preferences/General Tab/SettingsGeneral.h | 2 +- .../Preferences/General Tab/SettingsGeneral.m | 32 ++++++++++--------- .../General Tab/SettingsGeneralView.h | 2 +- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/baRSS/Preferences/General Tab/SettingsGeneral.h b/baRSS/Preferences/General Tab/SettingsGeneral.h index 4de273e..f10ce00 100644 --- a/baRSS/Preferences/General Tab/SettingsGeneral.h +++ b/baRSS/Preferences/General Tab/SettingsGeneral.h @@ -3,8 +3,8 @@ NS_ASSUME_NONNULL_BEGIN @interface SettingsGeneral : NSViewController -- (void)changeHttpApplication:(NSPopUpButton *)sender; - (void)clickHowToDefaults:(NSButton *)sender; +- (void)changeHttpApplication:(NSPopUpButton *)sender; @end NS_ASSUME_NONNULL_END diff --git a/baRSS/Preferences/General Tab/SettingsGeneral.m b/baRSS/Preferences/General Tab/SettingsGeneral.m index 35776e8..cdf2fcc 100644 --- a/baRSS/Preferences/General Tab/SettingsGeneral.m +++ b/baRSS/Preferences/General Tab/SettingsGeneral.m @@ -13,19 +13,21 @@ - (void)loadView { 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 *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 NSString *feedBundleId = CFBridgingRelease(LSCopyDefaultHandlerForURLScheme(CFSTR("feed"))); 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 *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' @@ -41,11 +43,6 @@ #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 - (void)clickHowToDefaults:(NSButton *)sender { NSAlert *alert = [[NSAlert alloc] init]; @@ -63,4 +60,9 @@ // 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 diff --git a/baRSS/Preferences/General Tab/SettingsGeneralView.h b/baRSS/Preferences/General Tab/SettingsGeneralView.h index 616618a..ca08d75 100644 --- a/baRSS/Preferences/General Tab/SettingsGeneralView.h +++ b/baRSS/Preferences/General Tab/SettingsGeneralView.h @@ -4,8 +4,8 @@ NS_ASSUME_NONNULL_BEGIN @interface SettingsGeneralView : NSView -@property (strong) IBOutlet NSPopUpButton* popupHttpApplication; @property (strong) IBOutlet NSTextField *defaultReader; +@property (strong) IBOutlet NSPopUpButton* popupHttpApplication; - (instancetype)initWithController:(SettingsGeneral*)controller NS_DESIGNATED_INITIALIZER; - (instancetype)initWithFrame:(NSRect)frameRect NS_UNAVAILABLE;