[gnome-shell-extensions] workspace-indicator: Tweak prefs UI



commit de7fbe5b7d0cb509f0da3340f487ffd4bbe65f6d
Author: Florian Müllner <fmuellner gnome org>
Date:   Tue May 27 04:34:10 2014 +0200

    workspace-indicator: Tweak prefs UI
    
     - make tree view scrollable when list grows large
     - add some borders
     - use symbolic icons instead of (deprecated) stock items
     - adjust spacing/alignment
     - disable remove button when no item is selected
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730843

 extensions/workspace-indicator/prefs.js |   26 +++++++++++++++++++-------
 1 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js
index edef6d7..1458740 100644
--- a/extensions/workspace-indicator/prefs.js
+++ b/extensions/workspace-indicator/prefs.js
@@ -135,11 +135,16 @@ const WorkspaceSettingsWidget = new GObject.Class({
 
     _init: function(params) {
         this.parent(params);
-        this.margin = 10;
+        this.margin = 12;
         this.orientation = Gtk.Orientation.VERTICAL;
 
-        this.add(new Gtk.Label({ label: _("Workspace names:"),
-                                 margin_bottom: 5 }));
+        this.add(new Gtk.Label({ label: '<b>' + _("Workspace Names") + '</b>',
+                                 use_markup: true, margin_bottom: 6,
+                                 hexpand: true, halign: Gtk.Align.START }));
+
+        let scrolled = new Gtk.ScrolledWindow({ shadow_type: Gtk.ShadowType.IN });
+        scrolled.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
+        this.add(scrolled);
 
         this._store = new WorkspaceNameModel();
         this._treeView = new Gtk.TreeView({ model: this._store,
@@ -156,19 +161,26 @@ const WorkspaceSettingsWidget = new GObject.Class({
         column.add_attribute(renderer, 'text', this._store.Columns.LABEL);
         this._treeView.append_column(column);
 
-        this.add(this._treeView);
+        scrolled.add(this._treeView);
 
-        let toolbar = new Gtk.Toolbar();
+        let toolbar = new Gtk.Toolbar({ icon_size: Gtk.IconSize.SMALL_TOOLBAR });
         toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR);
 
-        let newButton = new Gtk.ToolButton({ stock_id: Gtk.STOCK_NEW });
+        let newButton = new Gtk.ToolButton({ icon_name: 'list-add-symbolic' });
         newButton.connect('clicked', Lang.bind(this, this._newClicked));
         toolbar.add(newButton);
 
-        let delButton = new Gtk.ToolButton({ stock_id: Gtk.STOCK_DELETE });
+        let delButton = new Gtk.ToolButton({ icon_name: 'list-remove-symbolic' });
         delButton.connect('clicked', Lang.bind(this, this._delClicked));
         toolbar.add(delButton);
 
+        let selection = this._treeView.get_selection();
+        selection.connect('changed',
+            function() {
+                delButton.sensitive = selection.count_selected_rows() > 0;
+            });
+        delButton.sensitive = selection.count_selected_rows() > 0;
+
         this.add(toolbar);
     },
 


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