6 if (typeof playlistfolders ==
'undefined') {
7 var playlistfolders = {};
13 playlistfolders.central={
16 this.logEvent(
"central",
"Central controller initialisation started.", 5);
19 var sbSvc =
Cc[
"@mozilla.org/intl/stringbundle;1"].
21 var stringBundle = sbSvc.createBundle(
"chrome://songbird/locale/" +
22 "songbird.properties");
23 document.getElementById(
"menuitem_file_folder").
25 stringBundle.GetStringFromName(
"menu.servicepane." +
27 document.getElementById(
"menuitem_file_folder").
29 stringBundle.GetStringFromName(
"menu.servicepane." +
34 playlistfolders.preferences.onLoad(e);
35 playlistfolders.servicepane.onLoad(e);
37 this.logEvent(
"central",
"Central controller started.", 4);
39 this.logEvent(
"central",
"Startup of Central controller failed:\n\n" + e,
40 1,
"chrome://playlistfolders/content/central.js",
47 this.logEvent(
"central",
"Central controller shutdown started.", 5);
49 playlistfolders.preferences.onUnload(e);
50 playlistfolders.servicepane.onUnload(e);
52 this.logEvent(
"central",
"Central controller stopped.", 4);
67 logEvent:
function(
module,
msg, type, srcFile, srcLine){
69 if (playlistfolders.preferences.getEvtLogLevel() < type)
72 var msgStr =
"Playlist Folders: Event raised in '" +
module +
"':\n" +
msg;
74 var consoleService = Components.classes[
"@mozilla.org/consoleservice;1"].
75 getService(Components.interfaces.nsIConsoleService);
80 var
message = Components.classes[
"@mozilla.org/scripterror;1"].
85 srcLine == 0 ?
null : srcLine,
87 type != 3 ? 0x0 : 0x1 ,
89 consoleService.logMessage(message);
92 consoleService.logStringMessage(msgStr);
99 removePlaylist:
function(playlist){
100 this.logEvent(
"central",
"Delete Playlist " + playlist, 5);
101 var library =
Cc[
"@songbirdnest.com/Songbird/library/Manager;1"].
103 var pl = library.getItemByGuid(playlist);
108 this.logEvent(
"central",
"Could not delete Playlist " + playlist +
"\n\n" +
109 "Playlist not found in library", 2,
110 "chrome://playlistfolders/content/central.js");
116 window.addEventListener(
"load",
118 playlistfolders.central.onLoad(e);
121 window.addEventListener(
"unload",
123 playlistfolders.central.onUnload(e);
getService(Ci.sbIFaceplateManager)
menuItem setAttribute("handlerType","client")
function onUnload()
onUnload - called when the cover preview window unloads.