From 827a3365ca1d46b0ebfde1f4a1bfa204bde5260c Mon Sep 17 00:00:00 2001 From: Philip Langdale Date: Mon, 8 Jan 2018 19:59:27 -0800 Subject: [PATCH] prefs: Add prefs to toggle showing Trash and Mounted Volumes Make showing of these items optional. --- Settings.ui | 84 +++++++++++++++++++ dash.js | 9 +- docking.js | 12 +++ prefs.js | 8 ++ ....shell.extensions.dash-to-dock.gschema.xml | 10 +++ 5 files changed, 121 insertions(+), 2 deletions(-) diff --git a/Settings.ui b/Settings.ui index 9234877145..df21601212 100644 --- a/Settings.ui +++ b/Settings.ui @@ -1332,6 +1332,90 @@ + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + end + center + + + 1 + 0 + + + + + True + False + True + Show trash can + 0 + + + 0 + 0 + + + + + + + + + True + True + + + True + False + 12 + 12 + 12 + 12 + 32 + + + True + True + end + center + + + 1 + 0 + + + + + True + False + True + Show mounted volumes and devices + 0 + + + 0 + 0 + + + + + + diff --git a/dash.js b/dash.js index 9093dcadd9..e1c67cb122 100644 --- a/dash.js +++ b/dash.js @@ -762,8 +762,13 @@ var MyDash = new Lang.Class({ } } - Array.prototype.push.apply(newApps, this._removables.getApps()); - newApps.push(this._trash.getApp()); + if (this._dtdSettings.get_boolean('show-mounts')) { + Array.prototype.push.apply(newApps, this._removables.getApps()); + } + + if (this._dtdSettings.get_boolean('show-trash')) { + newApps.push(this._trash.getApp()); + } // Figure out the actual changes to the list of items; we iterate // over both the list of items currently in the dash and the list diff --git a/docking.js b/docking.js index 11810a1f32..0ba9a27e75 100644 --- a/docking.js +++ b/docking.js @@ -507,6 +507,18 @@ const DockedDash = new Lang.Class({ Lang.bind(this, function() { this.dash.resetAppIcons(); }) + ], [ + this._settings, + 'changed::show-trash', + Lang.bind(this, function() { + this.dash.resetAppIcons(); + }) + ], [ + this._settings, + 'changed::show-mounts', + Lang.bind(this, function() { + this.dash.resetAppIcons(); + }) ], [ this._settings, 'changed::show-running', diff --git a/prefs.js b/prefs.js index b595eacc2f..754d0e785f 100644 --- a/prefs.js +++ b/prefs.js @@ -348,6 +348,14 @@ const Settings = new Lang.Class({ this._builder.get_object('show_favorite_switch'), 'active', Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-trash', + this._builder.get_object('show_trash_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); + this._settings.bind('show-mounts', + this._builder.get_object('show_mounts_switch'), + 'active', + Gio.SettingsBindFlags.DEFAULT); this._settings.bind('show-show-apps-button', this._builder.get_object('show_applications_button_switch'), 'active', diff --git a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml index 709a6c3385..57d6df0a6d 100644 --- a/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml +++ b/schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml @@ -214,6 +214,16 @@ Show favorites apps Show or hide favorite appplications icons in the dash + + true + Show trash can + Show or hide the trash can icon in the dash + + + true + Show mounted volumes and devices + Show or hide mounted volume and device icons in the dash + true Show applications button