Bug 1558599 - Rename setUpCalendarAppMenus. r=mkmelin
authorPaul Morris <paul@paulwmorris.com>
Mon, 01 Jul 2019 17:25:52 +0200
changeset 36005 f0df11ad8ffaac7c7bad10c71f061971b9946894
parent 36004 80baeab83f559a623bed894efe753991cb8574af
child 36006 a9eca82028203e39962bebea90631ab0470cd3d0
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersmkmelin
bugs1558599
Bug 1558599 - Rename setUpCalendarAppMenus. r=mkmelin Make it clear that these functions only set up and tear down the calendar appmenu buttons, not the content of the appmenu.
calendar/base/content/calendar-chrome-startup.js
--- a/calendar/base/content/calendar-chrome-startup.js
+++ b/calendar/base/content/calendar-chrome-startup.js
@@ -33,18 +33,18 @@ async function commonInitCalendar() {
     prepareCalendarToDoUnifinder();
 
     // Make sure we update ourselves if the program stays open over midnight
     scheduleMidnightUpdate(refreshUIBits);
 
     // Set up the command controller from calendar-common-sets.js
     injectCalendarCommandController();
 
-    // Set up appmenus.
-    setUpCalendarAppMenus();
+    // Set up calendar appmenu buttons.
+    setUpCalendarAppMenuButtons();
 
     // Set up calendar menu items in the appmenu.
     setUpCalendarAppMenuItems();
 
     // Set up item and day selection listeners
     getViewDeck().addEventListener("dayselect", observeViewDaySelect);
     getViewDeck().addEventListener("itemselect", calendarController.onSelectionChanged, true);
 
@@ -87,18 +87,18 @@ function commonFinishCalendar() {
     unloadCalendarManager();
 
     // clean up the unifinder
     finishCalendarToDoUnifinder();
 
     // Remove the command controller
     removeCalendarCommandController();
 
-    // Tear down calendar appmenus.
-    tearDownCalendarAppMenus();
+    // Tear down calendar appmenu buttons.
+    tearDownCalendarAppMenuButtons();
 
     document.getElementById("calsidebar_splitter").removeEventListener("command", onCalendarViewResize);
     window.removeEventListener("resize", onCalendarViewResize, true);
 
     // Clean up window pref observers
     calendarWindowPrefs.cleanup();
 }
 
@@ -162,40 +162,40 @@ var calendarWindowPrefs = {
                 let attributeValue = Services.prefs.getBoolPref("calendar.view.useSystemColors", false) && "true";
                 setElementValue(win.document.documentElement, attributeValue, "systemcolors");
             });
         }
     }
 };
 
 /**
- * Set up calendar appmenus by adding event listeners to the appmenu buttons.
- * Also used to tear down the appmenus by removing the event listeners.
+ * Set up calendar appmenu buttons by adding event listeners to the buttons.
+ * Also used to tear down the appmenu buttons by removing the event listeners.
  *
  * @param {boolean} [remove]  Whether to remove event listeners instead of adding them.
  */
-function setUpCalendarAppMenus(remove) {
+function setUpCalendarAppMenuButtons(remove) {
     const addOrRemoveListener = remove ? "removeEventListener" : "addEventListener";
     [
         "calendar-appmenu-button",
         "task-appmenu-button",
         "calendar-item-appmenu-button"
     ]
     .forEach(id => {
         const button = document.getElementById(id);
         button[addOrRemoveListener]("mousedown", PanelUI);
         button[addOrRemoveListener]("keypress", PanelUI);
     });
 }
 
 /**
- * Tear down calendar appmenus by removing event listeners from the appmenu button.
+ * Tear down calendar appmenu buttons by removing event listeners from them.
  */
-function tearDownCalendarAppMenus() {
-    setUpCalendarAppMenus(true);
+function tearDownCalendarAppMenuButtons() {
+    setUpCalendarAppMenuButtons(true);
 }
 
 /**
  * Event listener used to refresh the "Events and Tasks" menu/view in the appmenu.
  */
 function refreshEventsAndTasksMenu(event) {
     changeMenuForTask(event);
     setupDeleteMenuitem("appmenu_ltnDeleteSelectedCalendar");