forked from tombfix/patch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.backupConfig.js
39 lines (33 loc) · 1020 Bytes
/
action.backupConfig.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Tombloo.Service.actions.register([
{
type : 'menu',
name : 'Export Tombloo Config',
execute : function(){
var picker = new FilePicker(window, this.name, FilePicker.modeSave);
picker.defaultString = 'tombloo.config';
if(picker.show() != FilePicker.returnCancel){
var prefs = {};
PrefService.getChildList('extensions.tombloo.', {}).forEach(function(key){
prefs[key] = getPrefValue(key);
});
putContents(picker.file, uneval(prefs));
notify(this.name, 'Exported', notify.ICON_INFO);
}
}
},
{
type : 'menu',
name : 'Import Tombloo Config',
execute : function(){
var picker = new FilePicker(window, this.name, FilePicker.modeOpen);
picker.defaultString = 'tombloo.config';
if(picker.show() != FilePicker.returnCancel){
var prefs = eval(getContents(picker.file, 'UTF-8'));
items(prefs).forEach(function([key, value]){
setPrefValue(key, value);
});
notify(this.name, 'Imported', notify.ICON_INFO);
}
}
}
]);