[gnome-shell/overview-relayout: 14/15] iconGrid: Add alignment parameter
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/overview-relayout: 14/15] iconGrid: Add alignment parameter
- Date: Thu, 14 Oct 2010 12:25:42 +0000 (UTC)
commit cac2d6c264e126cf9639e71ebe974173feb20579
Author: Florian Müllner <florian muellner gmail com>
Date: Thu Oct 14 13:10:47 2010 +0200
iconGrid: Add alignment parameter
Currently the grid's content is centered, which is not appropriate
for all use cases. Add an optional parameter to control the alignment.
js/ui/iconGrid.js | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 05abe1b..35704f4 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -135,9 +135,12 @@ function IconGrid(params) {
IconGrid.prototype = {
_init: function(params) {
- params = Params.parse(params, { rowLimit: null, columnLimit: null });
+ params = Params.parse(params, { rowLimit: null,
+ columnLimit: null,
+ xAlign: St.Align.MIDDLE });
this._rowLimit = params.rowLimit;
this._colLimit = params.columnLimit;
+ this._xAlign = params.xAlign;
this.actor = new St.BoxLayout({ style_class: 'icon-grid',
vertical: true });
@@ -189,7 +192,17 @@ IconGrid.prototype = {
let [nColumns, usedWidth] = this._computeLayout(availWidth);
- let overallPaddingX = Math.floor((availWidth - usedWidth) / 2);
+ let overallPaddingX;
+ switch(this._xAlign) {
+ case St.Align.START:
+ overallPaddingX = 0;
+ break;
+ case St.Align.MIDDLE:
+ overallPaddingX = Math.floor((availWidth - usedWidth) / 2);
+ break;
+ case St.Align.END:
+ overallPaddingX = availWidth - usedWidth;
+ }
let x = box.x1 + overallPaddingX;
let y = box.y1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]