snowl/content/notification.xml

119 строки
5.3 KiB
XML

<?xml version="1.0"?>
<!DOCTYPE bindings [
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
<!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
%notificationDTD;
<!ENTITY % snowlNotificationDTD SYSTEM "chrome://snowl/locale/notification.dtd">
%snowlNotificationDTD;
<!ENTITY % feedDTD SYSTEM "chrome://browser/locale/feeds/subscribe.dtd">
%feedDTD;
]>
<bindings id="notificationBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xbl="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="feedSubscribeNotification"
extends="chrome://global/content/bindings/notification.xml#notification">
<resources>
<stylesheet src="chrome://global/skin/notification.css"/>
<stylesheet src="chrome://browser/skin/feeds/subscribe.css"/>
</resources>
<content>
<xul:hbox class="notification-inner outset" flex="1" xbl:inherits="type">
<xul:hbox anonid="details" align="center" flex="1"
oncommand="this.parentNode.parentNode._doButtonCommand(event);">
<xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image"/>
<xul:description anonid="messageText" class="messageText" xbl:inherits="xbl:text=label" flex="1"/>
<xul:spacer flex="1"/>
<xul:button label="&undo.label;" anonid="undoButton" oncommand="document.getBindingParent(this).undo()"/>
<xul:button label="&preferencesCmd.label;" anonid="feedOptionsButton"
oncommand="document.getBindingParent(this).openOptionsPanel(this)"/>
<children/>
</xul:hbox>
<xul:toolbarbutton ondblclick="event.stopPropagation();"
class="messageCloseButton tabbable"
xbl:inherits="hidden=hideclose"
tooltiptext="&closeNotification.tooltip;"
oncommand="document.getBindingParent(this).close();"/>
</xul:hbox>
<xul:panel anonid="optionsPanel" style="padding: 10px">
<xul:vbox align="start">
<xul:hbox align="baseline">
<xul:description anonid="subscribeUsingDescription"/>
<xul:menulist anonid="handlersMenuList" aria-labelledby="subscribeUsingDescription">
<xul:menupopup menugenerated="true" anonid="handlersMenuPopup">
<xul:menuitem anonid="liveBookmarksMenuItem"
label="&feedLiveBookmarks;"
class="menuitem-iconic"
image="chrome://browser/skin/page-livemarks.png"
selected="true" />
<xul:menuseparator />
</xul:menupopup>
</xul:menulist>
</xul:hbox>
<xul:checkbox anonid="alwaysUse" checked="false"/>
</xul:vbox>
<xul:vbox align="end">
<xul:button label="&feedSubscribeNow;" anonid="subscribeButton"/>
</xul:vbox>
</xul:panel>
</content>
<implementation>
<constructor>
Cu.import("resource://snowl/modules/FeedWriter.js");
this._feedWriter = new FeedWriter();
</constructor>
<method name="init">
<parameter name="feed"/>
<!-- The window into which the Snowl river view has been loaded,
- as distinct from |window|, which is the XUL browser window
- in the context of this notification. -->
<parameter name="feedWindow"/>
<body><![CDATA[
this._feed = feed;
let elements = {
feedHeader: this,
details: document.getAnonymousElementByAttribute(this, "anonid", "details"),
messageImage: document.getAnonymousElementByAttribute(this, "anonid", "messageImage"),
messageText: document.getAnonymousElementByAttribute(this, "anonid", "messageText"),
subscribeUsingDescription: document.getAnonymousElementByAttribute(this, "anonid", "subscribeUsingDescription"),
handlersMenuList: document.getAnonymousElementByAttribute(this, "anonid", "handlersMenuList"),
handlersMenuPopup: document.getAnonymousElementByAttribute(this, "anonid", "handlersMenuPopup"),
liveBookmarksMenuItem: document.getAnonymousElementByAttribute(this, "anonid", "liveBookmarksMenuItem"),
alwaysUse: document.getAnonymousElementByAttribute(this, "anonid", "alwaysUse"),
subscribeButton: document.getAnonymousElementByAttribute(this, "anonid", "subscribeButton"),
};
this._feedWriter.init(window, feedWindow, this, elements, feed);
]]></body>
</method>
<method name="undo">
<body><![CDATA[
this._feed.unstore();
this.close();
]]></body>
</method>
<method name="openOptionsPanel">
<parameter name="optionsButton"/>
<body><![CDATA[
document.
getAnonymousElementByAttribute(this, 'anonid', 'optionsPanel').
openPopup(optionsButton, "after_start");
]]></body>
</method>
</implementation>
</binding>
</bindings>