Skip to content

Commit 35ae7ba

Browse files
authored
Merge pull request #734 from barijaona/bugfixes
Fix issue #730 and simplify code
2 parents a939f36 + 5a3f3c2 commit 35ae7ba

10 files changed

+139
-645
lines changed

Interfaces/Downloads.nib/designable.nib

+104-522
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
457 Bytes
Binary file not shown.

Vienna.xcodeproj/project.pbxproj

-6
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@
643643
AAA305FF0682A25200E4A6DC /* TableViewExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = AAA305FD0682A25200E4A6DC /* TableViewExtensions.m */; };
644644
AAB90EFD061D059D00CA4741 /* searchFolder.tiff in Resources */ = {isa = PBXBuildFile; fileRef = AAB90EFC061D059D00CA4741 /* searchFolder.tiff */; };
645645
AABCF9A508FF562E00984F78 /* pressedCloseButton.tiff in Resources */ = {isa = PBXBuildFile; fileRef = AABCF9A408FF562E00984F78 /* pressedCloseButton.tiff */; };
646-
AABCFB1B0900BA4E00984F78 /* SquareWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCFB190900BA4E00984F78 /* SquareWindow.m */; };
647646
AACAEA3E0954E71100ACD502 /* DemoFeeds.plist in Resources */ = {isa = PBXBuildFile; fileRef = AACAEA3D0954E71100ACD502 /* DemoFeeds.plist */; };
648647
AAD2BF620C2C41A200AA0F11 /* DBListSplitViewBar.tiff in Resources */ = {isa = PBXBuildFile; fileRef = AAD2BF600C2C41A200AA0F11 /* DBListSplitViewBar.tiff */; };
649648
AAD2BF630C2C41A200AA0F11 /* DBListSplitViewDimple.tiff in Resources */ = {isa = PBXBuildFile; fileRef = AAD2BF610C2C41A200AA0F11 /* DBListSplitViewDimple.tiff */; };
@@ -1550,8 +1549,6 @@
15501549
AAA305FD0682A25200E4A6DC /* TableViewExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TableViewExtensions.m; path = src/TableViewExtensions.m; sourceTree = SOURCE_ROOT; };
15511550
AAB90EFC061D059D00CA4741 /* searchFolder.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = searchFolder.tiff; path = Resources/searchFolder.tiff; sourceTree = SOURCE_ROOT; };
15521551
AABCF9A408FF562E00984F78 /* pressedCloseButton.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = pressedCloseButton.tiff; path = Resources/pressedCloseButton.tiff; sourceTree = SOURCE_ROOT; };
1553-
AABCFB180900BA4E00984F78 /* SquareWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = SquareWindow.h; path = src/SquareWindow.h; sourceTree = SOURCE_ROOT; };
1554-
AABCFB190900BA4E00984F78 /* SquareWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = SquareWindow.m; path = src/SquareWindow.m; sourceTree = SOURCE_ROOT; };
15551552
AACAEA3D0954E71100ACD502 /* DemoFeeds.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DemoFeeds.plist; path = Resources/DemoFeeds.plist; plistStructureDefinitionIdentifier = "<none>"; sourceTree = SOURCE_ROOT; };
15561553
AAD2BF600C2C41A200AA0F11 /* DBListSplitViewBar.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = DBListSplitViewBar.tiff; path = Resources/DBListSplitViewBar.tiff; sourceTree = SOURCE_ROOT; };
15571554
AAD2BF610C2C41A200AA0F11 /* DBListSplitViewDimple.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = DBListSplitViewDimple.tiff; path = Resources/DBListSplitViewDimple.tiff; sourceTree = SOURCE_ROOT; };
@@ -2862,8 +2859,6 @@
28622859
4350283D165DE7F60018EDB7 /* NSNotificationAdditions.m */,
28632860
AAE7A8FF086BB5C4009A487E /* PopupButton.h */,
28642861
AAE7A900086BB5C4009A487E /* PopupButton.m */,
2865-
AABCFB180900BA4E00984F78 /* SquareWindow.h */,
2866-
AABCFB190900BA4E00984F78 /* SquareWindow.m */,
28672862
B2BECB1514CEF22B00706F8F /* SSTextField.h */,
28682863
B2BECB1614CEF22B00706F8F /* SSTextField.m */,
28692864
);
@@ -3866,7 +3861,6 @@
38663861
AA60238108C298FB002CFD06 /* HelperFunctions.m in Sources */,
38673862
031E083019DFA3A900194F9F /* SubscriptionModel.m in Sources */,
38683863
AAEB1A5308E74EE300917920 /* ArrayExtensions.m in Sources */,
3869-
AABCFB1B0900BA4E00984F78 /* SquareWindow.m in Sources */,
38703864
AA71168F09BEB17300E3EA8A /* AddressBarCell.m in Sources */,
38713865
0379E2381A2082E600D58BFE /* AppearancePreferencesViewController.m in Sources */,
38723866
AA1A23DB0C07475B005968DC /* SplitViewExtensions.m in Sources */,

