Bug 1583481 - remove unnecessary observes= from calendar. r=Fallen
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Wed, 09 Oct 2019 01:12:23 +0300
changeset 37109 e544df90a3f3a56de390b0e0e3d20d3dffaf826b
parent 37108 0daedafc7c204fc261f746775d24fa7ec81ab3a4
child 37110 58c46e562118f7abfe56eca1b3e43bee42d4430e
push id395
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:38:57 +0000
reviewersFallen
bugs1583481
Bug 1583481 - remove unnecessary observes= from calendar. r=Fallen
calendar/base/content/calendar-common-sets.xul
calendar/base/content/calendar-management.js
calendar/base/content/calendar-menus.js
calendar/base/content/calendar-task-view.xul
calendar/base/content/calendar-views.xul
calendar/base/content/dialogs/calendar-event-dialog.xul
calendar/base/content/today-pane.xul
calendar/lightning/content/lightning-menus.xul
calendar/lightning/content/lightning-toolbar.xul
calendar/lightning/content/messenger-overlay-sidebar.xul
--- a/calendar/base/content/calendar-common-sets.xul
+++ b/calendar/base/content/calendar-common-sets.xul
@@ -93,38 +93,41 @@
   </commandset>
 
   <keyset id="calendar-keys">
 
 // For linux tab switching reservers alt+number, where on windows that's ctrl.
 // Use the available modifiers for each platform.
 // Can't use the OPTION key on OSX, so we will use SHIFT+OPTION on the Mac.
     <key id="calendar-day-view-key" key="1"
-         observes="calendar_day-view_command"
+         command="calendar_day-view_command"
          modifiers-linux="accel"
          modifiers-macosx="shift alt"
          modifiers-win="alt"/>
     <key id="calendar-week-view-key" key="2"
-         observes="calendar_week-view_command"
+         command="calendar_week-view_command"
          modifiers-linux="accel"
          modifiers-macosx="shift alt"
          modifiers-win="alt"/>
     <key id="calendar-multiweek-view-key" key="3"
-         observes="calendar_multiweek-view_command"
+         command="calendar_multiweek-view_command"
          modifiers-linux="accel"
          modifiers-macosx="shift alt"
          modifiers-win="alt"/>
     <key id="calendar-month-view-key" key="4"
-         observes="calendar_month-view_command"
+         command="calendar_month-view_command"
          modifiers-linux="accel"
          modifiers-macosx="shift alt"
          modifiers-win="alt"/>
-    <key id="calendar-go-to-today-key" keycode="VK_END" observes="calendar_go_to_today_command" modifiers="alt"/>
-    <key id="calendar-delete-item-key" keycode="VK_DELETE" observes="calendar_delete_event_command"/>
-    <key id="calendar-delete-todo-key" keycode="VK_DELETE" observes="calendar_delete_todo_command"/>
+    <key id="calendar-go-to-today-key" keycode="VK_END"
+         command="calendar_go_to_today_command" modifiers="alt"/>
+    <key id="calendar-delete-item-key" keycode="VK_DELETE"
+         command="calendar_delete_event_command"/>
+    <key id="calendar-delete-todo-key" keycode="VK_DELETE"
+         command="calendar_delete_todo_command"/>
   </keyset>
 
   <popupset id="calendar-popupset">
     <!-- Tooltips -->
     <tooltip id="eventTreeTooltip"
              onpopupshowing="return showToolTip(this, unifinderTreeView.getItemFromEvent(event))"
              noautohide="true"/>
 
@@ -135,45 +138,42 @@
     <tooltip id="itemTooltip"
              noautohide="true"/>
 
     <!-- CALENDAR ITEM CONTEXT MENU -->
     <menupopup id="calendar-item-context-menu" onpopupshowing="return setupContextItemType(event, currentView().getSelectedItems({}));">
       <menuitem id="calendar-item-context-menu-modify-menuitem"
                 label="&calendar.context.modifyorviewitem.label;"
                 accesskey="&calendar.context.modifyorviewitem.accesskey;"
-                observes="calendar_modify_event_command"/>
+                command="calendar_modify_event_command"/>
       <menuitem id="calendar-item-context-menu-newevent-menutitem"
                 label="&calendar.context.newevent.label;"
                 accesskey="&calendar.context.newevent.accesskey;"
                 key="calendar-new-event-key"
-                observes="calendar_new_event_context_command"/>
+                command="calendar_new_event_context_command"/>
       <menuitem id="calendar-item-context-menu-newtodo-menuitem"
                 label="&calendar.context.newtodo.label;"
                 accesskey="&calendar.context.newtodo.accesskey;"
                 key="calendar-new-todo-key"
-                observes="calendar_new_todo_context_command"/>
+                command="calendar_new_todo_context_command"/>
       <menuseparator id="calendar-item-context-menuseparator-adddeletemodify"/>
       <menuitem id="calendar-item-context-menu-cut-menuitem"
                 label="&calendar.context.cutevent.label;"
                 accesskey="&calendar.context.cutevent.accesskey;"
                 key="key_cut"
-                observes="cmd_cut"
                 command="cmd_cut"/>
       <menuitem id="calendar-item-context-menu-copy-menuitem"
                 label="&calendar.context.copyevent.label;"
                 accesskey="&calendar.context.copyevent.accesskey;"
                 key="key_copy"
-                observes="cmd_copy"
                 command="cmd_copy"/>
       <menuitem id="calendar-item-context-menu-paste-menuitem"
                 label="&calendar.context.pasteevent.label;"
                 accesskey="&calendar.context.pasteevent.accesskey;"
                 key="key_paste"
-                observes="cmd_paste"
                 command="cmd_paste"/>
       <menuseparator id="calendar-item-context-separator-cutcopypaste"/>
       <menu id="calendar-item-context-menu-convert-menu"
             label="&calendar.context.convertmenu.label;"
             accesskey="&calendar.context.convertmenu.accesskey.calendar;">
         <menupopup id="calendar-item-context-menu-convert-menupopup">
           <menuitem id="calendar-view-context-menu-convert-message-menuitem"
                     label="&calendar.context.convertmenu.message.label;"
@@ -191,17 +191,17 @@
                     oncommand="calendarTaskButtonDNDObserver.onDropItems(currentView().getSelectedItems({}))"/>
         </menupopup>
       </menu>
       <menuseparator id="calendar-menuseparator-before-delete"/>
       <!-- the label and accesskey of the following menuitem is set during runtime,
            and depends on whether the item is a task or an event -->
       <menuitem id="calendar-item-context-menu-delete-menuitem"
                 key="calendar-delete-item-key"
-                observes="calendar_delete_event_command"/>
+                command="calendar_delete_event_command"/>
       <menu id="calendar-item-context-menu-attendance-menu"
             label="&calendar.context.attendance.menu.label;"
             accesskey="&calendar.context.attendance.menu.accesskey;"
             oncommand="setContextPartstat(event.target, currentView().getSelectedItems({}))"
             observes="calendar_attendance_command">
         <menupopup id="calendar-item-context-menu-attendance-menupopup">
           <label id="calendar-item-context-attendance-thisoccurrence-label"
                  class="calendar-context-heading-label"
@@ -360,40 +360,40 @@
         </menupopup>
       </menu>
     </menupopup>
 
     <!-- CALENDAR VIEW CONTEXT MENU -->
     <menupopup id="calendar-view-context-menu">
       <menuitem id="calendar-view-context-menu-newevent"
                 label="&calendar.context.newevent.label;"
-                observes="calendar_new_event_context_command"
+                command="calendar_new_event_context_command"
                 accesskey="&calendar.context.newevent.accesskey;"
                 key="calendar-new-event-key"/>
       <menuitem id="calendar-view-context-menu-newtodo"
                 label="&calendar.context.newtodo.label;"
-                observes="calendar_new_todo_context_command"
+                command="calendar_new_todo_context_command"
                 accesskey="&calendar.context.newtodo.accesskey;"
                 key="calendar-new-todo-key"/>
       <!-- These labels are set dynamically, based on the current view -->
       <menuitem id="calendar-view-context-menu-previous"
                 label=""
                 accesskey=""
-                observes="calendar_view_prev_command"
+                command="calendar_view_prev_command"
                 label-day="&calendar.prevday.label;"
                 label-week="&calendar.prevweek.label;"
                 label-multiweek="&calendar.prevweek.label;"
                 label-month="&calendar.prevmonth.label;"
                 accesskey-day="&calendar.prevday.accesskey;"
                 accesskey-week="&calendar.prevweek.accesskey;"
                 accesskey-multiweek="&calendar.prevweek.accesskey;"
                 accesskey-month="&calendar.prevmonth.accesskey;"/>
       <menuitem id="calendar-view-context-menu-next"
                 label=""
