Codebase list gnome-shell-extensions / 23c640d
Fix exception on 3.34 when toggling submenu states Emilio Pozuelo Monfort 4 years ago
1 changed file(s) with 22 addition(s) and 23 deletion(s). Raw diff Collapse all Expand all
44 Bug-Kali: https://bugs.kali.org/view.php?id=2223
55 Bug: https://bugzilla.gnome.org/show_bug.cgi?id=739480
66 ---
7 extensions/apps-menu/extension.js | 165 ++++++++++++++++++++++++++++++--------
8 1 file changed, 133 insertions(+), 32 deletions(-)
7 extensions/apps-menu/extension.js | 166 ++++++++++++++++++++++++++++++--------
8 1 file changed, 134 insertions(+), 32 deletions(-)
99
1010 diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
11 index 70383af..294074a 100644
11 index 70383af..3fe01c7 100644
1212 --- a/extensions/apps-menu/extension.js
1313 +++ b/extensions/apps-menu/extension.js
1414 @@ -97,30 +97,36 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
6161 }
6262
6363 _isNavigatingSubmenu([x, y]) {
64 @@ -208,11 +214,55 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
64 @@ -208,11 +214,61 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
6565 if (!this.active)
6666 return;
6767
112112 + this.actor._delegate = this;
113113 + this.actor.clip_to_allocation = true;
114114 + }
115 +
116 + _setOpenedSubMenu(menu) {
117 + // We don't close the currently opened submenu so that nested submenus work
118 + // https://mail.gnome.org/archives/gnome-shell-list/2014-January/msg00010.html
119 + this.openChildMenu = menu;
120 + }
115121 +};
116122 +
117123 class ApplicationsMenu extends PopupMenu.PopupMenu {
118124 constructor(sourceActor, arrowAlignment, arrowSide, button) {
119125 super(sourceActor, arrowAlignment, arrowSide);
120 @@ -412,7 +462,7 @@ class ApplicationsButton extends PanelMenu.Button {
126 @@ -412,7 +468,7 @@ class ApplicationsButton extends PanelMenu.Button {
121127 _onTreeChanged() {
122128 if (this.menu.isOpen) {
123129 this._redisplay();
126132 } else {
127133 this.reloadFlag = true;
128134 }
129 @@ -477,7 +527,7 @@ class ApplicationsButton extends PanelMenu.Button {
135 @@ -477,7 +533,7 @@ class ApplicationsButton extends PanelMenu.Button {
130136 this._redisplay();
131137 this.reloadFlag = false;
132138 }
135141 }
136142 super._onOpenStateChanged(menu, open);
137143 }
138 @@ -490,13 +540,14 @@ class ApplicationsButton extends PanelMenu.Button {
144 @@ -490,13 +546,14 @@ class ApplicationsButton extends PanelMenu.Button {
139145
140146 _redisplay() {
141147 this.applicationsBox.destroy_all_children();
152158 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
153159 if (nextType === GMenu.TreeItemType.ENTRY) {
154160 let entry = iter.get_entry();
155 @@ -515,8 +566,17 @@ class ApplicationsButton extends PanelMenu.Button {
161 @@ -515,8 +572,17 @@ class ApplicationsButton extends PanelMenu.Button {
156162 this.applicationsByCategory[categoryId].push('separator');
157163 } else if (nextType === GMenu.TreeItemType.DIRECTORY) {
158164 let subdir = iter.get_directory();
172178 }
173179 }
174180 }
175 @@ -537,8 +597,8 @@ class ApplicationsButton extends PanelMenu.Button {
181 @@ -537,8 +603,8 @@ class ApplicationsButton extends PanelMenu.Button {
176182 }
177183
178184 scrollToCatButton(button) {
183189 let currentScrollValue = catsScrollBoxAdj.get_value();
184190 let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1;
185191 let buttonAlloc = button.get_allocation_box();
186 @@ -552,10 +612,16 @@ class ApplicationsButton extends PanelMenu.Button {
187 }
188
192 @@ -554,8 +620,9 @@ class ApplicationsButton extends PanelMenu.Button {
189193 _createLayout() {
190 + // https://mail.gnome.org/archives/gnome-shell-list/2014-January/msg00010.html
191 + this.menu._setOpenedSubMenu = (submenu) => {
192 + this._openedSubMenu = submenu;
193 + };
194 +
195194 let section = new PopupMenu.PopupMenuSection();
196195 this.menu.addMenuItem(section);
197196 - this.mainBox = new St.BoxLayout({ vertical: false });
202201 this.applicationsScrollBox = new St.ScrollView({
203202 x_fill: true,
204203 y_fill: false,
205 @@ -570,6 +636,7 @@ class ApplicationsButton extends PanelMenu.Button {
204 @@ -570,6 +637,7 @@ class ApplicationsButton extends PanelMenu.Button {
206205 vscroll.connect('scroll-stop', () => {
207206 this.menu.passEvents = false;
208207 });
210209 this.categoriesScrollBox = new St.ScrollView({
211210 x_fill: true,
212211 y_fill: false,
213 @@ -586,9 +653,11 @@ class ApplicationsButton extends PanelMenu.Button {
212 @@ -586,9 +654,11 @@ class ApplicationsButton extends PanelMenu.Button {
214213 y_fill: true,
215214 y_align: St.Align.START,
216215 });
222221 this.categoriesBox = new St.BoxLayout({ vertical: true });
223222 this.categoriesScrollBox.add_actor(this.categoriesBox);
224223
225 @@ -604,19 +673,33 @@ class ApplicationsButton extends PanelMenu.Button {
224 @@ -604,19 +674,33 @@ class ApplicationsButton extends PanelMenu.Button {
226225 y_fill: true,
227226 });
228227 section.actor.add_actor(this.mainBox);
259258 let iter = root.iter();
260259 let nextType;
261260 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
262 @@ -629,10 +712,13 @@ class ApplicationsButton extends PanelMenu.Button {
261 @@ -629,10 +713,13 @@ class ApplicationsButton extends PanelMenu.Button {
263262
264263 let categoryId = dir.get_menu_id();
265264 this.applicationsByCategory[categoryId] = [];
277276 }
278277 }
279278
280 @@ -641,9 +727,10 @@ class ApplicationsButton extends PanelMenu.Button {
279 @@ -641,9 +728,10 @@ class ApplicationsButton extends PanelMenu.Button {
281280
282281 let themeContext = St.ThemeContext.get_for_stage(global.stage);
283282 let scaleFactor = themeContext.scale_factor;
290289 }
291290
292291 selectCategory(dir) {
293 @@ -658,6 +745,20 @@ class ApplicationsButton extends PanelMenu.Button {
292 @@ -658,6 +746,20 @@ class ApplicationsButton extends PanelMenu.Button {
294293 this._displayButtons(this._listApplications(dir.get_menu_id()));
295294 else
296295 this._displayButtons(this._listApplications(null));