~mozillateam/thunderbird/thunderbird-beta.head

« back to all changes in this revision

Viewing changes to debian/globalmenu/src/uGlobalMenu.cpp

  • Committer: Chris Coulson
  • Date: 2012-09-27 15:23:50 UTC
  • Revision ID: chris.coulson@canonical.com-20120927152350-21ftvinun5zxqioc
Update globalmenu-extension to 3.5.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
435
435
}
436
436
 
437
437
bool
438
 
uGlobalMenu::InsertMenuObjectAfter(uGlobalMenuObject *menuObj,
439
 
                                   nsIContent *aPrevSibling)
 
438
uGlobalMenu::InsertMenuObjectAfterContent(uGlobalMenuObject *menuObj,
 
439
                                          nsIContent *aPrevSibling)
440
440
{
441
441
  int32_t index = IndexOf(aPrevSibling);
442
442
  NS_ASSERTION(index >= 0 || !aPrevSibling, "Previous sibling not found");
553
553
}
554
554
 
555
555
bool
556
 
uGlobalMenu::RemoveMenuObjectAfter(nsIContent *aPrevSibling, bool recycle)
 
556
uGlobalMenu::RemoveMenuObjectForContent(nsIContent *aContent, bool recycle)
557
557
{
558
 
  int32_t index = IndexOf(aPrevSibling);
559
 
  NS_ASSERTION(index >= 0 || !aPrevSibling, "Previous sibling not found");
560
 
  if (index < 0 && aPrevSibling) {
 
558
  int32_t index = IndexOf(aContent);
 
559
  NS_ASSERTION(index >= 0, "Previous sibling not found");
 
560
  if (index < 0 ) {
561
561
    return false;
562
562
  }
563
563
 
564
 
  index++;
565
 
 
566
564
  return RemoveMenuObjectAt(index, recycle);
567
565
}
568
566
 
860
858
 
861
859
void
862
860
uGlobalMenu::ObserveContentRemoved(nsIContent *aContainer,
863
 
                                   nsIContent *aChild,
864
 
                                   nsIContent *aPrevSibling)
 
861
                                   nsIContent *aChild)
865
862
{
866
863
  TRACETM();
867
864
  NS_ASSERTION(aContainer == mContent || aContainer == mPopupContent,
873
870
  }
874
871
 
875
872
  if (aContainer == mPopupContent) {
876
 
    bool res = RemoveMenuObjectAfter(aPrevSibling, true);
 
873
    bool res = RemoveMenuObjectForContent(aChild, true);
877
874
    NS_WARN_IF_FALSE(res, "Failed to remove menuitem - marking menu as needing a rebuild");
878
875
    if (!res) {
879
876
      SetNeedsRebuild();
901
898
    uGlobalMenuObject *newItem = NewGlobalMenuItem(this, mListener, aChild);
902
899
    bool res = false;
903
900
    if (newItem) {
904
 
      res = InsertMenuObjectAfter(newItem, aPrevSibling);
 
901
      res = InsertMenuObjectAfterContent(newItem, aPrevSibling);
905
902
    }
906
903
    NS_WARN_IF_FALSE(res, "Failed to insert menuitem - marking menu as needing a rebuild");
907
904
    if (!res) {