[gnome-characters: 1/5] Adds remembering the previously selected row and capability to restore that selection.



commit 411777c4ca656450d3db0f35cb8a549d4d14f276
Author: Paul Court <g rgoyle com>
Date:   Wed Jul 24 11:26:12 2019 +0100

    Adds remembering the previously selected row and capability to restore that selection.

 src/categoryList.js | 11 +++++++++++
 1 file changed, 11 insertions(+)
---
diff --git a/src/categoryList.js b/src/categoryList.js
index d3e9b16..acc119d 100644
--- a/src/categoryList.js
+++ b/src/categoryList.js
@@ -195,6 +195,7 @@ const CategoryListWidget = GObject.registerClass({
 
         this._categoryList = filtered.categoryList;
         this.populateCategoryList();
+        this._lastSelectedRow = null;
 
         for (let index in this._categoryList) {
             let category = this._categoryList[index];
@@ -205,6 +206,10 @@ const CategoryListWidget = GObject.registerClass({
     }
 
     vfunc_row_selected(row) {
+        if (row !== null) {
+            this._lastSelectedRow = row;
+        }
+
         if (row != null && row.selectable) {
             let toplevel = row.get_toplevel();
             let action = toplevel.lookup_action(row.category.action_name);
@@ -212,6 +217,12 @@ const CategoryListWidget = GObject.registerClass({
         }
     }
 
+    restorePreviousSelection() {
+        if (this._lastSelectedRow !== null) {
+            this.select_row(this._lastSelectedRow);
+        }
+    }
+
     populateCategoryList() {
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]