Fix const + PostNotification() + RegisterNotification()

This commit is contained in:
relikd
2019-08-11 13:21:30 +02:00
parent b081564eca
commit a6c8198234
19 changed files with 69 additions and 56 deletions

View File

@@ -30,8 +30,8 @@
@end
/***/ static const CGFloat IconSize = 18;
/***/ static const CGFloat colWidth = (IconSize + PAD_M); // checkbox column width
/***/ static CGFloat const IconSize = 18;
/***/ static CGFloat const colWidth = (IconSize + PAD_M); // checkbox column width
@implementation SettingsAppearanceView
@@ -63,8 +63,8 @@
/// Create new entry with 1-3 checkboxes and a descriptive label
- (NSTextField*)entry:(char*)m label:(NSString*)text {
static const char* scope[] = { "global", "group", "feed" };
static const char* ident[] = { "TintMenuBarIcon", "UpdateAll", "OpenUnread", "MarkRead", "MarkUnread", "UnreadCount", "TickMark", "ShortNames", "LimitArticles" };
static char* const scope[] = { "global", "group", "feed" };
static char* const ident[] = { "TintMenuBarIcon", "UpdateAll", "OpenUnread", "MarkRead", "MarkUnread", "UnreadCount", "TickMark", "ShortNames", "LimitArticles" };
CGFloat y = PAD_WIN + IconSize + PAD_S + self.row * (PAD_S + HEIGHT_LABEL);
// Add checkboxes: row 0 - 8, col 0 - 2

View File

@@ -40,7 +40,7 @@
self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
CGFloat x = NSWidth(labels.frame) + PAD_S;
static const CGFloat rowHeight = PAD_S + HEIGHT_INPUTFIELD;
static CGFloat const rowHeight = PAD_S + HEIGHT_INPUTFIELD;
[labels placeIn:self x:0 yTop:0];
// 1. row

View File

@@ -48,9 +48,10 @@
- (void)viewDidLoad {
[super viewDidLoad];
// Register for notifications
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(feedUpdated:) name:kNotificationFeedUpdated object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(feedUpdated:) name:kNotificationFeedIconUpdated object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateInProgress:) name:kNotificationBackgroundUpdateInProgress object:nil];
RegisterNotification(kNotificationFeedUpdated, @selector(feedUpdated:), self);
RegisterNotification(kNotificationFeedIconUpdated, @selector(feedUpdated:), self);
RegisterNotification(kNotificationGroupInserted, @selector(groupInserted:), self);
RegisterNotification(kNotificationBackgroundUpdateInProgress, @selector(updateInProgress:), self);
}
- (void)dealloc {
@@ -162,6 +163,11 @@
}
}
/// Callback method fired when feed is inserted via a 'feed://' url
- (void)groupInserted:(NSNotification*)notify {
[self.dataStore fetch:self];
}
#pragma mark - Activity Spinner & Status Info

View File

@@ -49,7 +49,7 @@
- (void)fixCache:(NSButton *)sender {
NSUInteger deleted = [StoreCoordinator deleteUnreferenced];
[StoreCoordinator restoreFeedIndexPaths];
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationTotalUnreadCountReset object:nil];
PostNotification(kNotificationTotalUnreadCountReset, nil);
// show only if >0, but hey, this button will vanish anyway ...
NSAlert *alert = [[NSAlert alloc] init];
alert.messageText = [NSString stringWithFormat:@"Removed %lu unreferenced core data entries.", deleted];

View File

@@ -31,9 +31,9 @@
/// Designated initializer. 'Done' and 'Cancel' buttons will be added automatically.
- (instancetype)initWithView:(NSView*)content {
static const NSInteger minWidth = 320;
static const NSInteger maxWidth = 1200;
static const CGFloat contentOffsetY = PAD_WIN + HEIGHT_BUTTON + PAD_L;
static NSInteger const minWidth = 320;
static NSInteger const maxWidth = 1200;
static CGFloat const contentOffsetY = PAD_WIN + HEIGHT_BUTTON + PAD_L;
NSInteger w = [[NSUserDefaults standardUserDefaults] integerForKey:@"modalSheetWidth"];
if (w < minWidth) w = minWidth;