[gnome-shell-extensions/wip/fmuellner/misc-cleanups: 3/12] auto-move-windows: De-duplicate row appending
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions/wip/fmuellner/misc-cleanups: 3/12] auto-move-windows: De-duplicate row appending
- Date: Mon, 4 Mar 2019 18:37:04 +0000 (UTC)
commit 599428d29202792638707afedc864d23b2573bc7
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Mar 2 23:47:30 2019 +0100
auto-move-windows: De-duplicate row appending
https://gitlab.gnome.org/GNOME/gnome-shell-extensions/merge_requests/60
extensions/auto-move-windows/prefs.js | 35 +++++++++++++++--------------------
1 file changed, 15 insertions(+), 20 deletions(-)
---
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index f808347..5762809 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -164,16 +164,7 @@ const Widget = GObject.registerClass({
this._appendItem(appInfo.get_id(), index);
this._changedPermitted = true;
- let iter = this._store.append();
- let adj = new Gtk.Adjustment({
- lower: 1,
- upper: WORKSPACE_MAX,
- step_increment: 1,
- value: index
- });
- this._store.set(iter,
- [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE,
Columns.ADJUSTMENT],
- [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]);
+ this._appendRow(appInfo, index);
dialog.destroy();
});
@@ -223,22 +214,26 @@ const Widget = GObject.registerClass({
continue;
validItems.push(currentItems[i]);
- let iter = this._store.append();
- let adj = new Gtk.Adjustment({
- lower: 1,
- upper: WORKSPACE_MAX,
- step_increment: 1,
- value: index
- });
- this._store.set(iter,
- [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE,
Columns.ADJUSTMENT],
- [appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]);
+ this._appendRow(appInfo, parseInt(index));
}
if (validItems.length != currentItems.length) // some items were filtered out
this._settings.set_strv(SETTINGS_KEY, validItems);
}
+ _appendRow(appInfo, index) {
+ let iter = this._store.append();
+ let adj = new Gtk.Adjustment({
+ lower: 1,
+ upper: WORKSPACE_MAX,
+ step_increment: 1,
+ value: index
+ });
+ this._store.set(iter,
+ [Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE,
Columns.ADJUSTMENT],
+ [appInfo, appInfo.get_icon(), appInfo.get_display_name(), index, adj]);
+ }
+
_checkId(id) {
let items = this._settings.get_strv(SETTINGS_KEY);
return !items.some(i => i.startsWith(`${id}:`));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]