restartBox.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
32 Components.utils.import("resource://app/jsmodules/StringUtils.jsm");
33 
34 //
35 // sbIRestartBox
36 //
37 
41 
52 function sbRestartBox( title, message )
53 {
54  try
55  {
56  var restartbox_data = new Object();
57  var sbIMediacoreStatus = Components.interfaces.sbIMediacoreStatus;
58  var state = gMM.status.state;
59 
60  restartbox_data.title = title;
61  restartbox_data.message = message;
62  restartbox_data.playing = state == sbIMediacoreStatus.STATUS_PLAYING ||
63  state == sbIMediacoreStatus.STATUS_BUFFERING;
64  restartbox_data.ret = 0;
65  SBOpenModalDialog( "chrome://songbird/content/xul/restartBox.xul", "restartbox", "chrome,centerscreen", restartbox_data );
66  var restartOnPlaybackEnd = SB_NewDataRemote( "restart.onplaybackend", null );
67  switch (restartbox_data.ret)
68  {
69  case SB_RESTARTBOX_RESTARTLATER: // restart later
70  restartOnPlaybackEnd.boolValue = false;
71  break;
72  case SB_RESTARTBOX_RESTARTNOW: // restart now
73  restartOnPlaybackEnd.boolValue = false;
74  SBDataSetBoolValue("restart.restartnow", true);
75  break;
76  case SB_RESTARTBOX_RESTARTEOP: // restart on end of playback
77  restartOnPlaybackEnd.boolValue = true;
78  break;
79  }
80  return restartbox_data.ret;
81  }
82  catch ( err )
83  {
84  alert("sbRestartBox - " + err);
85  }
86  return -1;
87 }
88 
102 function sbRestartBox_strings(titlestring, msgstring, defaulttitle, defaultmsg) {
103  msg = SBBrandedString(msgstring, defaultmsg);
104  title = SBBrandedString(titlestring, defaulttitle);
105  return sbRestartBox(title, msg);
106 }
107 
function SBBrandedString(aKey, aDefault, aStringBundle)
var gMM
Definition: windowUtils.js:62
const SB_RESTARTBOX_RESTARTNOW
Definition: restartBox.js:39
const SB_RESTARTBOX_RESTARTEOP
Definition: restartBox.js:40
const SB_NewDataRemote
function SBDataSetBoolValue(aKey, aBoolValue)
Set a boolean value. Changes the value of the data remote to the boolean passed in, regardless of its value before.
const SB_RESTARTBOX_RESTARTLATER
Definition: restartBox.js:38
function sbRestartBox(title, message)
Display a restart message box with a title and message.
Definition: restartBox.js:52
GstMessage * message
return null
Definition: FeedWriter.js:1143
function sbRestartBox_strings(titlestring, msgstring, defaulttitle, defaultmsg)
Display a restart message box using strings from the songbird.properties locale file.
Definition: restartBox.js:102
function msg