Skip to content

Commit

Permalink
prefs: Add prefs to toggle showing Trash and Mounted Volumes
Browse files Browse the repository at this point in the history
Make showing of these items optional.
  • Loading branch information
philipl committed Mar 21, 2018
1 parent 770feb8 commit 827a336
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 2 deletions.
84 changes: 84 additions & 0 deletions Settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1332,6 +1332,90 @@
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow18">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="shrink_dash4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkSwitch" id="show_trash_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="shrink_dash_label4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Show trash can</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow" id="listboxrow19">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid" id="shrink_dash5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<property name="column_spacing">32</property>
<child>
<object class="GtkSwitch" id="show_mounts_switch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="shrink_dash_label5">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">Show mounted volumes and devices</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child type="label_item">
Expand Down
9 changes: 7 additions & 2 deletions dash.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions docking.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
8 changes: 8 additions & 0 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 10 additions & 0 deletions schemas/org.gnome.shell.extensions.dash-to-dock.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@
<summary>Show favorites apps</summary>
<description>Show or hide favorite appplications icons in the dash</description>
</key>
<key type="b" name="show-trash">
<default>true</default>
<summary>Show trash can</summary>
<description>Show or hide the trash can icon in the dash</description>
</key>
<key type="b" name="show-mounts">
<default>true</default>
<summary>Show mounted volumes and devices</summary>
<description>Show or hide mounted volume and device icons in the dash</description>
</key>
<key type="b" name="show-show-apps-button">
<default>true</default>
<summary>Show applications button</summary>
Expand Down

0 comments on commit 827a336

Please sign in to comment.