Skip to content

Commit

Permalink
Added Empty Favicon Cache option.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldandersen committed Sep 13, 2005
1 parent 7e9df47 commit b195e1c
Show file tree
Hide file tree
Showing 9 changed files with 102 additions and 57 deletions.
5 changes: 5 additions & 0 deletions Application/AppController.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#import "NSDictionary+SFHFUtils.h"
#import "NSArray+IndexSetAdditions.h"
#import "NSAppleScript+HandlerCalls.h"
#import "NSFileManager+ESBExtensions.h"
#import "SFHFKeychainUtils.h"
#import "SFHFTableView.h"
#import "SFHFBezelView.h"
Expand Down Expand Up @@ -174,10 +175,14 @@
- (IBAction) setSearchTypeToBasic: (id) sender;
- (IBAction) setSearchTypeToExtended: (id) sender;
- (IBAction) copyAsTag: (id) sender;
- (IBAction) refreshFaviconCache: (id) sender;
- (IBAction) emptyFaviconCache: (id) sender;

/* Misc. */
- (void) handleScriptError: (NSDictionary *) errorInfo;
- (void) resetPostView;
- (void) previewSelectedLinks;
- (void) performAsyncAddOfPost: (DCAPIPost *) newPost;
- (void) performAsyncDownloadOfFaviconForPost: (DCAPIPost *) newPost;

@end
27 changes: 23 additions & 4 deletions Application/AppController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ - (void) previewSelectedLinks {
[statusText setStringValue: [url description]];

[[webView mainFrame] loadRequest: [NSURLRequest requestWithURL: url]];
[NSThread detachNewThreadSelector: @selector(performAsyncDownloadOfFaviconForPost:) toTarget: self withObject: post];
}
else {
[self resetPostView];
Expand Down Expand Up @@ -1420,21 +1421,26 @@ - (IBAction) postNewLink: (id) sender {
[newPost setTagsFromString: postTags];

[NSThread detachNewThreadSelector: @selector(performAsyncAddOfPost:) toTarget: self withObject: newPost];

[[SFHFFaviconCache sharedFaviconCache] faviconForURL: postURL forceRefresh: YES];


[self closePostingInterface: self];
[self insertPost: newPost];
[newPost release];
}

- (void) performAsyncAddOfPost: (DCAPIPost *) newPost {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[SFHFFaviconCache sharedFaviconCache] faviconForURL: [newPost URL] forceRefresh: YES];
[self performAsyncDownloadOfFaviconForPost: newPost];
[[self client] addPost: newPost];
[pool release];
}

- (void) performAsyncDownloadOfFaviconForPost: (DCAPIPost *) newPost {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[SFHFFaviconCache sharedFaviconCache] faviconForURL: [newPost URL] forceRefresh: YES];
[postList performSelectorOnMainThread: @selector(reloadData) withObject: nil waitUntilDone:NO];
[pool release];
}

- (void)postNewLinkWithPasteboard:(NSPasteboard *)pboard userData:(NSString *)data error:(NSString **)error {
NSURL *url = nil;
NSArray *types = [pboard types];
Expand Down Expand Up @@ -1571,6 +1577,19 @@ - (IBAction) deleteSelectedLinks: (id) sender {
}
}

- (IBAction) refreshFaviconCache: (id) sender {

}

- (IBAction) emptyFaviconCache: (id) sender {
int result = NSRunAlertPanel(NSLocalizedString(@"Empty Icon Cache", @"Title of Empty Icon Cache confirmation dialog"), NSLocalizedString(@"Are you sure you want to empty the Cocoalicious favicon cache?", @"Message on the Empty Favicon Cache dialog"), NSLocalizedString(@"Empty", @"Positive Empty Favicon Cache confirmation dialog option"), NSLocalizedString(@"Cancel", @"Negative Empty Favicon Cache confirmation dialog option"), nil);

if (result == NSAlertDefaultReturn) {
[[SFHFFaviconCache sharedFaviconCache] clearFaviconCache];
[postList reloadData];
}
}

