mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Re-implemented the fix for utf-8 lookup error during auto-update in a more graceful way.
This commit is contained in:
parent
a570406ac8
commit
9ca8a199c0
@ -11,6 +11,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import "PyDupeGuru.h"
|
||||
#import "ResultWindow.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "DirectoryPanel.h"
|
||||
|
||||
@interface AppDelegateBase : NSObject
|
||||
{
|
||||
@ -19,11 +20,15 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
IBOutlet NSMenuItem *unlockMenuItem;
|
||||
IBOutlet ResultWindowBase *result;
|
||||
|
||||
DirectoryPanelBase *_directoryPanel;
|
||||
DetailsPanelBase *_detailsPanel;
|
||||
BOOL _savedResults;
|
||||
}
|
||||
- (IBAction)unlockApp:(id)sender;
|
||||
|
||||
- (PyDupeGuruBase *)py;
|
||||
- (RecentDirectories *)recentDirectories;
|
||||
- (DirectoryPanelBase *)directoryPanel; // Virtual
|
||||
- (DetailsPanelBase *)detailsPanel; // Virtual
|
||||
- (void)saveResults;
|
||||
@end
|
||||
|
@ -11,6 +11,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import "RegistrationInterface.h"
|
||||
#import "Utils.h"
|
||||
#import "Consts.h"
|
||||
#import <Sparkle/SUUpdater.h>
|
||||
|
||||
@implementation AppDelegateBase
|
||||
- (IBAction)unlockApp:(id)sender
|
||||
@ -28,8 +29,19 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
- (PyDupeGuruBase *)py { return py; }
|
||||
- (RecentDirectories *)recentDirectories { return recentDirectories; }
|
||||
- (DirectoryPanelBase *)directoryPanel {return nil; } // Virtual
|
||||
- (DetailsPanelBase *)detailsPanel { return nil; } // Virtual
|
||||
|
||||
- (void)saveResults
|
||||
{
|
||||
if (_savedResults) {
|
||||
return;
|
||||
}
|
||||
[py saveIgnoreList];
|
||||
[py saveResults];
|
||||
_savedResults = YES;
|
||||
}
|
||||
|
||||
/* Delegate */
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
@ -48,6 +60,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
//Restore results
|
||||
[py loadIgnoreList];
|
||||
[py loadResults];
|
||||
_savedResults = NO;
|
||||
}
|
||||
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
||||
@ -61,8 +74,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
|
||||
[ud setObject: [result getColumnsOrder] forKey:@"columnsOrder"];
|
||||
[ud setObject: [result getColumnsWidth] forKey:@"columnsWidth"];
|
||||
[py saveIgnoreList];
|
||||
[py saveResults];
|
||||
[self saveResults];
|
||||
NSInteger sc = [ud integerForKey:@"sessionCountSinceLastIgnorePurge"];
|
||||
if (sc >= 10)
|
||||
{
|
||||
@ -81,4 +93,14 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
{
|
||||
[[self directoryPanel] addDirectory:directory];
|
||||
}
|
||||
|
||||
/* SUUpdater delegate */
|
||||
|
||||
- (BOOL)updater:(SUUpdater *)updater shouldPostponeRelaunchForUpdate:(SUAppcastItem *)update untilInvoking:(NSInvocation *)invocation;
|
||||
{
|
||||
/* If results aren't saved now, we might get a weird utf-8 lookup error when saving later.
|
||||
**/
|
||||
[self saveResults];
|
||||
return NO;
|
||||
}
|
||||
@end
|
||||
|
@ -2,10 +2,10 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1050</int>
|
||||
<string key="IBDocument.SystemVersion">10B504</string>
|
||||
<string key="IBDocument.SystemVersion">10C540</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">740</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.2</string>
|
||||
<string key="IBDocument.HIToolboxVersion">437.00</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.25</string>
|
||||
<string key="IBDocument.HIToolboxVersion">458.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">740</string>
|
||||
@ -83,11 +83,9 @@
|
||||
<string key="NSToolbarItemPaletteLabel">Power Marker</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSegmentedControl" key="NSToolbarItemView" id="35398541">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{7, 14}, {67, 24}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSegmentedCell" key="NSCell" id="431579725">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@ -178,11 +176,9 @@
|
||||
<string key="NSToolbarItemPaletteLabel">Filter</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSearchField" key="NSToolbarItemView" id="1013657232">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">258</int>
|
||||
<string key="NSFrame">{{0, 14}, {81, 22}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSearchFieldCell" key="NSCell" id="484816507">
|
||||
<int key="NSCellFlags">343014976</int>
|
||||
@ -324,11 +320,9 @@
|
||||
<string key="NSToolbarItemPaletteLabel">Action</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSPopUpButton" key="NSToolbarItemView" id="165812138">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{0, 14}, {58, 26}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSPopUpButtonCell" key="NSCell" id="436420677">
|
||||
<int key="NSCellFlags">-2076049856</int>
|
||||
@ -531,11 +525,9 @@
|
||||
<string key="NSToolbarItemPaletteLabel">Delta Values</string>
|
||||
<nil key="NSToolbarItemToolTip"/>
|
||||
<object class="NSSegmentedControl" key="NSToolbarItemView" id="311230297">
|
||||
<reference key="NSNextResponder"/>
|
||||
<nil key="NSNextResponder"/>
|
||||
<int key="NSvFlags">256</int>
|
||||
<string key="NSFrame">{{4, 14}, {67, 24}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSSegmentedCell" key="NSCell" id="211272396">
|
||||
<int key="NSCellFlags">67239424</int>
|
||||
@ -2227,6 +2219,14 @@
|
||||
</object>
|
||||
<int key="connectionID">1174</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="23220930"/>
|
||||
<reference key="destination" ref="91622651"/>
|
||||
</object>
|
||||
<int key="connectionID">1175</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
@ -3584,7 +3584,7 @@
|
||||
</object>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">1174</int>
|
||||
<int key="maxID">1175</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -9,16 +9,11 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "../base/AppDelegate.h"
|
||||
#import "ResultWindow.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@interface AppDelegate : AppDelegateBase
|
||||
{
|
||||
DirectoryPanel *_directoryPanel;
|
||||
}
|
||||
@interface AppDelegate : AppDelegateBase {}
|
||||
- (IBAction)openWebsite:(id)sender;
|
||||
- (IBAction)toggleDirectories:(id)sender;
|
||||
|
||||
- (DirectoryPanel *)directoryPanel;
|
||||
- (PyDupeGuru *)py;
|
||||
@end
|
||||
|
@ -13,6 +13,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import "../../cocoalib/ValueTransformers.h"
|
||||
#import "../../cocoalib/Dialogs.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "Consts.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@ -73,7 +74,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
return _detailsPanel;
|
||||
}
|
||||
|
||||
- (DirectoryPanel *)directoryPanel
|
||||
- (DirectoryPanelBase *)directoryPanel
|
||||
{
|
||||
if (!_directoryPanel)
|
||||
_directoryPanel = [[DirectoryPanel alloc] initWithParentApp:self];
|
||||
|
@ -8,16 +8,11 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "../base/AppDelegate.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@interface AppDelegate : AppDelegateBase
|
||||
{
|
||||
DirectoryPanel *_directoryPanel;
|
||||
}
|
||||
@interface AppDelegate : AppDelegateBase {}
|
||||
- (IBAction)openWebsite:(id)sender;
|
||||
- (IBAction)toggleDirectories:(id)sender;
|
||||
|
||||
- (DirectoryPanel *)directoryPanel;
|
||||
- (PyDupeGuru *)py;
|
||||
@end
|
||||
|
@ -13,6 +13,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import "ValueTransformers.h"
|
||||
#import "Consts.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "DirectoryPanel.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
+ (void)initialize
|
||||
@ -57,7 +58,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
[[self directoryPanel] toggleVisible:sender];
|
||||
}
|
||||
|
||||
- (DirectoryPanel *)directoryPanel
|
||||
- (DirectoryPanelBase *)directoryPanel
|
||||
{
|
||||
if (!_directoryPanel)
|
||||
_directoryPanel = [[DirectoryPanel alloc] initWithParentApp:self];
|
||||
|
@ -8,16 +8,11 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "../base/AppDelegate.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "PyDupeGuru.h"
|
||||
|
||||
@interface AppDelegate : AppDelegateBase
|
||||
{
|
||||
DirectoryPanel *_directoryPanel;
|
||||
}
|
||||
@interface AppDelegate : AppDelegateBase {}
|
||||
- (IBAction)openWebsite:(id)sender;
|
||||
- (IBAction)toggleDirectories:(id)sender;
|
||||
|
||||
- (DirectoryPanel *)directoryPanel;
|
||||
- (PyDupeGuru *)py;
|
||||
@end
|
||||
|
@ -12,6 +12,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
#import "../../cocoalib/Utils.h"
|
||||
#import "../../cocoalib/ValueTransformers.h"
|
||||
#import "DetailsPanel.h"
|
||||
#import "DirectoryPanel.h"
|
||||
#import "Consts.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@ -56,7 +57,7 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
[[self directoryPanel] toggleVisible:sender];
|
||||
}
|
||||
|
||||
- (DirectoryPanel *)directoryPanel
|
||||
- (DirectoryPanelBase *)directoryPanel
|
||||
{
|
||||
if (!_directoryPanel)
|
||||
_directoryPanel = [[DirectoryPanel alloc] initWithParentApp:self];
|
||||
|
@ -212,13 +212,8 @@ class DupeGuru(RegistrableApplication):
|
||||
changed_groups.add(g)
|
||||
|
||||
def save(self):
|
||||
try:
|
||||
self.directories.save_to_file(op.join(self.appdata, 'last_directories.xml'))
|
||||
self.results.save_to_xml(op.join(self.appdata, 'last_results.xml'))
|
||||
except LookupError:
|
||||
# This is that weird issue from #39 that sometimes happens when auto-updating with
|
||||
# Sparkle. Just ignore it.
|
||||
pass
|
||||
|
||||
def save_ignore_list(self):
|
||||
p = op.join(self.appdata, 'ignore_list.xml')
|
||||
|
Loading…
x
Reference in New Issue
Block a user