appDisplay: make the categories list scrollable, if necessary
https://bugzilla.gnome.org/show_bug.cgi?id=651082
This commit is contained in:
parent
3e74dfb66d
commit
6d5e414863
@ -172,10 +172,12 @@ ViewByCategories.prototype = {
|
|||||||
// (used only before the actor is mapped the first time)
|
// (used only before the actor is mapped the first time)
|
||||||
this._currentCategory = -2;
|
this._currentCategory = -2;
|
||||||
this._filters = new St.BoxLayout({ vertical: true, reactive: true });
|
this._filters = new St.BoxLayout({ vertical: true, reactive: true });
|
||||||
this._filters.connect('scroll-event', Lang.bind(this, this._scrollFilter));
|
this._filtersBox = new St.ScrollView({ x_fill: false,
|
||||||
|
y_fill: false,
|
||||||
|
style_class: 'vfade' });
|
||||||
|
this._filtersBox.add_actor(this._filters);
|
||||||
this.actor.add(this._view.actor, { expand: true, x_fill: true, y_fill: true });
|
this.actor.add(this._view.actor, { expand: true, x_fill: true, y_fill: true });
|
||||||
this.actor.add(this._filters, { expand: false, y_fill: false, y_align: St.Align.START });
|
this.actor.add(this._filtersBox, { expand: false, y_fill: false, y_align: St.Align.START });
|
||||||
|
|
||||||
// Always select the "All" filter when switching to the app view
|
// Always select the "All" filter when switching to the app view
|
||||||
this.actor.connect('notify::mapped', Lang.bind(this,
|
this.actor.connect('notify::mapped', Lang.bind(this,
|
||||||
@ -193,14 +195,6 @@ ViewByCategories.prototype = {
|
|||||||
this.actor.add(this._focusDummy);
|
this.actor.add(this._focusDummy);
|
||||||
},
|
},
|
||||||
|
|
||||||
_scrollFilter: function(actor, event) {
|
|
||||||
let direction = event.get_scroll_direction();
|
|
||||||
if (direction == Clutter.ScrollDirection.UP)
|
|
||||||
this._selectCategory(Math.max(this._currentCategory - 1, -1))
|
|
||||||
else if (direction == Clutter.ScrollDirection.DOWN)
|
|
||||||
this._selectCategory(Math.min(this._currentCategory + 1, this._sections.length - 1));
|
|
||||||
},
|
|
||||||
|
|
||||||
_selectCategory: function(num) {
|
_selectCategory: function(num) {
|
||||||
if (this._currentCategory == num) // nothing to do
|
if (this._currentCategory == num) // nothing to do
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user