25 var
Cc = Components.classes;
26 var
Ci = Components.interfaces;
27 var
Cu = Components.utils;
42 _albumRadioGroup:
null,
44 onDialogLoad:
function()
47 Cc[
"@songbirdnest.com/device/cd/mock-cddevice-service;1"]
48 .getService(
Ci.sbICDDeviceService);
50 this._device1 = mockCDService.getDevice(0);
51 this._device2 = mockCDService.getDevice(1);
53 mockCDService.registerListener(
this);
55 this._buttonDevice1 = document.getElementById(
"mockcd-drive1-button");
56 this._buttonDevice2 = document.getElementById(
"mockcd-drive2-button");
57 this._albumRadioGroup = document.getElementById(
"album-radiogroup");
62 onDriveAction:
function(aDeviceNum)
64 var device = (aDeviceNum == 1 ? this._device1 : this._device2);
65 this._handleDriveAction(device);
68 _handleDriveAction:
function(aDevice)
71 Cc[
"@songbirdnest.com/device/cd/mock-cddevice-service;1"]
72 .getService(
Ci.sbICDDeviceService)
73 .QueryInterface(
Ci.sbIMockCDDeviceController);
75 if (aDevice.isDiscInserted) {
76 mockCDService.ejectMedia(aDevice);
80 var mediaIndex = parseInt(this._albumRadioGroup.selectedItem.value);
81 mockCDService.insertMedia(aDevice, mediaIndex);
88 if (this._device1.isDiscInserted) {
89 this._buttonDevice1.setAttribute(
"label",
EJECT_LABEL +
"1");
92 this._buttonDevice1.setAttribute(
"label",
INSERT_LABEL +
"1");
94 if (this._device2.isDiscInserted) {
95 this._buttonDevice2.setAttribute(
"label",
EJECT_LABEL +
"2");
98 this._buttonDevice2.setAttribute(
"label",
INSERT_LABEL +
"2");
103 onDeviceRemoved:
function(aCDDevice)
107 onMediaInserted:
function(aCDDevice)
109 dump(
"\n\n\n onMediaInserted: " + aCDDevice.name +
"\n\n\n");
113 onMediaEjected:
function(aCDDevice)
115 dump(
"\n\n\n onMediaEjected: " + aCDDevice.name +
"\n\n\n");