browser/base/content/sync/notification.xml

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 <?xml version="1.0"?>
     3 <!-- This Source Code Form is subject to the terms of the Mozilla Public
     4    - License, v. 2.0. If a copy of the MPL was not distributed with this
     5    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
     7 <!DOCTYPE bindings [
     8 <!ENTITY % notificationDTD SYSTEM "chrome://global/locale/notification.dtd">
     9 %notificationDTD;
    10 ]>
    12 <bindings id="notificationBindings"
    13           xmlns="http://www.mozilla.org/xbl"
    14           xmlns:xbl="http://www.mozilla.org/xbl"
    15           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    17   <binding id="notificationbox" extends="chrome://global/content/bindings/notification.xml#notificationbox">
    18     <content>
    19       <xul:vbox xbl:inherits="hidden=notificationshidden">
    20         <xul:spacer/>
    21         <children includes="notification"/>
    22       </xul:vbox>
    23       <children/>
    24     </content>
    26     <implementation>
    27       <constructor><![CDATA[
    28         let temp = {};
    29         Cu.import("resource://services-common/observers.js", temp);
    30         temp.Observers.add("weave:notification:added", this.onNotificationAdded, this);
    31         temp.Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
    33         for each (var notification in Weave.Notifications.notifications)
    34           this._appendNotification(notification);
    35       ]]></constructor>
    37       <destructor><![CDATA[
    38         let temp = {};
    39         Cu.import("resource://services-common/observers.js", temp);
    40         temp.Observers.remove("weave:notification:added", this.onNotificationAdded, this);
    41         temp.Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
    42       ]]></destructor>
    44       <method name="onNotificationAdded">
    45         <parameter name="subject"/>
    46         <parameter name="data"/>
    47         <body><![CDATA[
    48           this._appendNotification(subject);
    49         ]]></body>
    50       </method>
    52       <method name="onNotificationRemoved">
    53         <parameter name="subject"/>
    54         <parameter name="data"/>
    55         <body><![CDATA[
    56           // If the view of the notification hasn't been removed yet, remove it.
    57           var notifications = this.allNotifications;
    58           for each (var notification in notifications) {
    59             if (notification.notification == subject) {
    60               notification.close();
    61               break;
    62             }
    63           }
    64         ]]></body>
    65       </method>
    67       <method name="_appendNotification">
    68         <parameter name="notification"/>
    69         <body><![CDATA[
    70           var node = this.appendNotification(notification.description,
    71                                              notification.title,
    72                                              notification.iconURL,
    73                                              notification.priority,
    74                                              notification.buttons);
    75           node.notification = notification;
    76         ]]></body>
    77       </method>
    79     </implementation>
    80   </binding>
    82   <binding id="notification" extends="chrome://global/content/bindings/notification.xml#notification">
    83     <content>
    84       <xul:hbox class="notification-inner outset" flex="1" xbl:inherits="type">
    85         <xul:toolbarbutton ondblclick="event.stopPropagation();"
    86                            class="messageCloseButton close-icon tabbable"
    87                            xbl:inherits="hidden=hideclose"
    88                            tooltiptext="&closeNotification.tooltip;"
    89                            oncommand="document.getBindingParent(this).close()"/>
    90         <xul:hbox anonid="details" align="center" flex="1">
    91           <xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image"/>
    92           <xul:description anonid="messageText" class="messageText" xbl:inherits="xbl:text=label"/>
    94           <!-- The children are the buttons defined by the notification. -->
    95           <xul:hbox oncommand="document.getBindingParent(this)._doButtonCommand(event);">
    96             <children/>
    97           </xul:hbox>
    98         </xul:hbox>
    99       </xul:hbox>
   100     </content>
   101     <implementation>
   102       <!-- Note: this used to be a field, but for some reason it kept getting
   103          - reset to its default value for TabNotification elements.
   104          - As a property, that doesn't happen, even though the property stores
   105          - its value in a JS property |_notification| that is not defined
   106          - in XBL as a field or property.  Maybe this is wrong, but it works.
   107          -->
   108       <property name="notification"
   109                 onget="return this._notification"
   110                 onset="this._notification = val; return val;"/>
   111       <method name="close">
   112         <body><![CDATA[
   113           Weave.Notifications.remove(this.notification);
   115           // We should be able to call the base class's close method here
   116           // to remove the notification element from the notification box,
   117           // but we can't because of bug 373652, so instead we copied its code
   118           // and execute it below.
   119           var control = this.control;
   120           if (control)
   121             control.removeNotification(this);
   122           else
   123             this.hidden = true;
   124         ]]></body>
   125       </method>
   126     </implementation>
   127   </binding>
   129 </bindings>

mercurial