-                observes="calendar_view_next_command"
+                command="calendar_view_next_command"
                 label-day="&calendar.nextday.label;"
                 label-week="&calendar.nextweek.label;"
                 label-multiweek="&calendar.nextweek.label;"
                 label-month="&calendar.nextmonth.label;"
                 accesskey-day="&calendar.nextday.accesskey;"
                 accesskey-week="&calendar.nextweek.accesskey;"
                 accesskey-multiweek="&calendar.nextweek.accesskey;"
                 accesskey-month="&calendar.nextmonth.accesskey;"/>
@@ -409,105 +409,93 @@
                 label="&calendar.context.copyevent.label;"
                 accesskey="&calendar.context.copyevent.accesskey;"
                 key="key_copy"
                 disabled="true"/>
       <menuitem id="calendar-view-context-menu-paste-menuitem"
                 label="&calendar.context.pasteevent.label;"
                 accesskey="&calendar.context.pasteevent.accesskey;"
                 key="key_paste"
-                observes="cmd_paste"
                 command="cmd_paste"/>
     </menupopup>
 
     <!-- TASK ITEM CONTEXT MENU -->
     <menupopup id="taskitem-context-menu"
                onpopupshowing="changeContextMenuForTask(event);"
                onpopuphiding="handleTaskContextMenuStateChange(event);">
       <menuitem id="task-context-menu-modify"
                 label="&calendar.context.modifyorviewtask.label;"
                 accesskey="&calendar.context.modifyorviewtask.accesskey;"
-                command="calendar_modify_todo_command"
-                observes="calendar_modify_todo_command"/>
+                command="calendar_modify_todo_command"/>
       <menuitem id="task-context-menu-modify-todaypane"
                 label="&calendar.context.modifyorviewtask.label;"
                 accesskey="&calendar.context.modifyorviewtask.accesskey;"
-                command="calendar_modify_todo_todaypane_command"
-                observes="calendar_modify_todo_todaypane_command"/>
+                command="calendar_modify_todo_todaypane_command"/>
       <menuitem id="task-context-menu-new"
                 label="&calendar.context.newtodo.label;"
                 accesskey="&calendar.context.newtodo.accesskey;"
                 key="calendar-new-todo-key"
-                command="calendar_new_todo_command"
-                observes="calendar_new_todo_command"/>
+                command="calendar_new_todo_command"/>
       <menuitem id="task-context-menu-new-todaypane"
                 label="&calendar.context.newtodo.label;"
                 accesskey="&calendar.context.newtodo.accesskey;"
                 key="calendar-new-todo-key"
-                command="calendar_new_todo_todaypane_command"
-                observes="calendar_new_todo_todaypane_command"/>
+                command="calendar_new_todo_todaypane_command"/>
       <menuseparator id="task-context-menuseparator-cutcopypaste"/>
       <menuitem id="task-context-menu-cut-menuitem"
                 label="&calendar.context.cutevent.label;"
                 accesskey="&calendar.context.cutevent.accesskey;"
                 key="key_cut"
-                observes="cmd_cut"
                 command="cmd_cut"/>
       <menuitem id="task-context-menu-copy-menuitem"
                 label="&calendar.context.copyevent.label;"
                 accesskey="&calendar.context.copyevent.accesskey;"
                 key="key_copy"
-                observes="cmd_copy"
                 command="cmd_copy"/>
       <menuitem id="task-context-menu-paste-menuitem"
                 label="&calendar.context.pasteevent.label;"
                 accesskey="&calendar.context.pasteevent.accesskey;"
                 key="key_paste"
-                observes="cmd_paste"
                 command="cmd_paste"/>
       <menuseparator id="calendar-menuseparator-beforemarkcompleted"/>
       <menuitem id="calendar-context-markcompleted"
                 type="checkbox"
                 autocheck="false"
                 label="&calendar.context.markcompleted.label;"
                 accesskey="&calendar.context.markcompleted.accesskey;"
-                observes="calendar_toggle_completed_command"
                 command="calendar_toggle_completed_command"/>
       <menu id="task-context-menu-progress"
             label="&calendar.context.progress.label;"
             accesskey="&calendar.context.progress.accesskey;"
-            command="calendar_general-progress_command"
-            observes="calendar_general-progress_command">
+            command="calendar_general-progress_command">
         <menupopup is="calendar-task-progress-menupopup"/>
       </menu>
       <menu id="task-context-menu-priority"
             label="&calendar.context.priority.label;"
             accesskey="&calendar.context.priority.accesskey;"
-            command="calendar_general-priority_command"
-            observes="calendar_general-priority_command">
+            command="calendar_general-priority_command">
         <menupopup is="calendar-task-priority-menupopup"/>
       </menu>
       <menu id="task-context-menu-postpone"
             label="&calendar.context.postpone.label;"
             accesskey="&calendar.context.postpone.accesskey;"
-            command="calendar_general-postpone_command"
-            observes="calendar_general-postpone_command">
+            command="calendar_general-postpone_command">
         <menupopup id="task-context-postpone-menupopup">
           <menuitem id="task-context-postpone-1hour"
                     label="&calendar.context.postpone.1hour.label;"
                     accesskey="&calendar.context.postpone.1hour.accesskey;"
-                    observes="calendar_postpone-1hour_command"/>
+                    command="calendar_postpone-1hour_command"/>
           <menuitem id="task-context-postpone-1day"
                     label="&calendar.context.postpone.1day.label;"
                     accesskey="&calendar.context.postpone.1day.accesskey;"
-                    observes="calendar_postpone-1day_command"/>
+                    command="calendar_postpone-1day_command"/>
           <menuitem id="task-context-postpone-1week"
                     label="&calendar.context.postpone.1week.label;"
                     accesskey="&calendar.context.postpone.1week.accesskey;"
-                    observes="calendar_postpone-1week_command"/>
+                    command="calendar_postpone-1week_command"/>
         </menupopup>
       </menu>
       <menu id="calendar-context-calendar-menu"
             label="&calendar.calendar.label;"
             accesskey="&calendar.calendar.accesskey;">
             <menupopup id="calendar-context-calendar-menupopup"
                        onpopupshowing="addCalendarNames(event);"/>
       </menu>
@@ -525,18 +513,17 @@
                     accesskey="&calendar.context.convertmenu.event.accesskey;"
                     oncommand="tasksToEvents(event)"/>
         </menupopup>
       </menu>
       <menuseparator/>
       <menuitem id="task-context-menu-delete"
                 label="&calendar.context.deletetask.label;"
                 accesskey="&calendar.context.deletetask.accesskey;"
-                command="calendar_delete_todo_command"
-                observes="calendar_delete_todo_command"/>
+                command="calendar_delete_todo_command"/>
       <menu id="task-context-menu-attendance-menu"
             label="&calendar.context.attendance.menu.label;"
             accesskey="&calendar.context.attendance.menu.accesskey;"
             oncommand="setContextPartstat(event.target, getSelectedTasks())"
             observes="calendar_attendance_command">
         <menupopup id="task-context-menu-attendance-menupopup">
           <label id="task-context-attendance-thisoccurrence-label"
                  class="calendar-context-heading-label"
