Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnycrab committed Sep 4, 2014
2 parents bf77f05 + 7b14a47 commit fda8146
Show file tree
Hide file tree
Showing 22 changed files with 305 additions and 166 deletions.
3 changes: 2 additions & 1 deletion src/config/mainConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
},
"app" : {
"dataPath": "appDataFolder",
"internalDataPath": "initialState"
"internalDataPath": "initialState",
"checkForUpdatesOnStartup": true
},
"share" : {
"downloadManagerStateConfig": "downloadManager.json"
Expand Down
11 changes: 10 additions & 1 deletion src/core/App.js

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

2 changes: 1 addition & 1 deletion src/core/App.js.map

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/core/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,12 @@ var App = {
},

_checkForUpdates: function () {
var appConfig = this._getMainConfig(['app']);

if (!appConfig.get('app.checkForUpdatesOnStartup', false)) {
return;
}

UiUpdateNotify.checkForUpdates(this._gui);
},

Expand Down Expand Up @@ -218,7 +224,6 @@ var App = {
}
}*/
this._initSplashScreen();
this._checkForUpdates();

if (this._environmentConfig.get('environment.startSearchDatabase')) {
this._startSearchDatabase();
Expand Down Expand Up @@ -385,6 +390,10 @@ var App = {
if (this._splashScreen) {
this._splashScreen.once('close', () => {
this._checkUiRoutines();

setImmediate(() => {
this._checkForUpdates();
});
});
}
},
Expand Down
8 changes: 6 additions & 2 deletions src/core/topology/ObjectBucketStore.js

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

2 changes: 1 addition & 1 deletion src/core/topology/ObjectBucketStore.js.map

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions src/core/topology/ObjectBucketStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,11 @@ class ObjectBucketStore implements BucketStoreInterface {
var dataToPersist:string = JSON.stringify(this._buckets);

if (dataToPersist) {
fs.writeFile(this._dbPathFs, dataToPersist, {encoding: 'utf8'}, (err:Error) => {
fs.outputFile(this._dbPathFs, dataToPersist, (err:Error) => {
this._isWritingFs = false;
});
}
}, this._delayPersistInMs);

}

public add (bucketKey:string, id:Buffer, lastSeen:number, addresses:any):boolean {
Expand Down Expand Up @@ -335,8 +334,14 @@ class ObjectBucketStore implements BucketStoreInterface {
if (this._isOpen) return;

if (!fs.existsSync(this._dbFolderFs)) {
this._isUnwritableFs = true;
try {
fs.mkdirsSync(this._dbFolderFs);
}
catch (e) {
this._isUnwritableFs = true;
}
}

// check if the database file exists
else if (fs.existsSync(this._dbPathFs)) {
// load the contents from the file
Expand Down
16 changes: 14 additions & 2 deletions src/core/ui/UiDaemon.js

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

2 changes: 1 addition & 1 deletion src/core/ui/UiDaemon.js.map

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

18 changes: 15 additions & 3 deletions src/core/ui/UiDaemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class UiDaemon implements UiDaemonInterface {

constructor (gui, appQuitHandler:AppQuitHandlerInterface) {
this._tray = new gui.Tray({
icon : './images/icon-menubar.png',
alticon: './images/icon-menubar-active.png'
icon : './images/icon-menubar@2x.png',
alticon: './images/icon-menubar-active@2x.png'
});

this._menu = new gui.Menu();
Expand All @@ -40,6 +40,7 @@ class UiDaemon implements UiDaemonInterface {

this._aboutWindow = gui.Window.open('./public/about.html', {
position : 'center',
show : false,
focus : true,
toolbar : false,
frame : true,
Expand All @@ -52,6 +53,11 @@ class UiDaemon implements UiDaemonInterface {

this._aboutWindow.setAlwaysOnTop(true);

this._aboutWindow.once('loaded', () => {
this._aboutWindow.show();
this._aboutWindow.focus();
});

this._aboutWindow.once('close', () => {
this._aboutWindow = null;
});
Expand All @@ -67,7 +73,13 @@ class UiDaemon implements UiDaemonInterface {
label: i18n.__('UiDaemon.menu.quit.title')
});

quitItem.click = function () {
quitItem.click = () => {
this._menu.remove(quitItem);
this._menu.append(new gui.MenuItem({
enabled: false,
label: i18n.__('UiDaemon.menu.quitting.title')
}));

appQuitHandler.quit();
};

Expand Down
Loading

0 comments on commit fda8146

Please sign in to comment.