summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2011-08-05 12:18:06 -0400
committerEitan Isaacson <eitan@monotonous.org>2011-08-12 09:19:40 +0200
commitcc324bf941b3856c90c0c42753433ab0ceb4bfa7 (patch)
tree0233db63e4d59cde1282f52bca87885011a3dfc8 /modules
parent25a00d8d94c2eb9dbd57b7837c24a6788ae742d7 (diff)
downloadcaribou-cc324bf941b3856c90c0c42753433ab0ceb4bfa7.tar.gz
Make "windows" a hash table rather than a list
And remove windows from it when they are destroyed
Diffstat (limited to 'modules')
-rw-r--r--modules/gtk3/caribou-gtk-module.vala9
1 files changed, 5 insertions, 4 deletions
diff --git a/modules/gtk3/caribou-gtk-module.vala b/modules/gtk3/caribou-gtk-module.vala
index c5e230d..46a76ce 100644
--- a/modules/gtk3/caribou-gtk-module.vala
+++ b/modules/gtk3/caribou-gtk-module.vala
@@ -10,11 +10,11 @@ namespace Caribou {
}
class GtkModule {
- private GLib.List<Gtk.Window> windows;
+ private GLib.HashTable<Gtk.Window, bool> windows;
private Keyboard keyboard;
public GtkModule () {
- windows = new GLib.List<Gtk.Window> ();
+ windows = new GLib.HashTable<Gtk.Window, bool> (null, null);
try {
keyboard = Bus.get_proxy_sync (BusType.SESSION,
"org.gnome.Caribou.Keyboard",
@@ -37,9 +37,10 @@ namespace Caribou {
toplevels = Gtk.Window.list_toplevels ();
foreach (Gtk.Window window in toplevels) {
- if (windows.find (window) == null) {
+ if (!windows.lookup (window)) {
window.notify["has-toplevel-focus"].connect (has_top_level_focus_changed);
- windows.append (window);
+ window.destroy.connect (() => { windows.remove (window); });
+ windows.insert (window, true);
}
}
}