~mozillateam/thunderbird/thunderbird-beta.vivid

« back to all changes in this revision

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

  • Committer: Chris Coulson
  • Date: 2013-04-02 22:59:42 UTC
  • Revision ID: chris.coulson@canonical.com-20130402225942-fdq9x5wmmhoedwc5
* New upstream release from the beta channel (THUNDERBIRD_21_0b1_BUILD1)
* Drop support for building on older than precise
  - update debian/apport/source_thunderbird.py.in
  - update debian/build/mozbuild.mk
  - update debian/config/mozconfig.in
  - update debian/control.in
  - remove debian/patches/add-syspref-dir.patch
  - update debian/patches/series.in
  - remove debian/patches/use-new-yasm-in-lucid.patch
  - update debian/rules
  - update debian/thunderbird-globalmenu.dirs.in
  - update debian/thunderbird.desktop.in
  - update debian/thunderbird.dirs.in
  - update debian/thunderbird.install.in
  - update debian/thunderbird.links.in
  - update debian/thunderbird.postinst.in
  - update debian/thunderbird.postrm.in
  - update debian/thunderbird.preinst.in
* Drop the perl script for preprocessing the quilt series file
  - remove debian/build/enable-dist-patches.pl
  - update debian/build/mozbuild.mk
  - update debian/patches/series.in
* Make sure that SHELL is set in the build environment
  - update debian/build/mozbuild.mk
* Don't set the MOZCONFIG environment variable, but just copy our config
  in to the root of the source tree
  - update debian/build/mozconfig.mk
* Drop libthai suggest - this hasn't been needed for a long time
  - update debian/control
* Replace latex-xft-fonts suggest with ttf-lyx (yes, I know this is a
  transitional package since 12.10, but it avoids suggesting a different
  package for each release)
  - update debian/control
* Use virtualenv for compare-locales
  - update debian/build/create-tarball.py
  - update debian/build/mozbuild.mk
* Refactor create-tarball.py
* Fix LP: #1093665 - 'Next' button icon points upwards. Thanks to
  Richard Marti for the patch
  - update debian/patches/theme-refresh-messenger-toolbar-icons.patch
* Move some test integration patches in to a new directory
  - rename d/p/test-overrides/xpcshell-disable-addon-select-dialog-test.patch =>
      d/p/test-integration/xpcshell-disable-addon-select-dialog-test-for-adt.patch
  - rename debian/patches/update-python-virtualenv.patch =>
      d/p/test-integration/mozmill-update-python-virtualenv.patch
  - rename debian/patches/workaround-shebang-char-limit.patch =>
      d/p/test-fixes/mozmill-workaround-shebang-char-limit.patch
  - rename d/p/test-overrides/xpcshell-disable-mailglue-distribution-test.patch =>
      d/p/test-integration/xpcshell-disable-mailglue-distribution-test.patch
* Drop debian/patches/python-virtualenv-multiarch-fix.patch - fixed upstream
* Drop the ability to automatically skip xpcshell tests on an installed system that
  require write access to the application directory, preferring to just disable
  them instead. In reality, we weren't ever going to use this feature
  - remove d/p/test-integration/xpcshell-allow-omit-tests-on-real-install.patch
  - rename d/p/test-integration/xpcshell-disable-mailglue-distribution-test.patch =>
      d/p/test-integration/xpcshell-disable-tests-which-need-appdir-write-access.patch
  - update d/p/test-integration/xpcshell-disable-tests-which-need-appdir-write-access.patch
  - remove d/p/xpcshell-disable-extension-upgrade-test-for-adt.patch (merged
    in to the last patch)
  - remove d/p/test-overrides/xpcshell-disable-isp-autoconfig-test.patch
    (merged in to the last patch)
* Disable some extra failing xpcshell tests
  - rename d/p/test-overrides/xpcshell-disable-geolocation-provider-test.patch =>
      d/p/test-overrides/xpcshell-disable-failing-tests.patch
  - update d/p/test-overrides/xpcshell-disable-failing-tests.patch
  - update debian/patches/series.in
* Disable the menubar addon
  - update debian/config/mozconfig.in
  - update debian/build/mozbuild.mk
  - update debian/thunderbird-globalmenu.dirs.in
* Drop the menubar addon
  - remove debian/globalmenu
  - update debian/build/mozbuild.mk
  - update debian/config/mozconfig.in
  - update debian/control.in
  - remove debian/thunderbird-globalmenu.dirs.in
  - remove debian/patches/unity-globalmenu-build-support.patch
  - update debian/patches/series.in
* Fix build failure with --disable-updater builds
  - add debian/patches/fix-install-manifest-for-no-updater.patch
  - update debian/patches/series
