radioPrefs.js
Go to the documentation of this file.
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license in LICENSE.TXT or at
9  * http://www.opensource.org/licenses/cddl1.php
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at LICENSE.TXT
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 var Cc = Components.classes;
23 var Ci = Components.interfaces;
24 
25 const shoutcastCheckBitRate = "extensions.shoutcast-radio.limit-bit-rate";
26 const shoutcastCheckListeners = "extensions.shoutcast-radio.limit-listeners";
27 
28 var radioPrefs = {
29  openPreferences: function() {
30  var windowMediator;
31  var window;
32 
33  windowMediator = Cc["@mozilla.org/appshell/window-mediator;1"].
34  getService(Ci.nsIWindowMediator);
35  window = windowMediator.getMostRecentWindow("Songbird:Main");
36 
37  /* Open the Radio preferences pane. */
38  window.SBOpenPreferences("radioPrefsPane");
39  },
40 
41  handleLoad: function() {
42  },
43 
44  updateStates: function() {
45  var cBitRateBox = document.getElementById("checkBitRatePref");
46  var bitRateMenu = document.getElementById("bitRateMenu");
47  var listenersText = document.getElementById("textListenersPref");
48  var cListenersBox = document.getElementById("checkListenersPref");
49  Application.prefs.setValue(shoutcastCheckBitRate, cBitRateBox.checked);
50  Application.prefs.setValue(shoutcastCheckListeners,
51  cListenersBox.checked);
52  if (cBitRateBox.checked)
53  bitRateMenu.disabled = false;
54  else
55  bitRateMenu.disabled = true;
56  if (cListenersBox.checked)
57  listenersText.disabled = false;
58  else
59  listenersText.disabled = true;
60 
61  }
62 }
63 
64 
var Application
Definition: sbAboutDRM.js:37
getService(Ci.sbIFaceplateManager)
let window
function openPreferences(paneID, extraArgs)
const shoutcastCheckListeners
Definition: radioPrefs.js:26
const shoutcastCheckBitRate
Definition: radioPrefs.js:25
var Cc
Definition: radioPrefs.js:22
var Ci
Definition: radioPrefs.js:23