Codebase list gnome-shell-extensions / 7f6d8e6
apps-menu: update patch for GNOME 3.38 Emilio Pozuelo Monfort 3 years ago
1 changed file(s) with 19 addition(s) and 26 deletion(s). Raw diff Collapse all Expand all
77 extensions/apps-menu/extension.js | 167 ++++++++++++++++++++++++++++++--------
88 1 file changed, 134 insertions(+), 33 deletions(-)
99
10 diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
11 index 9d46506..939d1b4 100644
1210 --- a/extensions/apps-menu/extension.js
1311 +++ b/extensions/apps-menu/extension.js
14 @@ -97,30 +97,36 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
12 @@ -97,30 +97,36 @@ class ApplicationMenuItem extends PopupM
1513 });
1614
1715 var CategoryMenuItem = GObject.registerClass(
6159 }
6260
6361 _isNavigatingSubmenu([x, y]) {
64 @@ -208,11 +214,61 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
65 if (!this.active)
62 @@ -209,10 +215,60 @@ class CategoryMenuItem extends PopupMenu
6663 return;
6764
68 + this._button.selectCategory(this._category);
65 this._button.selectCategory(this._category);
6966 + //this._button.scrollToCatButton(this);
7067 + }
7168 +});
8784 + }
8885 +
8986 + activate(event) {
90 this._button.selectCategory(this._category);
87 + this._button.selectCategory(this._category);
9188 this._button.scrollToCatButton(this);
9289 + super.activate(event);
9390 + }
123120 class ApplicationsMenu extends PopupMenu.PopupMenu {
124121 constructor(sourceActor, arrowAlignment, arrowSide, button) {
125122 super(sourceActor, arrowAlignment, arrowSide);
126 @@ -412,7 +468,7 @@ class ApplicationsButton extends PanelMenu.Button {
123 @@ -412,7 +468,7 @@ class ApplicationsButton extends PanelMe
127124 _onTreeChanged() {
128125 if (this.menu.isOpen) {
129126 this._redisplay();
132129 } else {
133130 this.reloadFlag = true;
134131 }
135 @@ -477,7 +533,7 @@ class ApplicationsButton extends PanelMenu.Button {
132 @@ -477,7 +533,7 @@ class ApplicationsButton extends PanelMe
136133 this._redisplay();
137134 this.reloadFlag = false;
138135 }
141138 }
142139 super._onOpenStateChanged(menu, open);
143140 }
144 @@ -490,13 +546,14 @@ class ApplicationsButton extends PanelMenu.Button {
141 @@ -490,13 +546,14 @@ class ApplicationsButton extends PanelMe
145142
146143 _redisplay() {
147144 this.applicationsBox.destroy_all_children();
158155 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
159156 if (nextType === GMenu.TreeItemType.ENTRY) {
160157 let entry = iter.get_entry();
161 @@ -515,8 +572,17 @@ class ApplicationsButton extends PanelMenu.Button {
158 @@ -515,8 +572,17 @@ class ApplicationsButton extends PanelMe
162159 this.applicationsByCategory[categoryId].push('separator');
163160 } else if (nextType === GMenu.TreeItemType.DIRECTORY) {
164161 let subdir = iter.get_directory();
178175 }
179176 }
180177 }
181 @@ -537,8 +603,8 @@ class ApplicationsButton extends PanelMenu.Button {
178 @@ -537,8 +603,8 @@ class ApplicationsButton extends PanelMe
182179 }
183180
184181 scrollToCatButton(button) {
189186 let currentScrollValue = catsScrollBoxAdj.get_value();
190187 let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1;
191188 let buttonAlloc = button.get_allocation_box();
192 @@ -554,8 +620,9 @@ class ApplicationsButton extends PanelMenu.Button {
189 @@ -554,8 +620,9 @@ class ApplicationsButton extends PanelMe
193190 _createLayout() {
194191 let section = new PopupMenu.PopupMenuSection();
195192 this.menu.addMenuItem(section);
201198 this.applicationsScrollBox = new St.ScrollView({
202199 style_class: 'apps-menu vfade',
203200 x_expand: true,
204 @@ -568,6 +635,7 @@ class ApplicationsButton extends PanelMenu.Button {
201 @@ -568,6 +635,7 @@ class ApplicationsButton extends PanelMe
205202 vscroll.connect('scroll-stop', () => {
206203 this.menu.passEvents = false;
207204 });
209206 this.categoriesScrollBox = new St.ScrollView({
210207 style_class: 'vfade',
211208 });
212 @@ -576,9 +644,10 @@ class ApplicationsButton extends PanelMenu.Button {
209 @@ -576,9 +644,10 @@ class ApplicationsButton extends PanelMe
213210 vscroll.connect('scroll-start', () => (this.menu.passEvents = true));
214211 vscroll.connect('scroll-stop', () => (this.menu.passEvents = false));
215212 this.leftBox.add_child(this.categoriesScrollBox);
221218 this.categoriesBox = new St.BoxLayout({ vertical: true });
222219 this.categoriesScrollBox.add_actor(this.categoriesBox);
223220
224 @@ -586,19 +655,33 @@ class ApplicationsButton extends PanelMenu.Button {
221 @@ -586,19 +655,29 @@ class ApplicationsButton extends PanelMe
225222 this.mainBox.add_child(this._createVertSeparator());
226223 this.mainBox.add_child(this.applicationsScrollBox);
227224 section.actor.add_actor(this.mainBox);
230227 + vscroll = this.categoriesBox.actor.get_vscroll_bar();
231228 + vscroll.connect('scroll-start', () => { this.menu.passEvents = true; });
232229 + vscroll.connect('scroll-stop', () => { this.menu.passEvents = false; });
233 + this.leftBox.actor.add(this.categoriesBox.actor, { expand: true,
234 + x_fill: true, y_fill: true,
235 + y_align: St.Align.START });
230 + this.leftBox.actor.add_actor(this.categoriesBox.actor);
236231 + this.mainBox.addMenuItem(this.leftBox);
237 + this.mainBox.actor.add(this._createVertSeparator(), { expand: false,
238 + x_fill: false, y_fill: true});
239 + this.mainBox.actor.add(this.applicationsScrollBox, { expand: true,
240 + x_fill: true, y_fill: true });
232 + this.mainBox.actor.add_actor(this._createVertSeparator());
233 + this.mainBox.actor.add_actor(this.applicationsScrollBox);
241234 + section.addMenuItem(this.mainBox);
242235 }
243236
258251 let iter = root.iter();
259252 let nextType;
260253 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
261 @@ -611,10 +694,13 @@ class ApplicationsButton extends PanelMenu.Button {
254 @@ -611,10 +690,13 @@ class ApplicationsButton extends PanelMe
262255
263256 let categoryId = dir.get_menu_id();
264257 this.applicationsByCategory[categoryId] = [];
276269 }
277270 }
278271
279 @@ -623,9 +709,10 @@ class ApplicationsButton extends PanelMenu.Button {
272 @@ -623,9 +705,10 @@ class ApplicationsButton extends PanelMe
280273
281274 let themeContext = St.ThemeContext.get_for_stage(global.stage);
282275 let scaleFactor = themeContext.scale_factor;
289282 }
290283
291284 selectCategory(dir) {
292 @@ -640,6 +727,20 @@ class ApplicationsButton extends PanelMenu.Button {
285 @@ -640,6 +723,20 @@ class ApplicationsButton extends PanelMe
293286 this._displayButtons(this._listApplications(dir.get_menu_id()));
294287 else
295288 this._displayButtons(this._listApplications(null));