* Fix a space versus tab issue in debian/build/mozbuild.mk
* Add native support for the Unity menubar (no addon)
  - add debian/patches/unity-menubar.patch
  - update debian/patches/series.in
* Refresh patches
  - update d/p/test-overrides/xpcshell-disable-geolocation-provider-test.patch
  - update debian/patches/xpcshell-allow-omit-tests-on-real-install.patch
  - update debian/patches/dont-include-hyphenation-patterns.patch
  - update d/p/test-integration/mozmill-update-python-virtualenv.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
 
/* ***** BEGIN LICENSE BLOCK *****
3
 
 *       Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
 
 *
5
 
 * The contents of this file are subject to the Mozilla Public License Version
6
 
 * 1.1 (the "License"); you may not use this file except in compliance with
7
 
 * the License. You may obtain a copy of the License at
8
 
 * http://www.mozilla.org/MPL/
9
 
 * 
10
 
 * Software distributed under the License is distributed on an "AS IS" basis,
11
 
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
 
 * for the specific language governing rights and limitations under the
13
 
 * License.
14
 
 *
15
 
 * The Original Code is globalmenu-extension.
16
 
 *
17
 
 * The Initial Developer of the Original Code is
18
 
 * Canonical Ltd.
19
 
 * Portions created by the Initial Developer are Copyright (C) 2010
20
 
 * the Initial Developer. All Rights Reserved.
21
 
 *
22
 
 * Contributor(s):
23
 
 * Chris Coulson <chris.coulson@canonical.com>
24
 
 *
25
 
 * Alternatively, the contents of this file may be used under the terms of
26
 
 * either the GNU General Public License Version 2 or later (the "GPL"), or
27
 
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
 
 * in which case the provisions of the GPL or the LGPL are applicable instead
29
 
 * of those above. If you wish to allow use of your version of this file only
30
 
 * under the terms of either the GPL or the LGPL, and not to allow others to
31
 
 * use your version of this file under the terms of the MPL, indicate your
32
 
 * decision by deleting the provisions above and replace them with the notice
33
 
 * and other provisions required by the GPL or the LGPL. If you do not delete
34
 
 * the provisions above, a recipient may use your version of this file under
35
 
 * the terms of any one of the MPL, the GPL or the LGPL.
36
 
 * 
37
 
 * ***** END LICENSE BLOCK ***** */
38
 
 
39
 
#ifndef _U_GLOBALMENU_H
40
 
#define _U_GLOBALMENU_H
41
 
 
42
 
#include <prtypes.h>
43
 
#include <nsTArray.h>
44
 
#include <nsAutoPtr.h>
45
 
#include <nsCOMPtr.h>
46
 
#include <nsIContent.h>
47
 
#include <nsThreadUtils.h>
48
 
 
49
 
#include <libdbusmenu-glib/server.h>
50
 
 
51
 
#include "uGlobalMenuObject.h"
52
 
#include "uWidgetAtoms.h"
53
 
 
54
 
#define UNITY_MENU_POPUP_STATE_0          FLAG(8)
55
 
#define UNITY_MENU_POPUP_STATE_1          FLAG(9)
56
 
#define UNITY_MENU_POPUP_STATE_2          FLAG(10)
57
 
#define UNITY_MENU_POPUP_STATE_MASK       (UNITY_MENU_POPUP_STATE_2 | UNITY_MENU_POPUP_STATE_1 | UNITY_MENU_POPUP_STATE_0)
58
 
 
59
 
// The menu needs rebuilding
60
 
#define UNITY_MENU_NEEDS_REBUILDING       FLAG(11)
61
 
 
62
 
// The shell sent the first "AboutToOpen" event
63
 
#define UNITY_MENU_READY                  FLAG(12)
64
 
 
65
 
class uGlobalMenuItem;
66
 
class uGlobalMenuDocListener;
67
 
class nsITimer;
68
 
 
69
 
enum uMenuPopupState {
70
 
  ePopupClosed = 0,
71
 
  ePopupShowing,
72
 
  ePopupOpen1, // Menu was opened with an "about-to-show" signal
73
 
  ePopupOpen2, // Menu was opened with an "opened" event
74
 
  ePopupHiding
75
 
};
76
 
 
77
 
class uGlobalMenu: public uGlobalMenuObject
78
 
