4 | 4 |
|
5 | 5 |
--- a/extensions/apps-menu/extension.js
|
6 | 6 |
+++ b/extensions/apps-menu/extension.js
|
7 | |
@@ -92,10 +92,9 @@ const ApplicationMenuItem = new Lang.Cla
|
|
7 |
@@ -124,10 +124,9 @@ const ApplicationMenuItem = new Lang.Cla
|
8 | 8 |
|
9 | 9 |
const CategoryMenuItem = new Lang.Class({
|
10 | 10 |
Name: 'CategoryMenuItem',
|
|
16 | 16 |
this._category = category;
|
17 | 17 |
this._button = button;
|
18 | 18 |
|
19 | |
@@ -108,8 +107,121 @@ const CategoryMenuItem = new Lang.Class(
|
|
19 |
@@ -140,8 +139,121 @@ const CategoryMenuItem = new Lang.Class(
|
20 | 20 |
else
|
21 | 21 |
name = _("Favorites");
|
22 | 22 |
|
|
140 | 140 |
},
|
141 | 141 |
|
142 | 142 |
activate: function(event) {
|
143 | |
@@ -201,12 +313,29 @@ const CategoryMenuItem = new Lang.Class(
|
|
143 |
@@ -233,12 +345,29 @@ const CategoryMenuItem = new Lang.Class(
|
144 | 144 |
setActive: function(active, params) {
|
145 | 145 |
if (active) {
|
146 | 146 |
this._button.selectCategory(this._category, this);
|
|
171 | 171 |
const ApplicationsMenu = new Lang.Class({
|
172 | 172 |
Name: 'ApplicationsMenu',
|
173 | 173 |
Extends: PopupMenu.PopupMenu,
|
174 | |
@@ -292,7 +421,7 @@ const ApplicationsButton = new Lang.Clas
|
|
174 |
@@ -473,7 +602,7 @@ const ApplicationsButton = new Lang.Clas
|
175 | 175 |
this._installedChangedId = appSys.connect('installed-changed', Lang.bind(this, function() {
|
176 | 176 |
if (this.menu.isOpen) {
|
177 | 177 |
this._redisplay();
|
|
180 | 180 |
} else {
|
181 | 181 |
this.reloadFlag = true;
|
182 | 182 |
}
|
183 | |
@@ -371,7 +500,8 @@ const ApplicationsButton = new Lang.Clas
|
|
183 |
@@ -546,7 +675,8 @@ const ApplicationsButton = new Lang.Clas
|
184 | 184 |
this._redisplay();
|
185 | 185 |
this.reloadFlag = false;
|
186 | 186 |
}
|
|
190 | 190 |
}
|
191 | 191 |
this.parent(menu, open);
|
192 | 192 |
},
|
193 | |
@@ -387,11 +517,11 @@ const ApplicationsButton = new Lang.Clas
|
|
193 |
@@ -562,11 +692,11 @@ const ApplicationsButton = new Lang.Clas
|
194 | 194 |
|
195 | 195 |
_redisplay: function() {
|
196 | 196 |
this.applicationsBox.destroy_all_children();
|
|
204 | 204 |
let iter = dir.iter();
|
205 | 205 |
let nextType;
|
206 | 206 |
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
207 | |
@@ -406,12 +536,24 @@ const ApplicationsButton = new Lang.Clas
|
|
207 |
@@ -581,12 +711,24 @@ const ApplicationsButton = new Lang.Clas
|
208 | 208 |
let app = appSys.lookup_app(id);
|
209 | 209 |
if (!app)
|
210 | 210 |
app = new Shell.App({ app_info: entry.get_app_info() });
|
|
233 | 233 |
}
|
234 | 234 |
}
|
235 | 235 |
},
|
236 | |
@@ -432,8 +574,8 @@ const ApplicationsButton = new Lang.Clas
|
|
236 |
@@ -607,8 +749,8 @@ const ApplicationsButton = new Lang.Clas
|
237 | 237 |
},
|
238 | 238 |
|
239 | 239 |
scrollToCatButton: function(button) {
|
|
244 | 244 |
let currentScrollValue = catsScrollBoxAdj.get_value();
|
245 | 245 |
let boxHeight = catsScrollBoxAlloc.y2 - catsScrollBoxAlloc.y1;
|
246 | 246 |
let buttonAlloc = button.actor.get_allocation_box();
|
247 | |
@@ -447,10 +589,16 @@ const ApplicationsButton = new Lang.Clas
|
|
247 |
@@ -622,10 +764,16 @@ const ApplicationsButton = new Lang.Clas
|
248 | 248 |
},
|
249 | 249 |
|
250 | 250 |
_createLayout: function() {
|
|
263 | 263 |
this.applicationsScrollBox = new St.ScrollView({ x_fill: true, y_fill: false,
|
264 | 264 |
y_align: St.Align.START,
|
265 | 265 |
style_class: 'apps-menu vfade' });
|
266 | |
@@ -462,41 +610,55 @@ const ApplicationsButton = new Lang.Clas
|
|
266 |
@@ -637,41 +785,54 @@ const ApplicationsButton = new Lang.Clas
|
267 | 267 |
vscroll.connect('scroll-stop', Lang.bind(this, function() {
|
268 | 268 |
this.menu.passEvents = false;
|
269 | 269 |
}));
|
|
290 | 290 |
this.applicationsBox = new St.BoxLayout({ vertical: true });
|
291 | 291 |
this.applicationsScrollBox.add_actor(this.applicationsBox);
|
292 | 292 |
- this.categoriesBox = new St.BoxLayout({ vertical: true });
|
293 | |
- this.categoriesScrollBox.add_actor(this.categoriesBox, { expand: true, x_fill: false });
|
294 | |
|
|
293 |
- this.categoriesScrollBox.add_actor(this.categoriesBox);
|
|
294 |
-
|
295 | 295 |
- this.mainBox.add(this.leftBox);
|
296 | 296 |
- this.mainBox.add(this._createVertSeparator(), { expand: false, x_fill: false, y_fill: true});
|
297 | 297 |
- this.mainBox.add(this.applicationsScrollBox, { expand: true, x_fill: true, y_fill: true });
|
|
302 | 302 |
+ this.menu.passEvents = true;
|
303 | 303 |
+ }));
|
304 | 304 |
+ vscroll.connect('scroll-stop', Lang.bind(this, function() {
|
305 | |
+ this.menu.passEvents = false;
|
|
305 |
+ this.menu.passEvents = false;
|
306 | 306 |
+ }));
|
307 | 307 |
+ this.leftBox.addMenuItem(this.categoriesBox);
|
308 | 308 |
+ // FIXME we re-add it to apply the right properties, but re-adding
|
|
336 | 336 |
},
|
337 | 337 |
|
338 | 338 |
_display: function() {
|
339 | |
this._applicationsButtons = new Array();
|
|
339 |
this._applicationsButtons.clear();
|
340 | 340 |
- this.mainBox.style=('width: 35em;');
|
341 | 341 |
- this.mainBox.hide();
|
342 | 342 |
+ this.mainBox.actor.style=('width: 35em;');
|
|
344 | 344 |
|
345 | 345 |
//Load categories
|
346 | 346 |
this.applicationsByCategory = {};
|
347 | |
@@ -504,7 +666,7 @@ const ApplicationsButton = new Lang.Clas
|
|
347 |
@@ -679,7 +840,7 @@ const ApplicationsButton = new Lang.Clas
|
348 | 348 |
tree.load_sync();
|
349 | 349 |
let root = tree.get_root_directory();
|
350 | 350 |
let categoryMenuItem = new CategoryMenuItem(this, null);
|
|
353 | 353 |
let iter = root.iter();
|
354 | 354 |
let nextType;
|
355 | 355 |
while ((nextType = iter.next()) != GMenu.TreeItemType.INVALID) {
|
356 | |
@@ -513,10 +675,12 @@ const ApplicationsButton = new Lang.Clas
|
|
356 |
@@ -688,10 +849,12 @@ const ApplicationsButton = new Lang.Clas
|
357 | 357 |
if (!dir.get_is_nodisplay()) {
|
358 | 358 |
let categoryId = dir.get_menu_id();
|
359 | 359 |
this.applicationsByCategory[categoryId] = [];
|
|
370 | 370 |
}
|
371 | 371 |
}
|
372 | 372 |
}
|
373 | |
@@ -525,8 +689,9 @@ const ApplicationsButton = new Lang.Clas
|
|
373 |
@@ -700,8 +863,9 @@ const ApplicationsButton = new Lang.Clas
|
374 | 374 |
//Load applications
|
375 | 375 |
this._displayButtons(this._listApplications(null));
|
376 | 376 |
|