src/AppController.m

+1-10
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ -(void)doSafeInitialisation
244244
// If the statusbar is hidden, also hide the highlight line on its top and the filter button.
245245
if (!self.statusBarVisible)
246246
{
247-
if ([mainWindow respondsToSelector:@selector(setBottomCornerRounded:)])
248-
[mainWindow setBottomCornerRounded:NO];
249247
[cosmeticStatusBarHighlightLine setHidden:YES];
250248
[currentFilterTextField setHidden:YES];
251249
[filterIconInStatusBarButton setHidden:YES];
@@ -438,6 +436,7 @@ -(void)applicationDidFinishLaunching:(NSNotification *)aNot
438436
[nc addObserver:self selector:@selector(handleShowAppInStatusBar:) name:@"MA_Notify_ShowAppInStatusBarChanged" object:nil];
439437
[nc addObserver:self selector:@selector(handleShowStatusBar:) name:@"MA_Notify_StatusBarChanged" object:nil];
440438
[nc addObserver:self selector:@selector(handleShowFilterBar:) name:@"MA_Notify_FilterBarChanged" object:nil];
439+
[nc addObserver:self selector:@selector(showUnreadCountOnApplicationIconAndWindowTitle) name:@"MA_Notify_FoldersUpdated" object:nil];
441440
//Open Reader Notifications
442441
[nc addObserver:self selector:@selector(handleGoogleAuthFailed:) name:@"MA_Notify_GoogleAuthFailed" object:nil];
443442

@@ -3979,10 +3978,6 @@ -(void)setStatusBarState:(BOOL)isVisible withAnimation:(BOOL)doAnimate
39793978
[currentFilterTextField setHidden:YES];
39803979
[filterIconInStatusBarButton setHidden:YES];
39813980
[cosmeticStatusBarHighlightLine setHidden:YES];
3982-
if ([mainWindow respondsToSelector:@selector(setBottomCornerRounded:)])
3983-
{
3984-
[mainWindow setBottomCornerRounded:NO];
3985-
}
39863981
}
39873982
[splitView1 resizeViewWithAnimation:viewSize withTag:MA_ViewTag_Statusbar];
39883983
}
@@ -4021,10 +4016,6 @@ -(void)viewAnimationCompleted:(NSView *)theView withTag:(NSInteger)viewTag
40214016
[currentFilterTextField setHidden:NO];
40224017
[filterIconInStatusBarButton setHidden:NO];
40234018
[cosmeticStatusBarHighlightLine setHidden:NO];
4024-
if ([mainWindow respondsToSelector:@selector(setBottomCornerRounded:)])
4025-
{
4026-
[mainWindow setBottomCornerRounded:YES];
4027-
}
40284019
return;
40294020
}
40304021
if (viewTag == MA_ViewTag_Filterbar && self.filterBarVisible)

src/ArticleController.m

+28-35
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#import "ArticleRef.h"
2828
#import "StringExtensions.h"
2929
#import "GoogleReader.h"
30-
#import "RefreshManager.h"
3130
#import "ArticleListView.h"
3231
#import "UnifiedDisplayView.h"
3332

@@ -660,10 +659,6 @@ -(void)markDeletedByArray:(NSArray *)articleArray deleteFlag:(BOOL)deleteFlag
660659
else
661660
[NSApp.mainWindow makeFirstResponder:foldersTree.mainView];
662661
}
663-
664-
// If any of the articles we deleted were unread then the
665-
// folder's unread count just changed.
666-
[APPCONTROLLER showUnreadCountOnApplicationIconAndWindowTitle];
667662
}
668663