{
79
 
public:
80
 
  static uGlobalMenuObject* Create(uGlobalMenuObject *aParent,
81
 
                                   uGlobalMenuDocListener *aListener,
82
 
                                   nsIContent *aContent);
83
 
  virtual void Destroy();
84
 
  virtual ~uGlobalMenu();
85
 
 
86
 
  virtual uMenuObjectType GetType() { return eMenu; }
87
 
 
88
 
  bool CanOpen();
89
 
  void OpenMenuDelayed();
90
 
  
91
 
protected:
92
 
  virtual void ObserveAttributeChanged(nsIContent *aContent,
93
 
                                       nsIAtom *aAttribute);
94
 
  virtual void ObserveContentRemoved(nsIContent *aContainer,
95
 
                                     nsIContent *aChild);
96
 
  virtual void ObserveContentInserted(nsIContent *aContainer,
97
 
                                      nsIContent *aChild,
98
 
                                      nsIContent *aPrevSibling);
99
 
 
100
 
private:
101
 
  uGlobalMenu();
102
 
 
103
 
  // Initialize the menu structure
104
 
  nsresult Init(uGlobalMenuObject *aParent,
105
 
                uGlobalMenuDocListener *aListener,
106
 
                nsIContent *aContent);
107
 
 
108
 
  uint32_t IndexOf(nsIContent *aContent);
109
 
  bool InsertMenuObjectAfterContent(uGlobalMenuObject *menuObj,
110
 
                                    nsIContent *aPrevSibling);
111
 
  bool AppendMenuObject(uGlobalMenuObject *menuObj);
112
 
  bool RemoveMenuObjectAt(uint32_t index, bool recycle);
113
 
  bool RemoveMenuObjectForContent(nsIContent *aContent, bool recycle);
114
 
  virtual void InitializeDbusMenuItem();
115
 
  virtual void Refresh(uMenuObjectRefreshMode aMode);
116
 
  virtual uMenuObjectProperties GetValidProperties()
117
 
  {
118
 
    return static_cast<uMenuObjectProperties>(eLabel | eEnabled | eVisible |
119
 
                                              eIconData | eChildDisplay);
120
 
  }
121
 
  nsresult Build();
122
 
  void InitializePopup();
123
 
  static bool MenuAboutToOpenCallback(DbusmenuMenuitem *menu,
124
 
                                      void *data);
125
 
  static bool MenuEventCallback(DbusmenuMenuitem *menu,
126
 
                                const gchar *name,
127
 
                                GVariant *value,
128
 
                                guint timestamp,
129
 
                                void *data);
130
 
  static void DoOpen(nsITimer *aTimer, void *aClosure);
131
 
  void AboutToOpen(bool aOpenedEvent, bool aWantPopupShownEvent = true);
132
 
  void FirePopupShownEvent();
133
 
  void OnClose();
134
 
  void FirePopupHidingEvent();
135
 
  void SetNeedsRebuild() { mFlags = mFlags | UNITY_MENU_NEEDS_REBUILDING; }
136
 
  void ClearNeedsRebuild() { mFlags = mFlags & ~UNITY_MENU_NEEDS_REBUILDING; }
137
 
  bool DoesNeedRebuild() { return !!(mFlags & UNITY_MENU_NEEDS_REBUILDING); }
138
 
  void FlushRecycleList() { mRecycleList = nullptr; }
139
 
  uMenuPopupState GetPopupState()
140
 
  {
141
 
    return static_cast<uMenuPopupState>((mFlags & UNITY_MENU_POPUP_STATE_MASK) >> 8);
142
 
  }
143
 
  void SetPopupState(uMenuPopupState aState);
144
 
 
145
 
  struct RecycleList
146
 
  {
147
 
  public:
148
 
    RecycleList(uGlobalMenu *aMenu);
149
 
    ~RecycleList();
150
 
 
151
 
    DbusmenuMenuitem* RecycleForAppend(uGlobalMenuObject *aMenuObj);
152
 
    DbusmenuMenuitem* RecycleForInsert(uGlobalMenuObject *aMenuObj,
153
 
                                       uint32_t aIndex,
154
 
                                       uint32_t *aCorrectedIndex);
155
 
    void TakeItem(DbusmenuMenuitem *aMenuObj, uint32_t aIndex);
156
 
 
157
 
  private:
158
 
    void Flush();
159
 
    DbusmenuMenuitem* Shift(uGlobalMenuObject *aMenuObj = nullptr);
160
 
 
161
 
    uint32_t mMarker;
162
 
    nsTArray<DbusmenuMenuitem *> mList;
163
 
    uGlobalMenu *mMenu;
164
 
    nsRefPtr<nsRunnableMethod<uGlobalMenu, void, false> > mFreeEvent;
165
 
  };
166
 
 
167
 
  nsCOMPtr<nsIContent> mPopupContent;
168
 
  nsTArray< nsRefPtr<uGlobalMenuObject> > mMenuObjects;
169
 
  nsAutoPtr<RecycleList> mRecycleList;
170
 
};
171
 
 
172
 
#endif