Commit 57ba4d98 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: remove previous updater code as it is now replaced by Sparkle

parent 829a50ed
......@@ -8,11 +8,11 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="235"/>
<integer value="3568"/>
<integer value="2199"/>
<integer value="4375"/>
<integer value="57"/>
<integer value="283"/>
<integer value="3568"/>
<integer value="4419"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
......@@ -14157,8 +14157,8 @@ LCAuLi4</string>
<reference ref="5"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="5"/>
<string>{{343, 246}, {599, 368}}</string>
<string>{{343, 246}, {599, 368}}</string>
<string>{{351, 374}, {599, 368}}</string>
<string>{{351, 374}, {599, 368}}</string>
<reference ref="5"/>
<reference ref="5"/>
<string>{599, 368}</string>
......@@ -14552,7 +14552,7 @@ LCAuLi4</string>
<reference ref="5"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="5"/>
<string>{{355, 449}, {270, 233}}</string>
<string>{{355, 453}, {270, 233}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="5"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
......@@ -15159,7 +15159,6 @@ LCAuLi4</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>checkForUpdate:</string>
<string>clearRecentItems:</string>
<string>crashReporterAction:</string>
<string>intfOpenCapture:</string>
......@@ -15221,7 +15220,6 @@ LCAuLi4</string>
<string>id</string>
<string>id</string>
<string>id</string>
<string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
......@@ -15384,7 +15382,6 @@ LCAuLi4</string>
<string>o_sprefs</string>
<string>o_timefield</string>
<string>o_timeslider</string>
<string>o_update</string>
<string>o_vlm</string>
<string>o_vmi_fullscreen</string>
<string>o_vmi_mute</string>
......@@ -15560,7 +15557,6 @@ LCAuLi4</string>
<string>NSTextField</string>
<string>NSSlider</string>
<string>id</string>
<string>id</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
<string>NSMenuItem</string>
......
......@@ -35,8 +35,6 @@ SOURCES_macosx = \
simple_prefs.m \
output.h \
output.m \
update.m \
update.h \
vout.m \
voutgl.m \
vout.h \
......
......@@ -103,10 +103,7 @@ struct intf_sys_t
id o_vlm; /* VLCVLMController */
id o_embedded_list; /* VLCEmbeddedList*/
id o_coredialogs; /* VLCCoreDialogProvider */
VLCInformation * o_info; /* VLCInformation */
#ifdef UPDATE_CHECK
id o_update; /* VLCUpdate */
#endif
VLCInformation * o_info; /* VLCInformation */
id o_eyetv; /* VLCEyeTVController */
BOOL nib_main_loaded; /* main nibfile */
BOOL nib_open_loaded; /* open nibfile */
......@@ -115,7 +112,6 @@ struct intf_sys_t
BOOL nib_extended_loaded; /* extended nibfile */
BOOL nib_bookmarks_loaded; /* bookmarks nibfile */
BOOL nib_prefs_loaded; /* preferences nibfile */
BOOL nib_update_loaded; /* update nibfile */
BOOL nib_info_loaded; /* information panel nibfile */
BOOL nib_vlm_loaded; /* VLM Panel nibfile */
BOOL nib_coredialogs_loaded; /* CoreDialogs nibfile */
......@@ -398,7 +394,6 @@ struct intf_sys_t
- (IBAction)viewAbout:(id)sender;
- (IBAction)showLicense:(id)sender;
- (IBAction)viewPreferences:(id)sender;
- (IBAction)checkForUpdate:(id)sender;
- (IBAction)viewHelp:(id)sender;
- (IBAction)openReadMe:(id)sender;
- (IBAction)openDocumentation:(id)sender;
......
......@@ -49,7 +49,6 @@
#import "bookmarks.h"
#import "coredialogs.h"
#import "embeddedwindow.h"
#import "update.h"
#import "AppleRemote.h"
#import "eyetv.h"
#import "simple_prefs.h"
......@@ -328,9 +327,6 @@ static VLCMain *_o_sharedMainInstance = nil;
o_embedded_list = [[VLCEmbeddedList alloc] init];
o_coredialogs = [[VLCCoreDialogProvider alloc] init];
o_info = [[VLCInfo alloc] init];
#ifdef UPDATE_CHECK
o_update = [[VLCUpdate alloc] init];
#endif
i_lastShownVolume = -1;
......@@ -580,15 +576,6 @@ static VLCMain *_o_sharedMainInstance = nil;
[self _removeOldPreferences];
#ifdef UPDATE_CHECK
/* Check for update silently on startup */
if( !nib_update_loaded )
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner: NSApp];
if([o_update shouldCheckForUpdate])
[NSThread detachNewThreadSelector:@selector(checkForUpdate) toTarget:o_update withObject:nil];
#endif
/* Handle sleep notification */
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(computerWillSleep:)
name:NSWorkspaceWillSleepNotification object:nil];
......@@ -829,10 +816,6 @@ static VLCMain *_o_sharedMainInstance = nil;
/* remove global observer watching for vout device changes correctly */
[[NSNotificationCenter defaultCenter] removeObserver: self];
#ifdef UPDATE_CHECK
[o_update end];
#endif
/* release some other objects here, because it isn't sure whether dealloc
* will be called later on */
if( nib_about_loaded )
......@@ -2247,21 +2230,6 @@ end:
[o_sprefs showSimplePrefs];
}
#pragma mark -
#pragma mark Update
- (IBAction)checkForUpdate:(id)sender
{
#ifdef UPDATE_CHECK
if( !nib_update_loaded )
nib_update_loaded = [NSBundle loadNibNamed:@"Update" owner: NSApp];
[o_update showUpdateWindow];
#else
msg_Err( VLCIntf, "Update checker wasn't enabled in this build" );
dialog_FatalWait( VLCIntf, _("Update check failed"), _("Checking for updates was not enabled in this build.") );
#endif
}
#pragma mark -
#pragma mark Help and Docs
......
......@@ -29,7 +29,7 @@
#import "misc.h"
#import "intf.h"
#import "AppleRemote.h"
#import <Sparkle/Sparkle.h> //for o_intf_last_update_lbl
#import <Sparkle/Sparkle.h> //for o_intf_last_update_lbl
static NSString* VLCSPrefsToolbarIdentifier = @"Our Simple Preferences Toolbar Identifier";
static NSString* VLCIntfSettingToolbarIdentifier = @"Intf Settings Item Identifier";
......
/*****************************************************************************
* update.h: MacOS X Check-For-Update window
*****************************************************************************
* Copyright © 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Felix Kühne <fkuehne at videolan dot org>
* Rafaël Carré <funman@videolanorg>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef UPDATE_CHECK
#import <Cocoa/Cocoa.h>
#import "intf.h"
#import <vlc_update.h>
@interface VLCUpdate : NSObject
{
IBOutlet id o_btn_DownloadNow;
IBOutlet id o_btn_okay;
IBOutlet id o_fld_releaseNote;
IBOutlet id o_fld_currentVersion;
IBOutlet id o_fld_status;
IBOutlet id o_update_window;
IBOutlet id o_bar_checking;
IBOutlet id o_chk_updateOnStartup;
update_t * p_u;
bool b_checked;
}
- (void)end;
- (IBAction)download:(id)sender;
- (IBAction)okay:(id)sender;
- (IBAction)changeCheckUpdateOnStartup:(id)sender;
- (BOOL)shouldCheckForUpdate;
- (void)showUpdateWindow;
- (void)checkForUpdate;
- (void)performDownload:(NSString *)path;
+ (VLCUpdate *)sharedInstance;
@end
#endif
/*****************************************************************************
* update.m: MacOS X Check-For-Update window
*****************************************************************************
* Copyright © 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Felix Kühne <fkuehne at videolan dot org>
* Rafaël Carré <funman@videolanorg>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#import "update.h"
#ifdef UPDATE_CHECK
#include <assert.h>
/*****************************************************************************
* Preamble
*****************************************************************************/
static NSString * kPrefUpdateOnStartup = @"UpdateOnStartup";
static NSString * kPrefUpdateLastTimeChecked = @"UpdateLastTimeChecked";
/*****************************************************************************
* VLCUpdate implementation
*****************************************************************************/
@implementation VLCUpdate
static VLCUpdate *_o_sharedInstance = nil;
+ (VLCUpdate *)sharedInstance
{
return _o_sharedInstance ? _o_sharedInstance : [[self alloc] init];
}
- (id)init
{
if( _o_sharedInstance ) {
[self dealloc];
} else {
_o_sharedInstance = [super init];
b_checked = false;
}
return _o_sharedInstance;
}
- (void)end
{
if( p_u ) update_Delete( p_u );
}
- (void)awakeFromNib
{
/* clean the interface */
[o_fld_releaseNote setString: @""];
[o_fld_currentVersion setStringValue: @""];
/* translate strings to the user's language */
[o_update_window setTitle: _NS("Check for Updates")];
[o_btn_DownloadNow setTitle: _NS("Download now")];
[o_btn_okay setTitle: _NS("OK")];
[o_chk_updateOnStartup setTitle: _NS("Automatically check for updates")];
/* we don't use - (BOOL)shouldCheckUpdateOnStartup because we don't want
* the Alert panel to pop up at this time */
[o_chk_updateOnStartup setState: [[NSUserDefaults standardUserDefaults] boolForKey: kPrefUpdateOnStartup]];
}
- (void)setShouldCheckUpdate: (BOOL)check
{
[[NSUserDefaults standardUserDefaults] setBool: check forKey: kPrefUpdateOnStartup];
[o_chk_updateOnStartup setState: check];
/* make sure we got this set, even if we crash later on */
[[NSUserDefaults standardUserDefaults] synchronize];
}
- (BOOL)shouldCheckForUpdate
{
NSDate *o_last_update;
NSDate *o_next_update;
if( ![[NSUserDefaults standardUserDefaults] objectForKey: kPrefUpdateOnStartup] )
{
/* We don't have any preferences stored, ask the user. */
NSInteger res = NSRunInformationalAlertPanel( _NS("Do you want VLC to check for updates automatically?"),
_NS("You can change this option in VLC's update window later on."), _NS("Yes"), _NS("No"), nil );
[self setShouldCheckUpdate: res];
}
if( ![[NSUserDefaults standardUserDefaults] boolForKey: kPrefUpdateOnStartup] )
return NO;
o_last_update = [[NSUserDefaults standardUserDefaults] objectForKey: kPrefUpdateLastTimeChecked];
if( !o_last_update )
return YES;
o_next_update = [[[NSDate alloc] initWithTimeInterval: 60*60*24*7 /* every seven days */ sinceDate: o_last_update] autorelease];
if( !o_next_update )
return YES;
return [o_next_update compare: [NSDate date]] == NSOrderedAscending;
}
- (void)showUpdateWindow
{
/* show the window and check for a potential update */
[o_update_window center];
[o_update_window displayIfNeeded];
[o_update_window makeKeyAndOrderFront:nil];
if( !b_checked )
{
[o_bar_checking startAnimation: self];
[self checkForUpdate];
b_checked = true;
[o_bar_checking stopAnimation: self];
}
}
- (IBAction)download:(id)sender
{
/* provide a save dialogue */
SEL sel = @selector(getLocationForSaving:returnCode:contextInfo:);
NSSavePanel * saveFilePanel = [[NSSavePanel alloc] init];
[saveFilePanel setRequiredFileType: @"dmg"];
[saveFilePanel setCanSelectHiddenExtension: YES];
[saveFilePanel setCanCreateDirectories: YES];
update_release_t *p_release = update_GetRelease( p_u );
assert( p_release );
[saveFilePanel beginSheetForDirectory:@"~/Downloads" file:
[[[NSString stringWithUTF8String: p_release->psz_url] componentsSeparatedByString:@"/"] lastObject]
modalForWindow: o_update_window
modalDelegate:self
didEndSelector:sel
contextInfo:nil];
}
- (void)getLocationForSaving: (NSSavePanel *)sheet
returnCode: (int)returnCode
contextInfo: (void *)contextInfo
{
if( returnCode == NSOKButton )
{
/* perform download and pass the selected path */
[NSThread detachNewThreadSelector:@selector(performDownload:) toTarget:self withObject:[sheet filename]];
}
[sheet release];
}
- (IBAction)okay:(id)sender
{
/* just hides the window */
[o_update_window orderOut: self];
}
- (IBAction)changeCheckUpdateOnStartup:(id)sender
{
[self setShouldCheckUpdate: [sender state]];
}
- (void)setUpToDate:(NSNumber *)uptodate
{
if( [uptodate boolValue] )
{
[o_fld_releaseNote setString: @""];
[o_fld_currentVersion setStringValue: @""];
[o_fld_status setStringValue: _NS("This version of VLC is the latest available.")];
[o_btn_DownloadNow setEnabled: NO];
}
else
{
update_release_t *p_release = update_GetRelease( p_u );
[o_fld_releaseNote setString: [NSString stringWithUTF8String: (p_release->psz_desc ? p_release->psz_desc : "" )]];
[o_fld_status setStringValue: _NS("This version of VLC is outdated.")];
[o_fld_currentVersion setStringValue: [NSString stringWithFormat:
_NS("The current release is %d.%d.%d%c."), p_release->i_major,
p_release->i_minor, p_release->i_revision, p_release->extra]];
[o_btn_DownloadNow setEnabled: YES];
/* Make sure the update window is showed in case we have something */
[o_update_window center];
[o_update_window displayIfNeeded];
[o_update_window makeKeyAndOrderFront: self];
}
}
static void updateCallback( void * p_data, bool b_success )
{
VLCUpdate * update = p_data;
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber * state = [NSNumber numberWithBool:!b_success || !update_NeedUpgrade( update->p_u )];
[update performSelectorOnMainThread:@selector(setUpToDate:) withObject:state waitUntilDone:YES];
[pool release];
}
- (void)checkForUpdate
{
p_u = update_New( VLCIntf );
if( !p_u )
return;
update_Check( p_u, updateCallback, self );
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
[[NSUserDefaults standardUserDefaults] setObject: [NSDate date] forKey: kPrefUpdateLastTimeChecked];
[pool release];
}
- (void)performDownload:(NSString *)path
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
update_Download( p_u, [path UTF8String] );
[o_btn_DownloadNow setEnabled: NO];
[o_update_window orderOut: self];
update_WaitDownload( p_u );
update_Delete( p_u );
p_u = nil;
[pool release];
}
@end
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment