[gnome-documents/origin/wip/abono/sort-by: 2/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/origin/wip/abono/sort-by: 2/4] view: Update column for sorting when sort-by changes
- Date: Wed, 4 Nov 2015 11:34:03 +0000 (UTC)
commit 5cac68c507908dd8b99a2dab7541f6fbc281d962
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]