Files
Mozilla/mozilla/toolkit/mozapps/update/content/updates.xml
ben%bengoodger.com 4443c77e27 Make the update wizard actually invoke XPInstall APIs to install the updates
git-svn-id: svn://10.0.0.236/trunk@155627 18797224-902f-48f8-a5cc-f745e15eee43
2004-04-28 07:30:08 +00:00

195 lines
7.4 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE bindings SYSTEM "chrome://mozapps/locale/update/update.dtd">
<bindings id="updatesBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="updateStatusbarNotification" extends="chrome://global/content/bindings/general.xml#statusbarpanel">
<resources>
<stylesheet src="chrome://mozapps/skin/update/update.css"/>
</resources>
<content>
<xul:hbox flex="1" class="updateIndicator" xbl:inherits="updateCount"
anonid="infoPanel">
<xul:image xbl:inherits="severity" class="updateIcon"/>
<xul:label xbl:inherits="value=updateCount" flex="1" crop="right"/>
</xul:hbox>
</content>
<implementation implements="nsIObserver, nsIAlertListener">
<constructor>
<![CDATA[
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(this, "Update:Ended", false);
this.refreshData("null");
]]>
</constructor>
<destructor>
<![CDATA[
var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.removeObserver(this, "Update:Ended");
]]>
</destructor>
<!-- nsIObserver -->
<method name="observe">
<parameter name="aSubject"/>
<parameter name="aTopic"/>
<parameter name="aData"/>
<body>
<![CDATA[
if (aTopic == "Update:Ended")
this.refreshData(Components.interfaces.nsIUpdateService.SOURCE_EVENT_BACKGROUND);
]]>
</body>
</method>
<method name="refreshData">
<parameter name="aSourceEvent"/>
<body>
<![CDATA[
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
.getService(Components.interfaces.nsIUpdateService);
this.severity = updates.updateSeverity;
this.updateCount = updates.updateCount;
#ifdef XP_WIN
if (parseInt(aSourceEvent) == Components.interfaces.nsIUpdateService.SOURCE_EVENT_BACKGROUND)
this._showUpdateInfo();
#endif
]]>
</body>
</method>
#ifdef XP_WIN
<method name="_showUpdateInfo">
<body>
<![CDATA[
var sbs = Components.classes["@mozilla.org/intl/stringbundle;1"]
.getService(Components.interfaces.nsIStringBundleService);
var bundle = sbs.createBundle("chrome://mozapps/locale/update/update.properties");
var alertTitle = bundle.GetStringFromName("updatesAvailableTitle");
var alertText = bundle.GetStringFromName("updatesAvailableText");
var alerts = Components.classes["@mozilla.org/alerts-service;1"]
.getService(Components.interfaces.nsIAlertsService);
alerts.showAlertNotification("chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png",
alertTitle, alertText, true, "", this);
]]>
</body>
</method>
<!-- nsIAlertListener -->
<method name="onAlertFinished">
<parameter name="aCookie"/>
<body>
<![CDATA[
]]>
</body>
</method>
<method name="onAlertClickCallback">
<parameter name="aCookie"/>
<body>
<![CDATA[
this.showUpdates();
]]>
</body>
</method>
#endif
<method name="showUpdates">
<body>
<![CDATA[
var updates = Components.classes["@mozilla.org/updates/update-service;1"]
.getService(Components.interfaces.nsIUpdateService);
updates.checkForUpdates([], 0, Components.interfaces.nsIUpdateItem.TYPE_ANY,
Components.interfaces.nsIUpdateService.SOURCE_EVENT_USER,
window);
]]>
</body>
</method>
<property name="severity" onset="this.setAttribute('severity', val); return val;"
onget="return this.getAttribute('severity');"/>
<property name="updateCount" onset="this.setAttribute('updateCount', val); return val;"
onget="return this.getAttribute('updateCount');"/>
</implementation>
<handlers>
<handler event="dblclick">
<![CDATA[
this.showUpdates();
]]>
</handler>
</handlers>
</binding>
<binding id="updateItem">
<resources>
<stylesheet src="chrome://mozapps/skin/update/update.css"/>
</resources>
<content>
<xul:hbox flex="1">
<xul:stack>
<xul:vbox align="center">
<xul:image class="updateItemIcon" xbl:inherits="src=icon"/>
</xul:vbox>
<xul:vbox align="right">
<xul:checkbox class="updateItemChecked" anonid="updateItemChecked" xbl:inherits="checked"/>
</xul:vbox>
</xul:stack>
<xul:vbox flex="1">
<xul:hbox class="updateItemNameRow" align="center">
<xul:label class="updateItemName" xbl:inherits="value=name" flex="1" crop="right"/>
</xul:hbox>
<xul:hbox class="updateItemInfoRow" anonid="updateItemInfoRow" align="center" hidden="true">
<xul:label class="updateItemInfo" anonid="updateItemText" flex="1" crop="right">&appInfo.label;</xul:label>
</xul:hbox>
<xul:hbox class="updateItemDetailsRow" align="center">
<xul:label class="updateItemFromLabel">&from.label;</xul:label>
<xul:textbox class="updateItemURL" xbl:inherits="value=url" flex="1" readonly="true" crop="right"/>
</xul:hbox>
</xul:vbox>
</xul:hbox>
</content>
<implementation>
<property name="name" onset="this.setAttribute('name', val); return val;"
onget="return this.getAttribute('name');"/>
<property name="url" onset="this.setAttribute('url', val); return val;"
onget="return this.getAttribute('url');"/>
<property name="icon" onset="this.setAttribute('icon', val); return val;"
onget="return this.getAttribute('icon');"/>
<property name="type" onget="return parseInt(this.getAttribute('type'));">
<setter>
<![CDATA[
this.setAttribute("type", val);
if (val == Components.interfaces.nsIUpdateItem.TYPE_APP) {
var infoRow = document.getAnonymousElementByAttribute(this, "anonid", "updateItemInfoRow");
infoRow.removeAttribute("hidden");
}
return val;
]]>
</setter>
</property>
<property name="checked">
<setter>
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
checkbox.checked = val;
return val;
</setter>
<getter>
var checkbox = document.getAnonymousElementByAttribute(this, "anonid", "updateItemChecked");
return checkbox.checked;
</getter>
</property>
</implementation>
</binding>
</bindings>