- (void) handleScriptError: (NSDictionary *) errorInfo {
#warning if safariScript = nil disable menu item
NSString *errorMessage = [errorInfo objectForKey: NSAppleScriptErrorBriefMessage];
Expand Down
60 changes: 33 additions & 27 deletions Delicious Client.xcodeproj/buzz.mode1
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@
<key>Layout</key>
<array>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBottomSmartGroupGIDs</key>
Expand Down Expand Up @@ -256,14 +254,12 @@
<key>PBXSmartGroupTreeModuleOutlineStateExpansionKey</key>
<array>
<string>29B97314FDCFA39411CA2CEA</string>
<string>29B97317FDCFA39411CA2CEA</string>
<string>29B97323FDCFA39411CA2CEA</string>
<string>1C37FBAC04509CD000000102</string>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>22</integer>
<integer>9</integer>
<integer>0</integer>
</array>
</array>
Expand Down Expand Up @@ -332,6 +328,8 @@
<string>0pt</string>
</dict>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXProjectModuleGUID</key>
Expand Down Expand Up @@ -368,9 +366,9 @@
</array>
<key>TableOfContents</key>
<array>
<string>6B1F627A08D4A09C0010343B</string>
<string>6BD6D7C308D6A592009CB67E</string>
<string>1CE0B1FE06471DED0097A5F4</string>
<string>6B1F627B08D4A09C0010343B</string>
<string>6BD6D7C408D6A592009CB67E</string>
<string>1CE0B20306471E060097A5F4</string>
<string>1CE0B20506471E060097A5F4</string>
</array>
Expand Down Expand Up @@ -504,6 +502,10 @@
<integer>5</integer>
<key>WindowOrderList</key>
<array>
<string>6BFBD192082EEB42009D11EB</string>
<string>6BB6354E08348C5C008CCB54</string>
<string>1CD10A99069EF8BA00B06720</string>
<string>6BD6D78808D69C63009CB67E</string>
<string>1C0AD2B3069F1EA900FABCE6</string>
<string>/Users/buzz/Code/Cocoa/cocoalicious/Delicious Client.xcodeproj</string>
</array>
Expand All @@ -529,7 +531,7 @@
<key>PBXProjectModuleGUID</key>
<string>1CD0528F0623707200166675</string>
<key>PBXProjectModuleLabel</key>
<string>&lt;No Editor&gt;</string>
<string>AppController.m</string>
<key>StatusBarVisibility</key>
<true/>
</dict>
Expand All @@ -546,8 +548,12 @@
<string>184pt</string>
</dict>
<dict>
<key>BecomeActive</key>
<true/>
<key>ContentConfiguration</key>
<dict>
<key>PBXBuildLogShowsTranscriptDefaultKey</key>
<string>{{0, 47}, {853, 247}}</string>
<key>PBXProjectModuleGUID</key>
<string>XCMainBuildResultsModuleGUID</string>
<key>PBXProjectModuleLabel</key>
Expand Down Expand Up @@ -585,7 +591,7 @@
<key>TableOfContents</key>
<array>
<string>6BFBD192082EEB42009D11EB</string>
<string>6B804ED208D38B2E009B9F90</string>
<string>6BD6D79F08D6A0D2009CB67E</string>
<string>1CD0528F0623707200166675</string>
<string>XCMainBuildResultsModuleGUID</string>
</array>
Expand Down Expand Up @@ -627,8 +633,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {208, 144}}</string>
<string>{{208, 0}, {486, 144}}</string>
<string>{{0, 0}, {194, 142}}</string>
<string>{{194, 0}, {500, 142}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
Expand All @@ -643,8 +649,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {694, 144}}</string>
<string>{{0, 144}, {694, 237}}</string>
<string>{{0, 0}, {694, 142}}</string>
<string>{{0, 142}, {694, 239}}</string>
</array>
</dict>
</dict>
Expand Down Expand Up @@ -691,14 +697,14 @@
<key>TableOfContents</key>
<array>
<string>1CD10A99069EF8BA00B06720</string>
<string>6B2AC516086E53B70046FEBB</string>
<string>6BD6D78208D69C63009CB67E</string>
<string>1C162984064C10D400B95A72</string>
<string>6B2AC517086E53B70046FEBB</string>
<string>6B2AC518086E53B70046FEBB</string>
<string>6B2AC519086E53B70046FEBB</string>
<string>6B2AC51A086E53B70046FEBB</string>
<string>6B2AC51B086E53B70046FEBB</string>
<string>6B2AC51C086E53B70046FEBB</string>
<string>6BD6D78308D69C63009CB67E</string>
<string>6BD6D78408D69C63009CB67E</string>
<string>6BD6D78508D69C63009CB67E</string>
<string>6BD6D78608D69C63009CB67E</string>
<string>6BD6D78708D69C63009CB67E</string>
<string>6BD6D78808D69C63009CB67E</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.debug</string>
Expand Down Expand Up @@ -850,7 +856,7 @@
<key>TableOfContents</key>
<array>
<string>6BB6354E08348C5C008CCB54</string>
<string>6B2AC51D086E53B70046FEBB</string>
<string>6BD6D78908D69C63009CB67E</string>
<string>1C78EAAC065D492600B07095</string>
</array>
<key>WindowString</key>
Expand Down Expand Up @@ -895,8 +901,8 @@
<string>yes</string>
<key>sizes</key>
<array>
<string>{{0, 0}, {367, 168}}</string>
<string>{{0, 173}, {367, 270}}</string>
<string>{{0, 0}, {493, 168}}</string>
<string>{{0, 173}, {493, 270}}</string>
</array>
</dict>
<key>VerticalSplitView</key>
Expand All @@ -922,7 +928,7 @@
<key>Frame</key>
<string>{{0, 0}, {964, 443}}</string>
<key>RubberWindowFrame</key>
<string>167 171 964 484 0 0 1280 832 </string>
<string>168 172 964 484 0 0 1280 832 </string>
</dict>
<key>Module</key>
<string>PBXRunSessionModule</string>
Expand All @@ -945,14 +951,14 @@
<key>TableOfContents</key>
<array>
<string>1C0AD2B3069F1EA900FABCE6</string>
<string>6B1F620608D40B480010343B</string>
<string>6BD6D77908D69B05009CB67E</string>
<string>1CD0528B0623707200166675</string>
<string>6B1F620708D40B480010343B</string>
<string>6BD6D77A08D69B05009CB67E</string>
</array>
<key>ToolbarConfiguration</key>
<string>xcode.toolbar.config.run</string>
<key>WindowString</key>
<string>167 171 964 484 0 0 1280 832 </string>
<string>168 172 964 484 0 0 1280 832 </string>
<key>WindowToolGUID</key>
<string>1C0AD2B3069F1EA900FABCE6</string>
<key>WindowToolIsVisible</key>
Expand Down
45 changes: 23 additions & 22 deletions Delicious Client.xcodeproj/buzz.pbxuser
Original file line number Diff line number Diff line change
Expand Up @@ -1217,18 +1217,18 @@
};
6B4324FB08C6DD8C00C26737 /* SFHFFaviconCache.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {711, 429}}";
sepNavSelRange = "{415, 0}";
sepNavVisRect = "{{0, 0}, {711, 429}}";
sepNavIntBoundsRect = "{{0, 0}, {705, 429}}";
sepNavSelRange = "{521, 0}";
sepNavVisRect = "{{0, 0}, {705, 429}}";
sepNavWindowFrame = "{{549, 185}, {750, 558}}";
};
};
6B4324FC08C6DD8C00C26737 /* SFHFFaviconCache.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1250, 2464}}";
sepNavSelRange = "{48, 0}";
sepNavVisRect = "{{0, 0}, {711, 429}}";
sepNavWindowFrame = "{{373, 248}, {750, 558}}";
sepNavIntBoundsRect = "{{0, 0}, {1250, 2646}}";
sepNavSelRange = "{4474, 0}";
sepNavVisRect = "{{0, 1890}, {705, 429}}";
sepNavWindowFrame = "{{359, 174}, {750, 558}}";
};
};
6B45F6C507B4934D0007FA1E /* SFHFTextView.h */ = {
Expand All @@ -1252,7 +1252,7 @@
6B47BF0908633DF600636CB2 /* main.applescript */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {705, 429}}";
sepNavSelRange = "{370, 0}";
sepNavSelRange = "{367, 0}";
sepNavVisRect = "{{0, 0}, {705, 429}}";
sepNavWindowFrame = "{{349, 132}, {750, 558}}";
};
Expand Down Expand Up @@ -1314,7 +1314,7 @@
6B491CA208D35E7500B6E3C4 /* main.applescript */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1159, 583}}";
sepNavSelRange = "{378, 0}";
sepNavSelRange = "{375, 0}";
sepNavVisRect = "{{0, 0}, {1159, 583}}";
sepNavWindowFrame = "{{15, 115}, {1204, 712}}";
};
Expand Down Expand Up @@ -1529,9 +1529,9 @@
6BD8187E075AFB740088A2CF /* AppController-AppleScriptExtensions.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {782, 1652}}";
sepNavSelRange = "{583, 0}";
sepNavVisRect = "{{0, 742}, {705, 429}}";
sepNavWindowFrame = "{{371, 126}, {750, 558}}";
sepNavSelRange = "{791, 0}";
sepNavVisRect = "{{0, 87}, {705, 429}}";
sepNavWindowFrame = "{{420, 115}, {750, 558}}";
};
};
6BD8187F075AFB740088A2CF /* Cocoalicious.sdef */ = {
Expand Down Expand Up @@ -1566,9 +1566,10 @@
};
6BD818ED075AFCE50088A2CF /* DCAPITag-AppleScriptExtensions.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {711, 404}}";
sepNavIntBoundsRect = "{{0, 0}, {1286, 583}}";
sepNavSelRange = "{0, 0}";
sepNavVisRect = "{{0, 0}, {711, 404}}";
sepNavVisRect = "{{0, 0}, {1159, 583}}";
sepNavWindowFrame = "{{15, 115}, {1204, 712}}";
};
};
6BE6C20106C9FE1100E90B12 /* SFHFTableView.h */ = {
Expand Down Expand Up @@ -1597,18 +1598,18 @@
};
6BF88AE305C4D56000D7EDBB /* AppController.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {818, 2576}}";
sepNavSelRange = "{4124, 0}";
sepNavVisRect = "{{0, 1709}, {705, 429}}";
sepNavWindowFrame = "{{209, 239}, {750, 558}}";
sepNavIntBoundsRect = "{{0, 0}, {818, 2646}}";
sepNavSelRange = "{501, 0}";
sepNavVisRect = "{{0, 183}, {806, 152}}";
sepNavWindowFrame = "{{526, 248}, {750, 558}}";
};
};
6BF88AE405C4D56000D7EDBB /* AppController.m */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1736, 23940}}";
sepNavSelRange = "{12843, 0}";
sepNavVisRect = "{{0, 3905}, {705, 429}}";
sepNavWindowFrame = "{{442, 274}, {750, 558}}";
sepNavIntBoundsRect = "{{0, 0}, {2654, 24206}}";
sepNavSelRange = "{56485, 0}";
sepNavVisRect = "{{1415, 21955}, {705, 429}}";
sepNavWindowFrame = "{{471, 197}, {750, 558}}";
};
};
6BF88AE705C4D57100D7EDBB /* Source Control */ = {
Expand Down
3 changes: 2 additions & 1 deletion English.lproj/MainMenu.nib/classes.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions English.lproj/MainMenu.nib/info.nib

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified English.lproj/MainMenu.nib/keyedobjects.nib
Binary file not shown.
1 change: 1 addition & 0 deletions Utilities/SFHFFaviconCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
- (NSImage *) defaultFavicon;
- (void) setDefaultFavicon: (NSImage *) newDefaultFavicon;
- (NSImage *) faviconForURL: (NSURL *) url forceRefresh: (BOOL) forceRefresh;
- (void) clearFaviconCache;

@end
Loading

0 comments on commit b195e1c

Please sign in to comment.