Codebase list gnome-shell-extensions / 2ad42b0
Update patch for apps-menu Daniel Ruiz de Alegría 2 years ago
1 changed file(s) with 43 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
33
44 Bug-Kali: https://bugs.kali.org/view.php?id=2223
55 Bug: https://bugzilla.gnome.org/show_bug.cgi?id=739480
6
67 ---
7 extensions/apps-menu/extension.js | 163 ++++++++++++++++++++++++++++++--------
8 1 file changed, 130 insertions(+), 33 deletions(-)
8 extensions/apps-menu/extension.js | 166 ++++++++++++++++++++++++------
9 1 file changed, 133 insertions(+), 33 deletions(-)
910
1011 diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
11 index 2cbb754..09105bf 100644
12 index cc1d697..58ac020 100644
1213 --- a/extensions/apps-menu/extension.js
1314 +++ b/extensions/apps-menu/extension.js
14 @@ -96,30 +96,36 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
15 });
16
17 var CategoryMenuItem = GObject.registerClass(
15 @@ -98,34 +98,40 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem {
16 }
17 }
18
1819 -class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
19 - _init(button, category) {
20 - super._init();
21 - this._category = category;
22 - this._button = button;
23 -
24 - this._oldX = -1;
25 - this._oldY = -1;
2620 +class CategoryMenuItem extends PopupMenu.PopupMenuItem {
2721 + /* Kali patch note: the use of PopupMenuItem instead of
2822 + * PopupBaseMenuItem means that all the code in _onMotionEvent and
3024 + * be passed to the parent constructor instead of being added in the
3125 + * menu item by ourselves. The _oldX/_oldY variables are not
3226 + * initialized as they are only needed for isNavigatingSubmenu */
33
34 + _init(button, category) {
27 +
28 static {
29 GObject.registerClass(this);
30 }
31
32 constructor(button, category) {
33 - super();
34 - this._category = category;
35 - this._button = button;
36 -
37 - this._oldX = -1;
38 - this._oldY = -1;
39 -
3540 let name;
3641 - if (this._category)
3742 - name = this._category.get_name();
4146 name = _('Favorites');
4247
4348 - this.add_child(new St.Label({ text: name }));
44 + super._init(name);
49 + super(name);
4550 +
4651 + this._category = category;
4752 + this._button = button;
6166 }
6267
6368 _isNavigatingSubmenu([x, y]) {
64 @@ -207,11 +213,61 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
69 @@ -217,11 +223,64 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem {
6570 if (!this.active)
6671 return;
6772
6873 + this._button.selectCategory(this._category);
6974 + //this._button.scrollToCatButton(this);
7075 + }
71 +});
72 +
73 +var ParentCategoryMenuItem = GObject.registerClass(
76 +}
77 +
7478 +class ParentCategoryMenuItem extends PopupMenu.PopupSubMenuMenuItem {
75 + _init(button, category) {
79 + static {
80 + GObject.registerClass(this);
81 + }
82 +
83 + constructor(button, category) {
7684 + let name;
7785 + if (category)
7886 + name = category.get_name();
7987 + else
8088 + name = _("Favorites");
8189 +
82 + super._init(name, false);
90 + super(name, false);
8391 +
8492 + this._category = category;
8593 + this._button = button;
98106 + //this._button.scrollToCatButton(this);
99107 + }
100108 }
101 });
109 }
102110
103111 +class PopupMenuScrollView extends PopupMenu.PopupMenuSection {
104112 + constructor() {
123131 class ApplicationsMenu extends PopupMenu.PopupMenu {
124132 constructor(sourceActor, arrowAlignment, arrowSide, button) {
125133 super(sourceActor, arrowAlignment, arrowSide);
126 @@ -410,7 +466,7 @@ class ApplicationsButton extends PanelMenu.Button {
134 @@ -423,7 +482,7 @@ class ApplicationsButton extends PanelMenu.Button {
127135 _onTreeChanged() {
128136 if (this.menu.isOpen) {
129137 this._redisplay();
132140 } else {
133141 this.reloadFlag = true;
134142 }
135 @@ -471,20 +527,21 @@ class ApplicationsButton extends PanelMenu.Button {
143 @@ -484,20 +543,21 @@ class ApplicationsButton extends PanelMenu.Button {
136144 this._redisplay();
137145 this.reloadFlag = false;
138146 }
157165 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
158166 if (nextType === GMenu.TreeItemType.ENTRY) {
159167 let entry = iter.get_entry();
160 @@ -503,8 +560,17 @@ class ApplicationsButton extends PanelMenu.Button {
168 @@ -516,8 +576,17 @@ class ApplicationsButton extends PanelMenu.Button {
161169 this.applicationsByCategory[categoryId].push('separator');
162170 } else if (nextType === GMenu.TreeItemType.DIRECTORY) {
163171 let subdir = iter.get_directory();
177185 }
178186 }
179187 }
180 @@ -525,8 +591,8 @@ class ApplicationsButton extends PanelMenu.Button {
188 @@ -538,8 +607,8 @@ class ApplicationsButton extends PanelMenu.Button {
181189 }
182190
183191 scrollToCatButton(button) {
188196 let currentScrollValue = catsScrollBoxAdj.get_value();
189197 let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1;
190198 let buttonAlloc = button.get_allocation_box();
191 @@ -542,8 +608,9 @@ class ApplicationsButton extends PanelMenu.Button {
199 @@ -555,8 +624,9 @@ class ApplicationsButton extends PanelMenu.Button {
192200 _createLayout() {
193201 let section = new PopupMenu.PopupMenuSection();
194202 this.menu.addMenuItem(section);
200208 this.applicationsScrollBox = new St.ScrollView({
201209 style_class: 'apps-menu vfade',
202210 x_expand: true,
203 @@ -556,6 +623,7 @@ class ApplicationsButton extends PanelMenu.Button {
211 @@ -569,6 +639,7 @@ class ApplicationsButton extends PanelMenu.Button {
204212 vscroll.connect('scroll-stop', () => {
205213 this.menu.passEvents = false;
206214 });
208216 this.categoriesScrollBox = new St.ScrollView({
209217 style_class: 'vfade',
210218 });
211 @@ -564,9 +632,10 @@ class ApplicationsButton extends PanelMenu.Button {
219 @@ -577,9 +648,10 @@ class ApplicationsButton extends PanelMenu.Button {
212220 vscroll.connect('scroll-start', () => (this.menu.passEvents = true));
213221 vscroll.connect('scroll-stop', () => (this.menu.passEvents = false));
214222 this.leftBox.add_child(this.categoriesScrollBox);
220228 this.categoriesBox = new St.BoxLayout({ vertical: true });
221229 this.categoriesScrollBox.add_actor(this.categoriesBox);
222230
223 @@ -574,19 +643,29 @@ class ApplicationsButton extends PanelMenu.Button {
231 @@ -587,19 +659,29 @@ class ApplicationsButton extends PanelMenu.Button {
224232 this.mainBox.add_child(this._createVertSeparator());
225233 this.mainBox.add_child(this.applicationsScrollBox);
226234 section.actor.add_actor(this.mainBox);
253261 let iter = root.iter();
254262 let nextType;
255263 while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) {
256 @@ -599,10 +678,13 @@ class ApplicationsButton extends PanelMenu.Button {
264 @@ -612,10 +694,13 @@ class ApplicationsButton extends PanelMenu.Button {
257265
258266 let categoryId = dir.get_menu_id();
259267 this.applicationsByCategory[categoryId] = [];
271279 }
272280 }
273281
274 @@ -611,9 +693,10 @@ class ApplicationsButton extends PanelMenu.Button {
282 @@ -624,9 +709,10 @@ class ApplicationsButton extends PanelMenu.Button {
275283
276284 let themeContext = St.ThemeContext.get_for_stage(global.stage);
277285 let scaleFactor = themeContext.scale_factor;
284292 }
285293
286294 selectCategory(dir) {
287 @@ -628,6 +711,20 @@ class ApplicationsButton extends PanelMenu.Button {
295 @@ -641,6 +727,20 @@ class ApplicationsButton extends PanelMenu.Button {
288296 this._displayButtons(this._listApplications(dir.get_menu_id()));
289297 else
290298 this._displayButtons(this._listApplications(null));