[gnome-documents/wip/abono/sort-by: 3/4] view: Update column for sorting when sort-by changes
- From: Alessandro Bono <abono src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/wip/abono/sort-by: 3/4] view: Update column for sorting when sort-by changes
- Date: Tue, 20 Oct 2015 17:42:41 +0000 (UTC)
commit 5718580471f2ae5ede603888b56d42fa756140ce
Author: Alessandro Bono <shadow openaliasbox org>
Date: Thu Oct 15 22:45:38 2015 +0200
view: Update column for sorting when sort-by changes
Update the column of the overview's model for sorting when the state of the sort-by action changes.
src/view.js | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 54c7683..969ee8e 100644
--- a/src/view.js
+++ b/src/view.js
@@ -81,8 +81,6 @@ const ViewModel = new Lang.Class({
GObject.TYPE_LONG,
GObject.TYPE_BOOLEAN,
GObject.TYPE_UINT ]);
- this.set_sort_column_id(Gd.MainColumns.MTIME,
- Gtk.SortType.DESCENDING);
this._infoUpdatedIds = {};
this._resetCountId = 0;
@@ -360,6 +358,10 @@ const ViewContainer = new Lang.Class({
Lang.bind(this, this._updateTypeForSettings));
this._updateTypeForSettings();
+ this._sortSettingsId = Application.application.connect('action-state-changed::sort-by',
+ Lang.bind(this, this._updateSortForSettings));
+ this._updateSortForSettings();
+
// setup selection controller => view
Application.selectionController.connect('selection-mode-changed',
Lang.bind(this, this._onSelectionModeChanged));
@@ -418,6 +420,14 @@ const ViewContainer = new Lang.Class({
this._addListRenderers();
},
+ _updateSortForSettings: function() {
+ let sortColumn = Application.settings.get_enum('sort-by');
+ let sortType = sortColumn != Gd.MainColumns.MTIME ?
+ Gtk.SortType.ASCENDING : Gtk.SortType.DESCENDING;
+
+ this._model.set_sort_column_id(sortColumn, sortType);
+ },
+
activateResult: function() {
let doc = this._getFirstDocument();
if (doc)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]