|
Revision 917, 0.8 kB
(checked in by astrange, 2 months ago)
|
Delete progress indicators from the prefpane, they're ugly and pointless.
Get rid of alert panels in the update checker and use IPC to show them in the prefpane instead.
Fix the update checker never cleaning up its locks.
Synchronize user defaults more often since it seems necessary.
Delete code for not running too often in the update checker, it's a duplicate of the same more-maintained code in Perian.
This requires merging the nib into release branch again...
|
| Line | |
|---|
| 1 |
// |
|---|
| 2 |
// main.m |
|---|
| 3 |
// Perian |
|---|
| 4 |
// |
|---|
| 5 |
// Created by Augie Fackler on 1/7/07. |
|---|
| 6 |
// Copyright 2007 __MyCompanyName__. All rights reserved. |
|---|
| 7 |
// |
|---|
| 8 |
|
|---|
| 9 |
#import <Cocoa/Cocoa.h> |
|---|
| 10 |
#include <sys/stat.h> |
|---|
| 11 |
#include <unistd.h> |
|---|
| 12 |
|
|---|
| 13 |
#define lockPath "/tmp/PerianUpdateLock" |
|---|
| 14 |
|
|---|
| 15 |
static int fp = -1; |
|---|
| 16 |
|
|---|
| 17 |
static void deleteLock() |
|---|
| 18 |
{ |
|---|
| 19 |
close(fp); |
|---|
| 20 |
unlink(lockPath); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
int main(int argc, char *argv[]) |
|---|
| 24 |
{ |
|---|
| 25 |
fp = open(lockPath, O_CREAT | O_EXCL); |
|---|
| 26 |
if(fp == -1) |
|---|
| 27 |
{ |
|---|
| 28 |
struct stat lockfile; |
|---|
| 29 |
time_t current = time(NULL); |
|---|
| 30 |
if(stat(lockPath, &lockfile)) |
|---|
| 31 |
{ |
|---|
| 32 |
if(lockfile.st_ctimespec.tv_sec + 60*60 > current) //Only pay attention to lock file if it is no more than an hour old |
|---|
| 33 |
{ |
|---|
| 34 |
unlink(lockPath); |
|---|
| 35 |
fp = open(lockPath, O_CREAT | O_EXCL | O_EXLOCK); |
|---|
| 36 |
} |
|---|
| 37 |
} |
|---|
| 38 |
} |
|---|
| 39 |
if(fp == -1) |
|---|
| 40 |
return 0; |
|---|
| 41 |
|
|---|
| 42 |
atexit(deleteLock); |
|---|
| 43 |
|
|---|
| 44 |
int ret = NSApplicationMain(argc, (const char **) argv); |
|---|
| 45 |
|
|---|
| 46 |
return ret; |
|---|
| 47 |
} |
|---|