Skip to content

Commit

Permalink
Ensure unified menu is shown properly
Browse files Browse the repository at this point in the history
(integrated from master branch change ae3b65a by Nathan Rijksen <n.rijksen@gmail.com>)
  • Loading branch information
Naatan committed Jul 30, 2015
1 parent b6ce830 commit 80e185c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/chrome/komodo/content/komodo.p.xul
Original file line number Diff line number Diff line change
Expand Up @@ -2063,8 +2063,8 @@
buttonstyle="pictures"
collapsed="true"
>
<menupopup>
<hbox>
<menupopup id="unifiedMenuPopup">
<hbox id="unifiedMenuPopupHbox">
<vbox id="unifiedMenuPrimaryPane"/>
<vbox id="unifiedMenuSecondaryPane">
<menuseparator id="unifiedMenuMruSeparator" ordinal="9999" preserve="true"/>
Expand Down
20 changes: 12 additions & 8 deletions src/chrome/komodo/content/library/uilayout.p.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,23 @@ this.toggleButtons = function uilayout_toggleButtons()
}

// #if PLATFORM != "darwin"
var g_initialized_button_menu = false;

this.toggleMenubar = function uilayout_toggleMenubar() {
var broadcaster = document.getElementById('cmd_toggleMenubar');
broadcaster.setAttribute('checked', !(broadcaster.getAttribute('checked') == 'true'));
ko.uilayout.setMenubarVisibility();
}

// Copy the top-level menus into the button menus.
this.cloneUnifiedMenuItems = function uilayout_cloneUnifiedMenuItems() {
// Copy the top-level menus into the button menus.
g_initialized_button_menu = true;
// Reset the menupopup each time its initialized
var wrapper = document.getElementById('unifiedMenuPopupHbox');
if ( ! ("__cloned" in this.cloneUnifiedMenuItems))
{
this.cloneUnifiedMenuItems.__cloned = wrapper.cloneNode(true);
}
var _wrapper = this.cloneUnifiedMenuItems.__cloned.cloneNode(true);
wrapper.parentNode.replaceChild(_wrapper, wrapper);
wrapper = _wrapper;

var menubar = document.getElementById('menubar_main');
var popupFile = document.getElementById('popup_file');
Expand Down Expand Up @@ -261,10 +267,6 @@ this.setMenubarVisibility = function uilayout_setMenubarVisibility(menubarShowin
// Hide the menu button - as the menu is always showing.
menuButton.collapsed = true;
} else {
if (!g_initialized_button_menu) {
ko.uilayout.cloneUnifiedMenuItems();
}

menuButton.collapsed = false;
UpdateUnifiedMenuMru();
}
Expand Down Expand Up @@ -1853,6 +1855,8 @@ this.onload = function uilayout_onload()
// Also track click events, as not all menuitem's fire a command event
document.getElementById('unifiedMenuButton').addEventListener('click', trackMenuItemMru);
document.getElementById('menubar_main').addEventListener('click', trackMenuItemMru);

document.getElementById('unifiedMenuPopup').addEventListener('popupshowing', ko.uilayout.cloneUnifiedMenuItems.bind(ko.uilayout));

ko.uilayout.setMenubarVisibility();
// #endif
Expand Down

0 comments on commit 80e185c

Please sign in to comment.