--- a/calendar/base/content/calendar-management.js
+++ b/calendar/base/content/calendar-management.js
@@ -479,62 +479,45 @@ function calendarListSetupContextMenu(ev
   let item = document.popupNode.closest("richlistitem");
   if (item) {
     let calendarId = item.getAttribute("calendar-id");
     calendar = cal.getCalendarManager().getCalendarById(calendarId);
   }
 
   document.getElementById("list-calendars-context-menu").contextCalendar = calendar;
 
-  // Only enable calendar search if there's actually the chance of finding something:
-  let hasProviders = cal.getCalendarSearchService().getProviders({}).length < 1 && "true";
-  setElementValue("list-calendars-context-find", hasProviders, "collapsed");
-
   if (calendar) {
-    document.getElementById("list-calendars-context-edit").removeAttribute("disabled");
-    document.getElementById("list-calendars-context-publish").removeAttribute("disabled");
-
-    document.getElementById("list-calendars-context-togglevisible").removeAttribute("disabled");
-    setElementValue("list-calendars-context-togglevisible", false, "collapsed");
     let stringName = composite.getCalendarById(calendar.id) ? "hideCalendar" : "showCalendar";
     setElementValue(
       "list-calendars-context-togglevisible",
       cal.l10n.getCalString(stringName, [calendar.name]),
       "label"
     );
     let accessKey = document
       .getElementById("list-calendars-context-togglevisible")
       .getAttribute(composite.getCalendarById(calendar.id) ? "accesskeyhide" : "accesskeyshow");
     setElementValue("list-calendars-context-togglevisible", accessKey, "accesskey");
-
-    document.getElementById("list-calendars-context-showonly").removeAttribute("disabled");
-    setElementValue("list-calendars-context-showonly", false, "collapsed");
     setElementValue(
       "list-calendars-context-showonly",
       cal.l10n.getCalString("showOnlyCalendar", [calendar.name]),
       "label"
     );
-
     setupDeleteMenuitem("list-calendars-context-delete", calendar);
-    // Only enable the delete calendars item if there is more than one
-    // calendar. We don't want to have the last calendar deleted.
-    let calendars = cal.getCalendarManager().getCalendars({});
-    setElementValue("list-calendars-context-delete", calendars.length < 2 && "true", "disabled");
+    for (let elem of event.target.querySelectorAll(".needs-calendar")) {
+      elem.removeAttribute("collapsed");
+    }
   } else {
-    document.getElementById("list-calendars-context-edit").setAttribute("disabled", "true");
-    document.getElementById("list-calendars-context-publish").setAttribute("disabled", "true");
-    document.getElementById("list-calendars-context-delete").setAttribute("disabled", "true");
-    document
-      .getElementById("list-calendars-context-togglevisible")
-      .setAttribute("disabled", "true");
-    setElementValue("list-calendars-context-togglevisible", true, "collapsed");
-    document.getElementById("list-calendars-context-showonly").setAttribute("disabled", "true");
-    setElementValue("list-calendars-context-showonly", true, "collapsed");
-    setupDeleteMenuitem("list-calendars-context-delete", null);
+    for (let elem of event.target.querySelectorAll(".needs-calendar")) {
+      elem.setAttribute("collapsed", "true");
+    }
   }
+
+  // Only enable calendar search if there's actually the chance of finding something:
+  let hasProviders = cal.getCalendarSearchService().getProviders({}).length < 1 && "true";
+  setElementValue("list-calendars-context-find", hasProviders, "collapsed");
 }
 
 /**
  * Changes the "delete calendar" menuitem to have the right label based on the
  * removeModes. The menuitem must have the attributes "labelremove",
  * "labeldelete" and "labelunsubscribe".
  *
  * @param aDeleteId     The id of the menuitem to delete the calendar
@@ -550,17 +533,16 @@ function setupDeleteMenuitem(aDeleteId, 
     type = "delete";
   } else if (modes.has("unsubscribe") && !modes.has("delete")) {
     type = "unsubscribe";
   }
 
   let deleteItem = document.getElementById(aDeleteId);
   setElementValue(deleteItem, deleteItem.getAttribute("label" + type), "label");
   setElementValue(deleteItem, deleteItem.getAttribute("accesskey" + type), "accesskey");
-  setElementValue(deleteItem, modes.size == 0 && "true", "disabled");
 }
 
 /**
  * Makes sure the passed calendar is visible to the user
  *
  * @param aCalendar   The calendar to make visible.
  */
 function ensureCalendarVisible(aCalendar) {
--- a/calendar/base/content/calendar-menus.js
+++ b/calendar/base/content/calendar-menus.js
@@ -74,41 +74,36 @@
 
       this.appendChild(
         MozXULElement.parseXULToFragment(
           `
           <menuitem class="percent-0-menuitem"
                     type="checkbox"
                     label="&progress.level.0;"
                     accesskey="&progress.level.0.accesskey;"
-                    observes="calendar_percentComplete-0_command"
                     command="calendar_percentComplete-0_command"/>
           <menuitem class="percent-25-menuitem"
                     type="checkbox"
                     label="&progress.level.25;"
                     accesskey="&progress.level.25.accesskey;"
-                    observes="calendar_percentComplete-25_command"
                     command="calendar_percentComplete-25_command"/>
           <menuitem class="percent-50-menuitem"
                     type="checkbox"
                     label="&progress.level.50;"
                     accesskey="&progress.level.50.accesskey;"
-                    observes="calendar_percentComplete-50_command"
                     command="calendar_percentComplete-50_command"/>
           <menuitem class="percent-75-menuitem"
                     type="checkbox"
                     label="&progress.level.75;"
                     accesskey="&progress.level.75.accesskey;"
-                    observes="calendar_percentComplete-75_command"
                     command="calendar_percentComplete-75_command"/>
           <menuitem class="percent-100-menuitem"
                     type="checkbox"
                     label="&progress.level.100;"
                     accesskey="&progress.level.100.accesskey;"
-                    observes="calendar_percentComplete-100_command"
                     command="calendar_percentComplete-100_command"/>
           `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       this.addEventListener(
         "popupshowing",
@@ -138,36 +133,32 @@
 
       this.appendChild(
         MozXULElement.parseXULToFragment(
           `
           <menuitem class="priority-0-menuitem"
                     type="checkbox"
                     label="&priority.level.none;"
                     accesskey="&priority.level.none.accesskey;"
-                    command="calendar_priority-0_command"
-                    observes="calendar_priority-0_command"/>
+                    command="calendar_priority-0_command"/>
           <menuitem class="priority-9-menuitem"
                     type="checkbox"
                     label="&priority.level.low;"
                     accesskey="&priority.level.low.accesskey;"
-                    command="calendar_priority-9_command"
-                    observes="calendar_priority-9_command"/>
+                    command="calendar_priority-9_command"/>
           <menuitem class="priority-5-menuitem"
                     type="checkbox"
                     label="&priority.level.normal;"
                     accesskey="&priority.level.normal.accesskey;"
-                    command="calendar_priority-5_command"
-                    observes="calendar_priority-5_command"/>
+                    command="calendar_priority-5_command"/>
           <menuitem class="priority-1-menuitem"
                     type="checkbox"
                     label="&priority.level.high;"
                     accesskey="&priority.level.high.accesskey;"
-                    command="calendar_priority-1_command"
-                    observes="calendar_priority-1_command"/>
+                    command="calendar_priority-1_command"/>
           `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       this.addEventListener(
         "popupshowing",
         updateMenuItemsState.bind(null, this, "priority"),
@@ -197,41 +188,36 @@
       this.appendChild(
         MozXULElement.parseXULToFragment(
           `
           <vbox class="panel-subview-body">
             <toolbarbutton class="percent-0-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&progress.level.0;"
                            accesskey="&progress.level.0.accesskey;"
-                           observes="calendar_percentComplete-0_command"
                            command="calendar_percentComplete-0_command"/>
             <toolbarbutton class="percent-25-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&progress.level.25;"
                            accesskey="&progress.level.25.accesskey;"
-                           observes="calendar_percentComplete-25_command"
                            command="calendar_percentComplete-25_command"/>
             <toolbarbutton class="percent-50-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&progress.level.50;"
                            accesskey="&progress.level.50.accesskey;"
-                           observes="calendar_percentComplete-50_command"
                            command="calendar_percentComplete-50_command"/>
             <toolbarbutton class="percent-75-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&progress.level.75;"
                            accesskey="&progress.level.75.accesskey;"
-                           observes="calendar_percentComplete-75_command"
                            command="calendar_percentComplete-75_command"/>
             <toolbarbutton class="percent-100-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&progress.level.100;"
                            accesskey="&progress.level.100.accesskey;"
-                           observes="calendar_percentComplete-100_command"
                            command="calendar_percentComplete-100_command"/>
           </vbox>
           `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       const body = this.querySelector(".panel-subview-body");
@@ -265,36 +251,32 @@
       this.appendChild(
         MozXULElement.parseXULToFragment(
           `
           <vbox class="panel-subview-body">
             <toolbarbutton class="priority-0-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&priority.level.none;"
                            accesskey="&priority.level.none.accesskey;"
-                           command="calendar_priority-0_command"
-                           observes="calendar_priority-0_command"/>
+                           command="calendar_priority-0_command"/>
             <toolbarbutton class="priority-9-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&priority.level.low;"
                            accesskey="&priority.level.low.accesskey;"
-                           command="calendar_priority-9_command"
-                           observes="calendar_priority-9_command"/>
+                           command="calendar_priority-9_command"/>
             <toolbarbutton class="priority-5-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&priority.level.normal;"
                            accesskey="&priority.level.normal.accesskey;"
-                           command="calendar_priority-5_command"
-                           observes="calendar_priority-5_command"/>
+                           command="calendar_priority-5_command"/>
             <toolbarbutton class="priority-1-menuitem subviewbutton subviewbutton-iconic"
                            type="checkbox"
                            label="&priority.level.high;"
                            accesskey="&priority.level.high.accesskey;"
-                           command="calendar_priority-1_command"
-                           observes="calendar_priority-1_command"/>
+                           command="calendar_priority-1_command"/>
           </vbox>
           `,
           ["chrome://calendar/locale/calendar.dtd"]
         )
       );
 
       const body = this.querySelector(".panel-subview-body");
 
--- a/calendar/base/content/calendar-task-view.xul
+++ b/calendar/base/content/calendar-task-view.xul
@@ -29,17 +29,17 @@
   <vbox id="calendarDisplayDeck">
     <vbox id="calendar-task-box" flex="1"
           onselect="taskDetailsView.onSelect(event);">
       <hbox id="task-addition-box" align="center">
         <box align="center" flex="1">
           <toolbarbutton id="calendar-add-task-button"
                          label="&calendar.newtask.button.label;"
                          tooltiptext="&calendar.newtask.button.tooltip;"
-                         observes="calendar_new_todo_command"/>
+                         command="calendar_new_todo_command"/>
           <hbox align="center" flex="1" class="input-container">
             <html:input id="view-task-edit-field"
                         class="task-edit-field themeableSearchBox"
                         onfocus="taskEdit.onFocus(event)"
                         onblur="taskEdit.onBlur(event)"
                         onkeypress="taskEdit.onKeyPress(event)"/>
           </hbox>
         </box>
@@ -70,17 +70,16 @@
             <hbox id="other-actions-box">
               <vbox id="task-actions-toolbox">
                 <hbox id="task-actions-toolbar" class="toolbar">
                   <toolbarbutton id="task-actions-category"
                                  type="menu"
                                  label="&calendar.unifinder.tree.categories.label;"
                                  tooltiptext="&calendar.task.category.button.tooltip;"
                                  command="calendar_task_category_command"
-                                 observes="calendar_task_category_command"
                                  class="toolbarbutton-1 msgHeaderView-button">
                     <menupopup id="task-actions-category-popup"
                                onpopupshowing="taskDetailsView.loadCategories(event);"
                                onpopuphiding="return taskDetailsView.saveCategories(event);">
                       <html:input id="task-actions-category-textbox"
                                   placeholder="&event.categories.textbox.label;"
                                   onblur="this.parentNode.removeAttribute(&quot;ignorekeys&quot;);"
                                   onfocus="this.parentNode.setAttribute(&quot;ignorekeys&quot;, &quot;true&quot;);"
@@ -88,34 +87,32 @@
                       <menuseparator/>
                     </menupopup>
                   </toolbarbutton>
                   <toolbarbutton is="toolbarbutton-menu-button" id="task-actions-markcompleted"
                                  type="menu-button"
                                  label="&calendar.context.markcompleted.label;"
                                  tooltiptext="&calendar.task.complete.button.tooltip;"
                                  command="calendar_toggle_completed_command"
-                                 observes="calendar_toggle_completed_command"
                                  class="toolbarbutton-1 msgHeaderView-button">
                     <menupopup is="calendar-task-progress-menupopup" id="task-actions-markcompleted-menupopup"/>
                   </toolbarbutton>
                   <toolbarbutton id="task-actions-priority"
                                  type="menu"
                                  label="&calendar.context.priority.label;"
                                  tooltiptext="&calendar.task.priority.button.tooltip;"
                                  command="calendar_general-priority_command"
-                                 observes="calendar_general-priority_command"
                                  class="toolbarbutton-1 msgHeaderView-button">
                     <menupopup is="calendar-task-priority-menupopup" id="task-actions-priority-menupopup"/>
                   </toolbarbutton>
                   <toolbarbutton id="calendar-delete-task-button"
                                  class="toolbarbutton-1 msgHeaderView-button"
                                  label="&calendar.taskview.delete.label;"
                                  tooltiptext="&calendar.context.deletetask.label;"
-                                 observes="calendar_delete_todo_command"/>
+                                 command="calendar_delete_todo_command"/>
                 </hbox>
               </vbox>
             </hbox>
             <hbox id ="calendar-task-details-box">
               <html:table id="calendar-task-details-grid">
                 <html:tr id="calendar-task-details-title-row"
                          hidden="hidden">
                   <html:th class="task-details-name">
--- a/calendar/base/content/calendar-views.xul
+++ b/calendar/base/content/calendar-views.xul
@@ -63,32 +63,32 @@
       <vbox id="view-tabbox" pack="end">
         <radiogroup id="view-tabs"
                     class="calview-tabs"
                     orient="horizontal">
           <radio id="calendar-day-view-button"
                  label="&calendar.day.button.label;"
                  tooltiptext="&calendar.day.button.tooltip;"
                  class="calview"
-                 observes="calendar_day-view_command"/>
+                 command="calendar_day-view_command"/>
           <radio id="calendar-week-view-button"
                  label="&calendar.week.button.label;"
                  tooltiptext="&calendar.week.button.tooltip;"
                  class="calview"
-                 observes="calendar_week-view_command"/>
+                 command="calendar_week-view_command"/>
           <radio id="calendar-multiweek-view-button"
                  label="&calendar.multiweek.button.label;"
                  tooltiptext="&calendar.multiweek.button.tooltip;"
                  class="calview"
-                 observes="calendar_multiweek-view_command"/>
+                 command="calendar_multiweek-view_command"/>
           <radio id="calendar-month-view-button"
                  label="&calendar.month.button.label;"
                  tooltiptext="&calendar.month.button.tooltip;"
                  class="calview"
-                 observes="calendar_month-view_command"/>
+                 command="calendar_month-view_command"/>
         </radiogroup>
         <box class="navigation-bottombox"/>
       </vbox>
       <vbox>
         <vbox flex="1" class="navigation-spacer-box"/>
         <hbox class="navigation-bottombox"/>
       </vbox>
     </hbox>
--- a/calendar/base/content/dialogs/calendar-event-dialog.xul
+++ b/calendar/base/content/dialogs/calendar-event-dialog.xul
@@ -411,18 +411,17 @@
                         command="cmd_customize"/>
             </menupopup>
           </menu>
           <menuseparator id="view-menu-toolbars-separator"/>
           <menuitem id="view-show-link-menuitem"
                     label="&event.menu.view.showlink.label;"
                     accesskey="&event.menu.view.showlink.accesskey;"
                     type="checkbox"
-                    command="cmd_toggle_link"
-                    observes="cmd_toggle_link"/>
+                    command="cmd_toggle_link"/>
         </menupopup>
       </menu>
 
       <!-- Options menu -->
       <menu id="options-menu"
             label="&event.menu.options.label;"
             accesskey="&event.menu.options.accesskey;">
         <menupopup id="options-menupopup">
--- a/calendar/base/content/today-pane.xul
+++ b/calendar/base/content/today-pane.xul
@@ -165,17 +165,17 @@
                        onkeypress="agendaListbox.onKeyPress(event);"
                        ondblclick="agendaListbox.createNewEvent(event);"
                        ondragstart="nsDragAndDrop.startDrag(event, calendarCalendarButtonDNDObserver);"
                        ondragover="nsDragAndDrop.dragOver(event, calendarCalendarButtonDNDObserver);"
                        ondrop="nsDragAndDrop.drop(event, calendarCalendarButtonDNDObserver);">
             <menupopup id="agenda-menupopup" onpopupshowing="return agendaListbox.setupContextMenu(event.target)">
               <menuitem label="&calendar.context.modifyorviewitem.label;"
                        accesskey="&calendar.context.modifyorviewitem.accesskey;"
-                       observes="agenda_edit_event_command"/>
+                       command="agenda_edit_event_command"/>
               <menu id="agenda-context-menu-convert-menu"
                    label="&calendar.context.convertmenu.label;"
                    accesskey="&calendar.context.convertmenu.accesskey.calendar;">
                 <menupopup id="agenda-context-menu-convert-menupopup">
                   <menuitem id="agenda-context-menu-convert-message-menuitem"
                             label="&calendar.context.convertmenu.message.label;"
                             accesskey="&calendar.context.convertmenu.message.accesskey;"
                             oncommand="calendarMailButtonDNDObserver.onDropItems(agendaListbox.getSelectedItems())"/>
@@ -185,17 +185,17 @@
                             accesskey="&calendar.context.convertmenu.task.accesskey;"
                             oncommand="calendarTaskButtonDNDObserver.onDropItems(agendaListbox.getSelectedItems())"/>
                 </menupopup>
               </menu>
               <menuseparator id="calendar-today-pane-menuseparator-before-delete"/>
               <menuitem label="&calendar.context.deleteevent.label;"
                        accesskey="&calendar.context.deleteevent.accesskey;"
                        key="calendar-delete-item-key"
-                       observes="agenda_delete_event_command"/>
+                       command="agenda_delete_event_command"/>
               <menu id="calendar-today-pane-menu-attendance-menu"
                     label="&calendar.context.attendance.menu.label;"
                     accesskey="&calendar.context.attendance.menu.accesskey;"
                     oncommand="setContextPartstat(event.target, agendaListbox.getSelectedItems({}))"
                     observes="calendar_attendance_command">
                 <menupopup id="agenda-context-menu-attendance-menupopup">
                   <label id="agenda-context-attendance-thisoccurrence-label"
                          class="calendar-context-heading-label"
--- a/calendar/lightning/content/lightning-menus.xul
+++ b/calendar/lightning/content/lightning-menus.xul
@@ -29,59 +29,53 @@
                   oncommand="openLocalCalendar();"/>
       </menupopup>
     </menu>
     <menuitem id="ltnSave"
               insertbefore="menu_saveAs"
               label="&event.menu.item.save.label;"
               accesskey="&event.menu.item.save.tab.accesskey;"
               key="save-key"
-              command="cmd_save"
-              observes="cmd_save"/>
+              command="cmd_save"/>
     <menuitem id="ltnSaveAndClose"
               insertafter="ltnSave"
               label="&event.menu.item.saveandclose.label;"
               accesskey="&event.menu.item.saveandclose.tab.accesskey;"
-              command="cmd_accept"
-              observes="cmd_accept"/>
+              command="cmd_accept"/>
   </menupopup>
   <menuitem id="openMessageFileMenuitem" hidden="true"/>
 
   <menupopup id="menu_NewPopup">
     <menuitem id="ltnNewEvent"
               label="&lightning.menupopup.new.event.label;"
               insertbefore="menu_newFolder"
               accesskey="&lightning.menupopup.new.event.accesskey;"
               key="calendar-new-event-key"
-              command="calendar_new_event_command"
-              observes="calendar_new_event_command"/>
+              command="calendar_new_event_command"/>
     <menuitem id="ltnNewTask"
               label="&lightning.menupopup.new.task.label;"
               insertbefore="menu_newFolder"
               accesskey="&lightning.menupopup.new.task.accesskey;"
               key="calendar-new-todo-key"
-              command="calendar_new_todo_command"
-              observes="calendar_new_todo_command"/>
+              command="calendar_new_todo_command"/>
     <menuseparator id="afterltnNewTask"
                    insertbefore="menu_newFolder"
                    observes="menu_newFolder"/>
     <menuitem id="ltnNewCalendar" label="&lightning.menupopup.new.calendar.label;"
                command="calendar_new_calendar_command"
-               observes="calendar_new_calendar_command"
                accesskey="&lightning.menupopup.new.calendar.accesskey;"
                insertafter="newAccountMenuItem"/>
   </menupopup>
 
   <menupopup id="menu_EditPopup">
     <menuitem id="ltnCalendarProperties"
               insertafter="menu_properties"
               label="&calendar.properties.label;"
               accesskey="&calendar.properties.accesskey;"
-              command="calendar_edit_calendar_command"
-              observes="calendar_edit_calendar_command"/>
+              command="calendar_edit_calendar_command"/>
   </menupopup>
 
   <menupopup id="menu_View_Popup">
     <menu id="menu_Toolbars"
           onpopupshowing="onToolbarsPopupShowingForTabType(event);"/>
     <menuseparator id="ltnViewMenuSeparator"
                    insertbefore="viewSortMenuSeparator"/>
     <menu id="ltnTodayPaneMenu"
@@ -182,33 +176,32 @@
               observes="calendar_mode_calendar"
               label="&showCurrentView.label;"
               accesskey="&showCurrentView.accesskey;">
           <menupopup id="ltnCalendarCurrentViewMenuPopup">
             <menuitem type="checkbox"
                       id="ltnWorkdaysOnlyMenuitem"
                       label="&calendar.onlyworkday.checkbox.label;"
                       accesskey="&calendar.onlyworkday.checkbox.accesskey;"
-                      observes="calendar_toggle_workdays_only_command"/>
+                      command="calendar_toggle_workdays_only_command"/>
             <menuitem type="checkbox"
                       id="ltnTasksInViewMenuitem"
                       label="&calendar.displaytodos.checkbox.label;"
                       accesskey="&calendar.displaytodos.checkbox.accesskey;"
-                      observes="calendar_toggle_tasks_in_view_command"/>
+                      command="calendar_toggle_tasks_in_view_command"/>
             <menuitem type="checkbox"
                       id="ltnShowCompletedInViewMenuItem"
                       label="&calendar.completedtasks.checkbox.label;"
                       accesskey="&calendar.completedtasks.checkbox.accesskey;"
-                      observes="calendar_toggle_show_completed_in_view_command"/>
+                      command="calendar_toggle_show_completed_in_view_command"/>
             <menuitem type="checkbox"
                       id="ltnViewRotated"
                       label="&calendar.orientation.label;"
                       accesskey="&calendar.orientation.accesskey;"
-                      command="calendar_toggle_orientation_command"
-                      observes="calendar_toggle_orientation_command"/>
+                      command="calendar_toggle_orientation_command"/>
           </menupopup>
         </menu>
       </menupopup>
     </menu>
     <menu id="ltnTasksMenu"
           observes="calendar_mode_task"
           insertbefore="viewSortMenuSeparator"
           label="&lightning.menu.view.tasks.label;"
@@ -280,17 +273,17 @@
     </menu>
   </menupopup>
 
   <menupopup id="menu_GoPopup">
     <menuitem id="ltnGoToToday"
               insertafter="goNextSeparator"
               label="&goTodayCmd.label;"
               accesskey="&goTodayCmd.accesskey;"
-              observes="calendar_go_to_today_command"
+              command="calendar_go_to_today_command"
               key="calendar-go-to-today-key"/>
   </menupopup>
 
   <menupopup id="menu_GoNextPopup">
     <menuseparator id="ltnGoNextSeparator"/>
     <!-- Label is set up automatically using the view id. When writing a
          view extension, overlay this menuitem and add a label-<myviewtype>
          attribute with the correct label -->
@@ -299,17 +292,17 @@
               label-day="&lightning.toolbar.day.label;"
               label-week="&lightning.toolbar.week.label;"
               label-multiweek="&lightning.toolbar.week.label;"
               label-month="&lightning.toolbar.month.label;"
               accesskey-day="&lightning.toolbar.day.accesskey;"
               accesskey-week="&lightning.toolbar.week.accesskey;"
               accesskey-multiweek="&lightning.toolbar.week.accesskey;"
               accesskey-month="&lightning.toolbar.month.accesskey;"
-              observes="calendar_view_next_command"/>
+              command="calendar_view_next_command"/>
   </menupopup>
 
   <menupopup id="menu_GoPreviousPopup">
     <menuseparator id="ltnGoPreviousSeparator"/>
     <!-- Label is set up automatically using the view id. When writing a
          view extension, overlay this menuitem and add a label-<myviewtype>
          attribute with the correct label -->
     <menuitem id="calendar-go-menu-previous"
@@ -317,37 +310,35 @@
               label-day="&lightning.toolbar.day.label;"
               label-week="&lightning.toolbar.week.label;"
               label-multiweek="&lightning.toolbar.week.label;"
               label-month="&lightning.toolbar.month.label;"
               accesskey-day="&lightning.toolbar.day.accesskey;"
               accesskey-week="&lightning.toolbar.week.accesskey;"
               accesskey-multiweek="&lightning.toolbar.week.accesskey;"
               accesskey-month="&lightning.toolbar.month.accesskey;"
-              observes="calendar_view_prev_command"/>
+              command="calendar_view_prev_command"/>
   </menupopup>
 
   <menubar id="mail-menubar">
     <menu id="menu_Event_Task"
           label="&lightning.menu.eventtask.label;"
           accesskey="&lightning.menu.eventtask.accesskey;"
           insertafter="messageMenu">
       <menupopup id="menu_Event_Task_Popup" onpopupshowing="changeMenuForTask(event); setupDeleteMenuitem('ltnDeleteSelectedCalendar')">
         <menuitem id="ltnNewEvent2"
                   label="&event.new.event;"
                   accesskey="&event.new.event.accesskey;"
                   key="calendar-new-event-key"
-                  command="calendar_new_event_command"
-                  observes="calendar_new_event_command"/>
+                  command="calendar_new_event_command"/>
         <menuitem id="ltnNewTask2"
                   label="&event.new.task;"
                   accesskey="&event.new.task.accesskey;"
                   key="calendar-new-todo-key"
-                  command="calendar_new_todo_command"
-                  observes="calendar_new_todo_command"/>
+                  command="calendar_new_todo_command"/>
         <menuseparator id="before-Calendar-Mode-Section"/>
         <menuitem id="ltnMenuSwitchToCalendar"
                   type="checkbox"
                   label="&lightning.toolbar.calendar.label;"
                   accesskey="&lightning.toolbar.calendar.accesskey;"
                   command="switch2calendar"
                   value="calendar"
                   key="openLightningKey"
@@ -361,84 +352,76 @@
                   value="task"
                   key="openTasksKey"
                   autocheck="false">
         </menuitem>
         <menuseparator id="ltnBeforeCalendarSection"/>
         <menuitem id="ltnExportCalendar"
                   label="&calendar.export.label;"
                   accesskey="&calendar.export.accesskey;"
-                  command="calendar_export_command"
-                  observes="calendar_export_command"/>
+                  command="calendar_export_command"/>
         <menuitem id="ltnImportCalendar"
                   label="&calendar.import.label;"
                   accesskey="&calendar.import.accesskey;"
-                  command="calendar_import_command"
-                  observes="calendar_import_command"/>
+                  command="calendar_import_command"/>
         <menuitem id="ltnPublishCalendar"
                   label="&calendar.publish.label;"
                   accesskey="&calendar.publish.accesskey;"
-                  command="calendar_publish_calendar_command"
-                  observes="calendar_publish_calendar_command"/>
+                  command="calendar_publish_calendar_command"/>
         <menuitem id="ltnDeleteSelectedCalendar"
                   labeldelete="&calendar.deletecalendar.label;"
                   labelremove="&calendar.removecalendar.label;"
                   labelunsubscribe="&calendar.unsubscribecalendar.label;"
                   accesskeydelete="&calendar.deletecalendar.accesskey;"
                   accesskeyremove="&calendar.removecalendar.accesskey;"
                   accesskeyunsubscribe="&calendar.unsubscribecalendar.accesskey;"
-                  command="calendar_delete_calendar_command"
-                  observes="calendar_delete_calendar_command"/>
+                  command="calendar_delete_calendar_command"/>
         <menuseparator id="ltnBeforeTaskActions"/>
         <menuitem id="ltnTaskActionsMarkCompletedMenuitem"
                   type="checkbox"
                   label="&calendar.context.markcompleted.label;"
                   accesskey="&calendar.context.markcompleted.accesskey;"
-                  command="calendar_toggle_completed_command"
-                  observes="calendar_toggle_completed_command"/>
+                  command="calendar_toggle_completed_command"/>
         <menu id="ltnTaskActionsPriorityMenuitem"
               label="&calendar.context.priority.label;"
               accesskey="&calendar.context.priority.accesskey;"
-              command="calendar_general-priority_command"
-              observes="calendar_general-priority_command">
+              command="calendar_general-priority_command">
           <menupopup is="calendar-task-priority-menupopup"/>
         </menu>
         <menu id="ltnTaskActionsProgressMenuitem"
               label="&calendar.context.progress.label;"
               accesskey="&calendar.context.progress.accesskey;"
-              command="calendar_general-progress_command"
-              observes="calendar_general-progress_command">
+              command="calendar_general-progress_command">
           <menupopup is="calendar-task-progress-menupopup"/>
         </menu>
         <menu id="ltnTaskActionsPostponeMenuitem"
               label="&calendar.context.postpone.label;"
               accesskey="&calendar.context.postpone.accesskey;"
-              observes="calendar_general-postpone_command">
+              command="calendar_general-postpone_command">
           <menupopup id="ltnTaskActionsPostponeMenuPopup">
             <menuitem id="ltnTaskActionsPostponeMenu-1hour"
                       label="&calendar.context.postpone.1hour.label;"
                       accesskey="&calendar.context.postpone.1hour.accesskey;"
-                      observes="calendar_postpone-1hour_command"/>
+                      command="calendar_postpone-1hour_command"/>
             <menuitem id="ltnTaskActionsPostponeMenu-1day"
                       label="&calendar.context.postpone.1day.label;"
                       accesskey="&calendar.context.postpone.1day.accesskey;"
-                      observes="calendar_postpone-1day_command"/>
+                      command="calendar_postpone-1day_command"/>
             <menuitem id="ltnTaskActionsPostponeMenu-1week"
                       label="&calendar.context.postpone.1week.label;"
                       accesskey="&calendar.context.postpone.1week.accesskey;"
-                      observes="calendar_postpone-1week_command"/>
+                      command="calendar_postpone-1week_command"/>
           </menupopup>
         </menu>
         <menuseparator id="ltnBeforeUnifinderSection" />
         <menuitem id="ltnShowUnifinder"
                   type="checkbox"
                   checked="true"
                   label="&showUnifinderCmd.label;"
                   accesskey="&showUnifinderCmd.accesskey;"
-                  observes="calendar_show_unifinder_command"
                   command="calendar_show_unifinder_command"/>
       </menupopup>
     </menu>
   </menubar>
 
   <menupopup id="mailContext">
     <menu id="mailContext-calendar-convert-menu"
           insertafter="mailContext-moveToFolderAgain"
@@ -492,32 +475,29 @@
   </vbox>
 
   <!-- New -->
   <vbox id="appMenu-newViewItems">
     <toolbarbutton id="appmenu_ltnNewEvent"
                    class="subviewbutton subviewbutton-iconic"
                    label="&lightning.menupopup.new.event.label;"
                    insertbefore="appmenu_newFolder"
-                   command="calendar_new_event_command"
-                   observes="calendar_new_event_command"/>
+                   command="calendar_new_event_command"/>
     <toolbarbutton id="appmenu_ltnNewTask"
                    class="subviewbutton subviewbutton-iconic"
                    label="&lightning.menupopup.new.task.label;"
                    insertbefore="appmenu_newFolder"
-                   command="calendar_new_todo_command"
-                   observes="calendar_new_todo_command"/>
+                   command="calendar_new_todo_command"/>
     <toolbarseparator id="appmenu_afterltnNewTask"
                       insertbefore="appmenu_newFolder"
                       observes="appmenu_newFolder"/>
     <toolbarbutton id="appmenu_ltnNewCalendar"
                    class="subviewbutton subviewbutton-iconic"
                    label="&lightning.menupopup.new.calendar.label;"
                    command="calendar_new_calendar_command"
-                   observes="calendar_new_calendar_command"
                    insertafter="appmenu_newAccountMenuItem"/>
   </vbox>
 
   <!-- File -->
   <vbox id="appMenu-fileViewItems">
     <toolbarbutton id="appmenu_Open"
                    class="subviewbutton subviewbutton-nav"
                    mode="calendar"
@@ -555,49 +535,49 @@
   </vbox>
 
   <!-- Go -->
   <vbox id="appMenu-goViewItems">
     <toolbarbutton id="appmenu_ltnGoToToday"
                    class="subviewbutton subviewbutton-iconic"
                    insertafter="appmenu_goNextSeparator"
                    label="&goTodayCmd.label;"
-                   observes="calendar_go_to_today_command"/>
+                   command="calendar_go_to_today_command"/>
   </vbox>
 
   <!-- Go / Next -->
   <vbox id="appMenu-goNextViewItems">
     <toolbarseparator id="appmenu_ltnGoNextSeparator"/>
     <!-- Label is set up automatically using the view id. When writing a
          view extension, overlay this toolbarbutton and add a label-<myviewtype>
          attribute with the correct label -->
     <toolbarbutton id="appmenu_calendar-go-menu-next"
                    class="subviewbutton subviewbutton-iconic"
                    label=""
                    label-day="&lightning.toolbar.day.label;"
                    label-week="&lightning.toolbar.week.label;"
                    label-multiweek="&lightning.toolbar.week.label;"
                    label-month="&lightning.toolbar.month.label;"
-                   observes="calendar_view_next_command"/>
+                   command="calendar_view_next_command"/>
   </vbox>
 
   <!-- Go / Previous -->
   <vbox id="appMenu-goPreviousViewItems">
     <toolbarseparator id="appmenu_ltnGoPreviousSeparator"/>
     <!-- Label is set up automatically using the view id. When writing a
          view extension, overlay this menuitem and add a label-<myviewtype>
          attribute with the correct label -->
     <toolbarbutton id="appmenu_calendar-go-menu-previous"
                    class="subviewbutton subviewbutton-iconic"
                    label=""
                    label-day="&lightning.toolbar.day.label;"
                    label-week="&lightning.toolbar.week.label;"
                    label-multiweek="&lightning.toolbar.week.label;"
                    label-month="&lightning.toolbar.month.label;"
-                   observes="calendar_view_prev_command"/>
+                   command="calendar_view_prev_command"/>
   </vbox>
 
   <!-- Calendar submenus added to the appmenu -->
   <panelmultiview id="appMenu-multiView">
 
     <!-- Events and Tasks -->
     <panelview id="appmenu_Event_Task_View"
                class="PanelUI-subView">
@@ -617,45 +597,40 @@
                        command="switch2task"
                        value="task"
                        autocheck="false">
         </toolbarbutton>
         <toolbarseparator id="appmenu_ltnBeforeCalendarSection"/>
         <toolbarbutton id="appmenu_ltnExportCalendar"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.export.label;"
-                       command="calendar_export_command"
-                       observes="calendar_export_command"/>
+                       command="calendar_export_command"/>
         <toolbarbutton id="appmenu_ltnImportCalendar"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.import.label;"
-                       command="calendar_import_command"
-                       observes="calendar_import_command"/>
+                       command="calendar_import_command"/>
         <toolbarbutton id="appmenu_ltnPublishCalendar"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.publish.label;"
-                       command="calendar_publish_calendar_command"
-                       observes="calendar_publish_calendar_command"/>
+                       command="calendar_publish_calendar_command"/>
         <toolbarbutton id="appmenu_ltnDeleteSelectedCalendar"
                        class="subviewbutton subviewbutton-iconic"
                        labeldelete="&calendar.deletecalendar.label;"
                        labelremove="&calendar.removecalendar.label;"
                        labelunsubscribe="&calendar.unsubscribecalendar.label;"
                        accesskeydelete="&calendar.deletecalendar.accesskey;"
                        accesskeyremove="&calendar.removecalendar.accesskey;"
                        accesskeyunsubscribe="&calendar.unsubscribecalendar.accesskey;"
-                       command="calendar_delete_calendar_command"
-                       observes="calendar_delete_calendar_command"/>
+                       command="calendar_delete_calendar_command"/>
         <toolbarseparator id="ltnBeforeTaskActions"/>
         <toolbarbutton id="appmenu_ltnTaskActionsMarkCompletedMenuitem"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        label="&calendar.context.markcompleted.label;"
-                       command="calendar_toggle_completed_command"
-                       observes="calendar_toggle_completed_command"/>
+                       command="calendar_toggle_completed_command"/>
         <toolbarbutton id="appmenu_ltnTaskActionsPriorityMenuitem"
                        class="subviewbutton subviewbutton-nav"
                        label="&calendar.context.priority.label;"
                        closemenu="none"
                        oncommand="PanelUI.showSubView('appmenu_ltnTaskPriorityView', this)"/>
         <toolbarbutton id="appmenu_ltnTaskActionsProgressMenuitem"
                        class="subviewbutton subviewbutton-nav"
                        label="&calendar.context.progress.label;"
@@ -668,25 +643,23 @@
                        closemenu="none"
                        oncommand="PanelUI.showSubView('appmenu_ltnTaskActionsPostponeView', this)"/>
         <toolbarseparator id="appmenu_ltnBeforeUnifinderSection" />
         <toolbarbutton id="appmenu_ltnShowUnifinder"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        checked="true"
                        label="&showUnifinderCmd.label;"
-                       observes="calendar_show_unifinder_command"
                        command="calendar_show_unifinder_command"/>
         <toolbarseparator id="appmenu_ltnBeforeCalendarProperties" />
         <toolbarbutton id="appmenu_ltnCalendarProperties"
                        class="subviewbutton subviewbutton-iconic"
                        insertafter="menu_properties"
                        label="&calendar.properties.label;"
-                       command="calendar_edit_calendar_command"
-                       observes="calendar_edit_calendar_command"/>
+                       command="calendar_edit_calendar_command"/>
       </vbox>
     </panelview>
 
     <!-- Events and Tasks / Priority -->
     <panelview is="calendar-task-priority-panelview" id="appmenu_ltnTaskPriorityView"
                class="PanelUI-subView"/>
 
     <!-- Events and Tasks / Progress -->
@@ -695,25 +668,25 @@
 
     <!-- Events and Tasks / Postpone Task -->
     <panelview id="appmenu_ltnTaskActionsPostponeView"
                class="PanelUI-subView">
       <vbox class="panel-subview-body">
         <toolbarbutton id="ltnTaskActionsPostponeMenu-1hour"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.context.postpone.1hour.label;"
-                       observes="calendar_postpone-1hour_command"/>
+                       command="calendar_postpone-1hour_command"/>
         <toolbarbutton id="appmenu_ltnTaskActionsPostponeMenu-1day"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.context.postpone.1day.label;"
-                       observes="calendar_postpone-1day_command"/>
+                       command="calendar_postpone-1day_command"/>
         <toolbarbutton id="appmenu_ltnTaskActionsPostponeMenu-1week"
                        class="subviewbutton subviewbutton-iconic"
                        label="&calendar.context.postpone.1week.label;"
-                       observes="calendar_postpone-1week_command"/>
+                       command="calendar_postpone-1week_command"/>
       </vbox>
     </panelview>
 
     <!-- File / Open -->
     <panelview id="appMenu-fileOpenView"
                class="PanelUI-subView">
       <vbox class="panel-subview-body">
         <toolbarbutton id="appmenu_OpenMessageFileMenuitem"
@@ -836,33 +809,32 @@
     <!-- View / Calendar / Current View -->
     <panelview id="appmenu_ltnCalendarCurrentViewView"
                class="PanelUI-subView">
       <vbox class="panel-subview-body">
         <toolbarbutton id="appmenu_ltnWorkdaysOnlyMenuitem"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        label="&calendar.onlyworkday.checkbox.label;"
-                       observes="calendar_toggle_workdays_only_command"/>
+                       command="calendar_toggle_workdays_only_command"/>
         <toolbarbutton id="appmenu_ltnTasksInViewMenuitem"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        label="&calendar.displaytodos.checkbox.label;"
-                       observes="calendar_toggle_tasks_in_view_command"/>
+                       command="calendar_toggle_tasks_in_view_command"/>
         <toolbarbutton id="appmenu_ltnShowCompletedInViewMenuItem"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        label="&calendar.completedtasks.checkbox.label;"
-                       observes="calendar_toggle_show_completed_in_view_command"/>
+                       command="calendar_toggle_show_completed_in_view_command"/>
         <toolbarbutton id="appmenu_ltnViewRotated"
                        class="subviewbutton subviewbutton-iconic"
                        type="checkbox"
                        label="&calendar.orientation.label;"
-                       command="calendar_toggle_orientation_command"
-                       observes="calendar_toggle_orientation_command"/>
+                       command="calendar_toggle_orientation_command"/>
       </vbox>
     </panelview>
 
     <!-- View / Tasks -->
     <panelview id="appmenu_ltnTasksView"
                class="PanelUI-subView">
       <vbox class="panel-subview-body">
         <toolbarbutton id="appmenu_ltnTasksViewFilterTasks"
--- a/calendar/lightning/content/lightning-toolbar.xul
+++ b/calendar/lightning/content/lightning-toolbar.xul
@@ -76,52 +76,52 @@
            defaulticonsize="small"
            labelalign="end"
            defaultlabelalign="end">
     <toolbarpalette id="CalendarToolbarPalette">
       <toolbarbutton id="calendar-synchronize-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.sync.label;"
                      tooltiptext="&lightning.toolbar.sync.tooltip;"
-                     observes="calendar_reload_remote_calendars"/>
+                     command="calendar_reload_remote_calendars"/>
       <toolbarbutton id="calendar-newevent-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.newevent.label;"
                      tooltiptext="&lightning.toolbar.newevent.tooltip;"
-                     observes="calendar_new_event_command"/>
+                     command="calendar_new_event_command"/>
       <toolbarbutton id="calendar-newtask-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.newtask.label;"
                      tooltiptext="&lightning.toolbar.newtask.tooltip;"
-                     observes="calendar_new_todo_command"/>
+                     command="calendar_new_todo_command"/>
       <toolbarbutton id="calendar-goto-today-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.gototoday.label;"
                      tooltiptext="&lightning.toolbar.gototoday.tooltip;"
-                     observes="calendar_go_to_today_command"/>
+                     command="calendar_go_to_today_command"/>
       <toolbarbutton id="calendar-edit-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.edit.label;"
                      tooltiptext="&lightning.toolbar.edit.tooltip;"
-                     observes="calendar_modify_focused_item_command"/>
+                     command="calendar_modify_focused_item_command"/>
       <toolbarbutton id="calendar-delete-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.delete.label;"
                      tooltiptext="&lightning.toolbar.delete.tooltip;"
-                     observes="calendar_delete_focused_item_command"/>
+                     command="calendar_delete_focused_item_command"/>
       <toolbarbutton id="calendar-print-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.print.label;"
                      tooltiptext="&lightning.toolbar.print.tooltip;"
-                     observes="cmd_print"/>
+                     command="cmd_print"/>
       <toolbarbutton id="calendar-unifinder-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&showUnifinderCmd.label;"
                      tooltiptext="&showUnifinderCmd.tooltip;"
-                     observes="calendar_show_unifinder_command"/>
+                     command="calendar_show_unifinder_command"/>
       <toolbarbutton id="calendar-appmenu-button"
                      type="menu"
                      class="toolbarbutton-1 button-appmenu"
                      label="&lightning.toolbar.appmenuButton.label;"
                      tooltiptext="&lightning.toolbar.appmenuButton1.tooltip;"/>
     </toolbarpalette>
 
     <toolbar is="customizable-toolbar" id="calendar-toolbar2"
@@ -143,42 +143,42 @@
            defaulticonsize="small"
            labelalign="end"
            defaultlabelalign="end">
     <toolbarpalette id="TaskToolbarPalette">
       <toolbarbutton id="task-synchronize-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.sync.label;"
                      tooltiptext="&lightning.toolbar.sync.tooltip;"
-                     observes="calendar_reload_remote_calendars"/>
+                     command="calendar_reload_remote_calendars"/>
       <toolbarbutton id="task-newevent-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.newevent.label;"
                      tooltiptext="&lightning.toolbar.newevent.tooltip;"
-                     observes="calendar_new_event_command"/>
+                     command="calendar_new_event_command"/>
       <toolbarbutton id="task-newtask-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.newtask.label;"
                      tooltiptext="&lightning.toolbar.newtask.tooltip;"
-                     observes="calendar_new_todo_command"/>
+                     command="calendar_new_todo_command"/>
       <toolbarbutton id="task-edit-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.edit.label;"
                      tooltiptext="&lightning.toolbar.edit.tooltip;"
-                     observes="calendar_modify_focused_item_command"/>
+                     command="calendar_modify_focused_item_command"/>
       <toolbarbutton id="task-delete-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.delete.label;"
                      tooltiptext="&lightning.toolbar.delete.tooltip;"
-                     observes="calendar_delete_focused_item_command"/>
+                     command="calendar_delete_focused_item_command"/>
       <toolbarbutton id="task-print-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.print.label;"
                      tooltiptext="&lightning.toolbar.print.tooltip;"
-                     observes="cmd_print"/>
+                     command="cmd_print"/>
       <toolbarbutton id="task-appmenu-button"
                      type="menu"
                      class="toolbarbutton-1 button-appmenu"
                      label="&lightning.toolbar.appmenuButton.label;"
                      tooltiptext="&lightning.toolbar.appmenuButton1.tooltip;"/>
     </toolbarpalette>
 
     <toolbar is="customizable-toolbar" id="task-toolbar2"
--- a/calendar/lightning/content/messenger-overlay-sidebar.xul
+++ b/calendar/lightning/content/messenger-overlay-sidebar.xul
@@ -77,17 +77,19 @@
   <script src="chrome://calendar/content/calendar-invitations-manager.js"/>
 
   <!-- NEEDED FOR EVENT/TASK IN A TAB -->
   <script src="chrome://lightning/content/lightning-item-panel.js"/>
 
   <window id="messengerWindow">
     <!-- Be sure to keep these sets, since they will be overlaid by
          calendar/base/content/calendar-common-sets.xul -->
-    <commandset id="calendar_commands">
+    <commandset id="calendar_commands" commandupdater="true"
+              events="calendar_commands"
+              oncommandupdate="calendarController.updateCommands()">
       <command id="agenda_delete_event_command" oncommand="agendaListbox.deleteSelectedItem(false);"/>
       <command id="agenda_edit_event_command" oncommand="agendaListbox.editSelectedItem(event);"/>
       <command id="switch2calendar"
                oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
       <command id="switch2task"
                oncommand="document.getElementById('tabmail').openTab('tasks', { title: document.getElementById('task-tab-button').getAttribute('title') })"/>
       <command id="new_calendar_tab"
                oncommand="document.getElementById('tabmail').openTab('calendar', { title: document.getElementById('calendar-tab-button').getAttribute('title') })"/>
@@ -105,76 +107,84 @@
       <command id="cmd_CustomizeMailToolbar"
                oncommand="customizeMailToolbarForTabType()"/>
     </commandset>
 
     <keyset id="calendar-keys">
       <key id="openLightningKey"
            key="&lightning.keys.event.showCalendar.key;"
            modifiers="accel, shift"
-           observes="new_calendar_tab"/>
+           command="new_calendar_tab"/>
       <key id="openTasksKey"
            key="&lightning.keys.event.showTasks.key;"
            modifiers="accel, shift"
            command="new_task_tab"/>
       <key id="todaypanekey" command="calendar_toggle_todaypane_command" keycode="VK_F11"/>
       <key id="calendar-new-event-key" key="&lightning.keys.event.new;" modifiers="accel" command="calendar_new_event_command"/>
       <key id="calendar-new-todo-key" key="&lightning.keys.todo.new;" modifiers="accel" command="calendar_new_todo_command"/>
     </keyset>
 
     <popupset id="calendar-popupset">
       <menupopup id="list-calendars-context-menu"
                  onpopupshowing="return calendarListSetupContextMenu(event);">
         <menuitem id="list-calendars-context-togglevisible"
+                  class="needs-calendar"
                   accesskeyshow="&calendar.context.showcalendar.accesskey;"
                   accesskeyhide="&calendar.context.hidecalendar.accesskey;"
                   oncommand="toggleCalendarVisible(document.getElementById('list-calendars-context-menu').contextCalendar);"/>
         <menuitem id="list-calendars-context-showonly"
+                  class="needs-calendar"
                   accesskey="&calendar.context.showonly.accesskey;"
                   oncommand="showOnlyCalendar(document.getElementById('list-calendars-context-menu').contextCalendar);"/>
         <menuitem id="list-calendars-context-showall"
                   label="&calendar.context.showall.label;"
                   accesskey="&calendar.context.showall.accesskey;"
                   oncommand="showAllCalendars();"/>
         <menuseparator id="list-calendars-context-showops-menuseparator"/>
         <menuitem id="list-calendars-context-new"
                   label="&calendar.context.newserver.label;"
                   accesskey="&calendar.context.newserver.accesskey;"
-                  observes="calendar_new_calendar_command"/>
+                  command="calendar_new_calendar_command"/>
         <menuitem id="list-calendars-context-find"
                   label="&calendar.context.findcalendar.label;"
                   accesskey="&calendar.context.findcalendar.accesskey;"
                   oncommand="openCalendarSubscriptionsDialog();"/>
         <menuitem id="list-calendars-context-delete"
+                  class="needs-calendar"
                   labeldelete="&calendar.context.deleteserver2.label;"
                   labelremove="&calendar.context.removeserver.label;"
                   labelunsubscribe="&calendar.context.unsubscribeserver.label;"
                   accesskeydelete="&calendar.context.deleteserver2.accesskey;"
                   accesskeyremove="&calendar.context.removeserver.accesskey;"
                   accesskeyunsubscribe="&calendar.context.unsubscribeserver.accesskey;"
-                  observes="calendar_delete_calendar_command"/>
+                  command="calendar_delete_calendar_command"/>
         <menuseparator id="list-calendars-context-itemops-menuseparator"/>
         <menuitem id="list-calendars-context-export"
+                  class="needs-calendar"
                   label="&calendar.context.export.label;"
                   accesskey="&calendar.context.export.accesskey;"
                   oncommand="exportEntireCalendar(document.getElementById('list-calendars-context-menu').contextCalendar);"/>
         <menuitem id="list-calendars-context-publish"
+                  class="needs-calendar"
                   label="&calendar.context.publish.label;"
                   accesskey="&calendar.context.publish.accesskey;"
-                  observes="calendar_publish_selected_calendar_command"/>
-        <menuseparator id="list-calendars-context-export-menuseparator"/>
+                  command="calendar_publish_selected_calendar_command"/>
+        <menuseparator id="list-calendars-context-export-menuseparator"
+                  class="needs-calendar"/>
         <menuitem id="list-calendars-context-reload"
                   label="&calendar.context.synccalendars.label;"
                   accesskey="&calendar.context.synccalendars.accesskey;"
-                  observes="calendar_reload_remote_calendars"/>
-        <menuseparator id="list-calendars-context-reload-menuseparator"/>
+                  command="calendar_reload_remote_calendars"/>
+        <menuseparator id="list-calendars-context-reload-menuseparator"
+                       class="needs-calendar"/>
         <menuitem id="list-calendars-context-edit"
+                  class="needs-calendar"
                   label="&calendar.context.properties.label;"
                   accesskey="&calendar.context.properties.accesskey;"
-                  observes="calendar_edit_calendar_command"/>
+                  command="calendar_edit_calendar_command"/>
       </menupopup>
       <tooltip id="calendar-list-tooltip"
                onpopupshowing="return calendarListTooltipShowing(event)"/>
     </popupset>
   </window>
 
   <toolbar id="tabbar-toolbar">
     <toolbarbutton id="calendar-tab-button"
@@ -358,17 +368,16 @@
                       class="statusbarpanel"
                       mode="mail,calendar,task,chat"
                       collapsedinmodes="special"
                       pack="center">
       <toolbarbutton id="calendar-status-todaypane-button"
                      type="checkbox"
                      label="&todaypane.statusButton.label;"
                      tooltiptext="&calendar.todaypane.button.tooltip;"
-                     observes="calendar_toggle_todaypane_command"
                      command="calendar_toggle_todaypane_command"/>
     </calendar-modebox>
     <hbox id="calendar-invitations-panel"
           class="statusbarpanel"
           insertbefore="unreadMessageCount,totalMessageCount"
           oncommand="openInvitationsDialog()">
       <label id="calendar-invitations-label"
              class="text-link"