Refresh patch
Daniel Ruiz de AlegrÃa
1 year, 7 months ago
7 | 7 | extensions/apps-menu/extension.js | 152 +++++++++++++++++++++++++++++--------- |
8 | 8 | 1 file changed, 119 insertions(+), 33 deletions(-) |
9 | 9 | |
10 | diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js | |
11 | index cc1d697..64c7017 100644 | |
12 | 10 | --- a/extensions/apps-menu/extension.js |
13 | 11 | +++ b/extensions/apps-menu/extension.js |
14 | @@ -98,34 +98,40 @@ class ApplicationMenuItem extends PopupMenu.PopupBaseMenuItem { | |
12 | @@ -98,34 +98,40 @@ | |
15 | 13 | } |
16 | 14 | } |
17 | 15 | |
44 | 42 | else |
45 | 43 | name = _('Favorites'); |
46 | 44 | |
47 | - this.add_child(new St.Label({ text: name })); | |
45 | - this.add_child(new St.Label({text: name})); | |
48 | 46 | + super(name); |
49 | 47 | + |
50 | 48 | + this._category = category; |
65 | 63 | } |
66 | 64 | |
67 | 65 | _isNavigatingSubmenu([x, y]) { |
68 | @@ -217,11 +223,64 @@ class CategoryMenuItem extends PopupMenu.PopupBaseMenuItem { | |
69 | if (!this.active) | |
66 | @@ -218,10 +224,63 @@ | |
70 | 67 | return; |
71 | 68 | |
72 | + this._button.selectCategory(this._category); | |
69 | this._button.selectCategory(this._category); | |
73 | 70 | + //this._button.scrollToCatButton(this); |
74 | 71 | + } |
75 | 72 | +} |
94 | 91 | + } |
95 | 92 | + |
96 | 93 | + activate(event) { |
97 | this._button.selectCategory(this._category); | |
94 | + this._button.selectCategory(this._category); | |
98 | 95 | this._button.scrollToCatButton(this); |
99 | 96 | + super.activate(event); |
100 | 97 | + } |
130 | 127 | class ApplicationsMenu extends PopupMenu.PopupMenu { |
131 | 128 | constructor(sourceActor, arrowAlignment, arrowSide, button) { |
132 | 129 | super(sourceActor, arrowAlignment, arrowSide); |
133 | @@ -423,7 +482,7 @@ class ApplicationsButton extends PanelMenu.Button { | |
130 | @@ -424,7 +483,7 @@ | |
134 | 131 | _onTreeChanged() { |
135 | 132 | if (this.menu.isOpen) { |
136 | 133 | this._redisplay(); |
139 | 136 | } else { |
140 | 137 | this.reloadFlag = true; |
141 | 138 | } |
142 | @@ -484,20 +543,21 @@ class ApplicationsButton extends PanelMenu.Button { | |
139 | @@ -485,20 +544,21 @@ | |
143 | 140 | this._redisplay(); |
144 | 141 | this.reloadFlag = false; |
145 | 142 | } |
164 | 161 | while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) { |
165 | 162 | if (nextType === GMenu.TreeItemType.ENTRY) { |
166 | 163 | let entry = iter.get_entry(); |
167 | @@ -516,8 +576,17 @@ class ApplicationsButton extends PanelMenu.Button { | |
164 | @@ -517,8 +577,17 @@ | |
168 | 165 | this.applicationsByCategory[categoryId].push('separator'); |
169 | 166 | } else if (nextType === GMenu.TreeItemType.DIRECTORY) { |
170 | 167 | let subdir = iter.get_directory(); |
184 | 181 | } |
185 | 182 | } |
186 | 183 | } |
187 | @@ -538,8 +607,8 @@ class ApplicationsButton extends PanelMenu.Button { | |
184 | @@ -539,8 +608,8 @@ | |
188 | 185 | } |
189 | 186 | |
190 | 187 | scrollToCatButton(button) { |
195 | 192 | let currentScrollValue = catsScrollBoxAdj.get_value(); |
196 | 193 | let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1; |
197 | 194 | let buttonAlloc = button.get_allocation_box(); |
198 | @@ -555,8 +624,9 @@ class ApplicationsButton extends PanelMenu.Button { | |
195 | @@ -556,8 +625,9 @@ | |
199 | 196 | _createLayout() { |
200 | 197 | let section = new PopupMenu.PopupMenuSection(); |
201 | 198 | this.menu.addMenuItem(section); |
202 | - this.mainBox = new St.BoxLayout({ vertical: false }); | |
203 | - this.leftBox = new St.BoxLayout({ vertical: true }); | |
199 | - this.mainBox = new St.BoxLayout({vertical: false}); | |
200 | - this.leftBox = new St.BoxLayout({vertical: true}); | |
204 | 201 | + this.mainBox = new PopupMenu.PopupMenuSection(); |
205 | 202 | + this.mainBox.actor.vertical = false; |
206 | 203 | + this.leftBox = new PopupMenu.PopupMenuSection(); |
207 | 204 | this.applicationsScrollBox = new St.ScrollView({ |
208 | 205 | style_class: 'apps-menu vfade', |
209 | 206 | x_expand: true, |
210 | @@ -569,6 +639,7 @@ class ApplicationsButton extends PanelMenu.Button { | |
207 | @@ -570,6 +640,7 @@ | |
211 | 208 | vscroll.connect('scroll-stop', () => { |
212 | 209 | this.menu.passEvents = false; |
213 | 210 | }); |
215 | 212 | this.categoriesScrollBox = new St.ScrollView({ |
216 | 213 | style_class: 'vfade', |
217 | 214 | }); |
218 | @@ -577,9 +648,10 @@ class ApplicationsButton extends PanelMenu.Button { | |
215 | @@ -578,9 +649,10 @@ | |
219 | 216 | vscroll.connect('scroll-start', () => (this.menu.passEvents = true)); |
220 | 217 | vscroll.connect('scroll-stop', () => (this.menu.passEvents = false)); |
221 | 218 | this.leftBox.add_child(this.categoriesScrollBox); |
222 | 219 | - |
223 | 220 | +*/ |
224 | this.applicationsBox = new St.BoxLayout({ vertical: true }); | |
221 | this.applicationsBox = new St.BoxLayout({vertical: true}); | |
225 | 222 | this.applicationsScrollBox.add_actor(this.applicationsBox); |
226 | 223 | +/* |
227 | this.categoriesBox = new St.BoxLayout({ vertical: true }); | |
224 | this.categoriesBox = new St.BoxLayout({vertical: true}); | |
228 | 225 | this.categoriesScrollBox.add_actor(this.categoriesBox); |
229 | 226 | |
230 | @@ -587,19 +659,29 @@ class ApplicationsButton extends PanelMenu.Button { | |
227 | @@ -588,19 +660,29 @@ | |
231 | 228 | this.mainBox.add_child(this._createVertSeparator()); |
232 | 229 | this.mainBox.add_child(this.applicationsScrollBox); |
233 | 230 | section.actor.add_actor(this.mainBox); |
260 | 257 | let iter = root.iter(); |
261 | 258 | let nextType; |
262 | 259 | while ((nextType = iter.next()) !== GMenu.TreeItemType.INVALID) { |
263 | @@ -612,10 +694,13 @@ class ApplicationsButton extends PanelMenu.Button { | |
260 | @@ -613,10 +695,13 @@ | |
264 | 261 | |
265 | 262 | let categoryId = dir.get_menu_id(); |
266 | 263 | this.applicationsByCategory[categoryId] = []; |
278 | 275 | } |
279 | 276 | } |
280 | 277 | |
281 | @@ -624,9 +709,10 @@ class ApplicationsButton extends PanelMenu.Button { | |
278 | @@ -625,9 +710,10 @@ | |
282 | 279 | |
283 | 280 | let themeContext = St.ThemeContext.get_for_stage(global.stage); |
284 | 281 | let scaleFactor = themeContext.scale_factor; |