[gnome-shell-extensions/wip/window-list: 2/7] window-list: Shrink window buttons if running out of space



commit 124e161cfb0e0ec9358064d4a8ae5432c22d61af
Author: Florian MÃllner <fmuellner gnome org>
Date:   Wed Jan 23 21:04:52 2013 +0100

    window-list: Shrink window buttons if running out of space

 extensions/window-list/extension.js   |   23 ++++++++++++++++++-----
 extensions/window-list/stylesheet.css |    2 +-
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/extensions/window-list/extension.js b/extensions/window-list/extension.js
index d6e7b39..df0c5b6 100644
--- a/extensions/window-list/extension.js
+++ b/extensions/window-list/extension.js
@@ -26,6 +26,7 @@ const WindowButton = new Lang.Class({
 
         let box = new St.BoxLayout();
         this.actor = new St.Button({ style_class: 'window-button',
+                                     x_fill: true,
                                      child: box });
         this.actor._delegate = this;
 
@@ -181,12 +182,21 @@ const WindowList = new Lang.Class({
                                      layout_manager: new Clutter.BinLayout()});
         this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
 
-        this._windowList = new St.BoxLayout({ style_class: 'window-list',
-                                              x_align: Clutter.ActorAlign.START,
-                                              x_expand: true,
-                                              y_expand: true });
+        let layout = new Clutter.BoxLayout({ homogeneous: true });
+        this._windowList = new St.Widget({ style_class: 'window-list',
+                                           layout_manager: layout,
+                                           x_align: Clutter.ActorAlign.START,
+                                           x_expand: true,
+                                           y_expand: true });
         this.actor.add_actor(this._windowList);
 
+        this._windowList.connect('style-changed', Lang.bind(this,
+            function() {
+                let node = this._windowList.get_theme_node();
+                let spacing = node.get_length('spacing');
+                this._windowList.layout_manager.spacing = spacing;
+            }));
+
         this._trayButton = new TrayButton();
         this.actor.add_actor(this._trayButton.actor);
 
@@ -248,7 +258,10 @@ const WindowList = new Lang.Class({
             return;
 
         let button = new WindowButton(win);
-        this._windowList.add(button.actor, { y_fill: true });
+        this._windowList.layout_manager.pack(button.actor,
+                                             true, true, true,
+                                             Clutter.BoxAlignment.START,
+                                             Clutter.BoxAlignment.START);
     },
 
     _onWindowRemoved: function(ws, win) {
diff --git a/extensions/window-list/stylesheet.css b/extensions/window-list/stylesheet.css
index 8802778..ba9824e 100644
--- a/extensions/window-list/stylesheet.css
+++ b/extensions/window-list/stylesheet.css
@@ -23,7 +23,7 @@
 }
 
 .window-button > StWidget {
-  width: 250px;
+  max-width: 250px;
   color: #bbb;
   background-color: black;
   border-radius: 4px;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]