669664
/* deleteArticlesByArray
@@ -697,8 +692,6 @@ -(void)deleteArticlesByArray:(NSArray *)articleArray
697692
} else {
698693
[NSApp.mainWindow makeFirstResponder:foldersTree.mainView];
699694
}
700-
// Read and/or unread count may have changed
701-
[APPCONTROLLER showUnreadCountOnApplicationIconAndWindowTitle];
702695
}
703696

704697
/* markUnflagUndo
@@ -780,10 +773,6 @@ -(void)markReadByArray:(NSArray *)articleArray readFlag:(BOOL)readFlag
780773
[self innerMarkReadByArray:articleArray readFlag:readFlag];
781774

782775
[mainArticleView refreshFolder:MA_Refresh_RedrawList];
783-
784-
// The info bar has a count of unread articles so we need to
785-
// update that.
786-
[APPCONTROLLER showUnreadCountOnApplicationIconAndWindowTitle];
787776
}
788777

789778
/* innerMarkReadByArray
@@ -803,14 +792,18 @@ -(void)innerMarkReadByArray:(NSArray *)articleArray readFlag:(BOOL)readFlag
803792
} else {
804793
[[Database sharedManager] markArticleRead:folderId guid:theArticle.guid isRead:readFlag];
805794
[theArticle markRead:readFlag];
806-
if (folderId != lastFolderId && lastFolderId != -1)
807-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
795+
if (folderId != lastFolderId && lastFolderId != -1) {
796+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
797+
object:@(lastFolderId)];
798+
}
808799
lastFolderId = folderId;
809800
}
810801
}
811802
}
812-
if (lastFolderId != -1)
813-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
803+
if (lastFolderId != -1) {
804+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
805+
object:@(lastFolderId)];
806+
}
814807
}
815808

816809
/* innerMarkReadByRefsArray
@@ -832,13 +825,17 @@ -(void)innerMarkReadByRefsArray:(NSArray *)articleArray readFlag:(BOOL)readFlag
832825
}
833826
} else {
834827
[db markArticleRead:folderId guid:articleRef.guid isRead:readFlag];
835-
if (folderId != lastFolderId && lastFolderId != -1)
836-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
828+
if (folderId != lastFolderId && lastFolderId != -1) {
829+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
830+
object:@(lastFolderId)];
831+
}
837832
lastFolderId = folderId;
838833
}
839834
}
840-
if (lastFolderId != -1)
841-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
835+
if (lastFolderId != -1) {
836+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
837+
object:@(lastFolderId)];
838+
}
842839
}
843840

844841
/* markAllReadUndo
@@ -874,7 +871,6 @@ -(void)markAllReadByArray:(NSArray *)folderArray withUndo:(BOOL)undoFlag withRef
874871
if (refreshFlag) {
875872
[mainArticleView refreshFolder:MA_Refresh_RedrawList];
876873
}
877-
[APPCONTROLLER showUnreadCountOnApplicationIconAndWindowTitle];
878874
}
879875

880876
/* wrappedMarkAllReadInArray
@@ -897,10 +893,9 @@ -(NSArray *)wrappedMarkAllReadInArray:(NSArray *)folderArray withUndo:(BOOL)undo
897893
if (undoFlag) {
898894
[refArray addObjectsFromArray:[folder arrayOfUnreadArticlesRefs]];
899895
}
900-
if ([[Database sharedManager] markFolderRead:folderId])
901-
{
902-
[foldersTree updateFolder:folderId recurseToParents:YES];
903-
896+
if ([[Database sharedManager] markFolderRead:folderId]) {
897+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
898+
object:@(folderId)];
904899
}
905900
}
906901
else if (IsGoogleReaderFolder(folder))
@@ -952,9 +947,9 @@ -(void)markAllReadByReferencesArray:(NSArray *)refArray readFlag:(BOOL)readFlag
952947
}
953948
} else {
954949
[dbManager markArticleRead:folderId guid:theGuid isRead:readFlag];
955-
if (folderId != lastFolderId && lastFolderId != -1)
956-
{
957-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
950+
if (folderId != lastFolderId && lastFolderId != -1) {
951+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
952+
object:@(lastFolderId)];
958953
}
959954
lastFolderId = folderId;
960955
}
@@ -964,9 +959,9 @@ -(void)markAllReadByReferencesArray:(NSArray *)refArray readFlag:(BOOL)readFlag
964959
}
965960
}
966961

967-
if (lastFolderId != -1)
968-
{
969-
[foldersTree updateFolder:lastFolderId recurseToParents:YES];
962+
if (lastFolderId != -1) {
963+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
964+
object:@(lastFolderId)];
970965
}
971966
if (lastFolderId != -1 && !IsRSSFolder([dbManager folderFromID:currentFolderId])
972967
&& !IsGoogleReaderFolder([dbManager folderFromID:currentFolderId])) {
@@ -975,10 +970,6 @@ -(void)markAllReadByReferencesArray:(NSArray *)refArray readFlag:(BOOL)readFlag
975970
else if (needRefilter) {
976971
[mainArticleView refreshFolder:MA_Refresh_ReapplyFilter];
977972
}
978-
979-
// The info bar has a count of unread articles so we need to
980-
// update that.
981-
[APPCONTROLLER showUnreadCountOnApplicationIconAndWindowTitle];
982973
}
983974

984975
/* addBacktrack
@@ -1072,7 +1063,9 @@ -(void)handleArticleListContentChange:(NSNotification *)note
10721063
{
10731064
NSInteger folderId = ((NSNumber *)note.object).integerValue;
10741065
Folder * currentFolder = [[Database sharedManager] folderFromID:currentFolderId];
1075-
if ( (folderId == currentFolderId) || (!IsRSSFolder(currentFolder) && !IsGoogleReaderFolder(currentFolder)) )
1066+
if ( (folderId == currentFolderId)
1067+
// for group or smart folder, to avoid flickering, we only update when refresh process is finished
1068+
|| (!IsRSSFolder(currentFolder) && !IsGoogleReaderFolder(currentFolder) && !APPCONTROLLER.isConnecting) )
10761069
{
10771070
// Note the article that the user might currently be reading
10781071
// to be preserved when reloading the array of articles.

src/DownloadWindow.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919
//
2020

2121
#import <Cocoa/Cocoa.h>
22-
#import "SquareWindow.h"
2322
#import "TableViewExtensions.h"
2423

2524
@interface DownloadWindow : NSWindowController <NSWindowDelegate,NSTableViewDelegate,NSTableViewDataSource> {
26-
IBOutlet SquareWindow * downloadWindow;
25+
IBOutlet NSWindow * downloadWindow;
2726
IBOutlet ExtendedTableView * table;
2827
IBOutlet NSButton * clearButton;
2928
NSInteger lastCount;

src/GoogleReader.m

+2-3
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ - (void)feedRequestDone:(ASIHTTPRequest *)request
601601
dispatch_async(dispatch_get_main_queue(), ^{
602602
AppController *controller = APPCONTROLLER;
603603
[controller setStatusMessage:nil persist:NO];
604-
[controller showUnreadCountOnApplicationIconAndWindowTitle];
605604
[refreshedFolder clearNonPersistedFlag:MA_FFlag_Error];
606605

607606
// Send status to the activity log
@@ -610,6 +609,7 @@ - (void)feedRequestDone:(ASIHTTPRequest *)request
610609
else
611610
{
612611
aItem.status = [NSString stringWithFormat:NSLocalizedString(@"%d new articles retrieved", nil), newArticlesFromFeed];
612+
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_FoldersUpdated" object:@(refreshedFolder.itemId)];
613613
}
614614
});
615615

@@ -664,7 +664,6 @@ - (void)readRequestDone:(ASIHTTPRequest *)request
664664
[[refreshedFolder articleFromGuid:guid] markRead:NO];
665665
}
666666
LLog(@"%ld unread items for %@", [guidArray count], [request url]);
667-
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_ArticleListContentChange" object:@(refreshedFolder.itemId)];
668667

669668
[[Database sharedManager] markUnreadArticlesFromFolder:refreshedFolder guidArray:guidArray];
670669
// reset starred statuses in cache : we will receive in -StarredRequestDone: the updated list
@@ -737,7 +736,7 @@ - (void)starredRequestDone:(ASIHTTPRequest *)request
737736
[[refreshedFolder articleFromGuid:guid] markFlagged:YES];
738737
}
739738
LLog(@"%ld starred items for %@", [guidArray count], [request url]);
740-
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_ArticleListStateChange" object:@(refreshedFolder.itemId)];
739+
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_ArticleListContentChange" object:@(refreshedFolder.itemId)];
741740

742741
[[Database sharedManager] markStarredArticlesFromFolder:refreshedFolder guidArray:guidArray];
743742

src/RefreshManager.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ - (void)nqQueueDidFinishSelector:(ASIHTTPRequest *)request {
100100
if (hasStarted)
101101
{
102102
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_RefreshStatus" object:nil];
103+
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadWithName:@"MA_Notify_ArticleListContentChange" object:nil];
103104
hasStarted = NO;
104105
}
105106
else
@@ -611,7 +612,8 @@ - (void)syncFinishedForFolder:(Folder *)folder
611612
// Unread count may have changed
612613
AppController *controller = APPCONTROLLER;
613614
[controller setStatusMessage:nil persist:NO];
614-
[controller showUnreadCountOnApplicationIconAndWindowTitle];
615+
[[NSNotificationCenter defaultCenter] postNotificationName:@"MA_Notify_FoldersUpdated"
616+
object:@(folder.itemId)];
615617
});
616618
}
617619

src/SquareWindow.h

-29
This file was deleted.

src/SquareWindow.m

-37
This file was deleted.

0 commit comments

Comments
 (0)