From de7fbe5b7d0cb509f0da3340f487ffd4bbe65f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 27 May 2014 04:34:10 +0200 Subject: [PATCH] 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 file changed, 19 insertions(+), 7 deletions(-) diff --git a/extensions/workspace-indicator/prefs.js b/extensions/workspace-indicator/prefs.js index edef6d74..1458740c 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: '' + _("Workspace Names") + '', + 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); },