[gnome-shell-extensions] auto-move-windows/prefs: filter out apps that don't exist
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell-extensions] auto-move-windows/prefs: filter out apps that don't exist
- Date: Sun, 29 Apr 2012 19:13:46 +0000 (UTC)
commit f77bf60bcba745e1615a0644fda12ac47aa1ee41
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sun Apr 29 21:11:00 2012 +0200
auto-move-windows/prefs: filter out apps that don't exist
Recognize if the desktop file no longer exists and remove its
entry in GSettings, instead of crashing because of a null GAppInfo.
extensions/auto-move-windows/prefs.js | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/extensions/auto-move-windows/prefs.js b/extensions/auto-move-windows/prefs.js
index 6f525f3..9662993 100644
--- a/extensions/auto-move-windows/prefs.js
+++ b/extensions/auto-move-windows/prefs.js
@@ -183,9 +183,13 @@ const Widget = new GObject.Class({
this._store.clear();
let currentItems = this._settings.get_strv(SETTINGS_KEY);
+ let validItems = [ ];
for (let i = 0; i < currentItems.length; i++) {
let [id, index] = currentItems[i].split(':');
let appInfo = Gio.DesktopAppInfo.new(id);
+ if (!appInfo)
+ continue;
+ validItems.push(currentItems[i]);
let iter = this._store.append();
let adj = new Gtk.Adjustment({ lower: 1,
@@ -196,6 +200,9 @@ const Widget = new GObject.Class({
[Columns.APPINFO, Columns.ICON, Columns.DISPLAY_NAME, Columns.WORKSPACE, Columns.ADJUSTMENT],
[appInfo, appInfo.get_icon(), appInfo.get_display_name(), parseInt(index), adj]);
}
+
+ if (validItems.length != currentItems.length) // some items were filtered out
+ this._settings.set_strv(SETTINGS_KEY, validItems);
},
_appendItem: function(id, workspace) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]