PlacesManager: fix .gtk-bookmarks monitor scope

The GFileMonitor on ~/.gtk-bookmarks was block-scoped in the
PlacesManager._init() function, which caused it to be destroyed as soon
as the constructor was done. This caused changes in bookmarks to never
be notified to possible watchers (such as the places-menu extension).
To fix this, the 'monitor' variable has been promoted to an object
instance member.

https://bugzilla.gnome.org/show_bug.cgi?id=661921
This commit is contained in:
Stefan 'psYchotic' Zwanenburg 2011-10-16 18:30:13 +02:00 committed by Jasper St. Pierre
parent b07e45e214
commit 36eb745ecc

View File

@ -195,9 +195,9 @@ PlacesManager.prototype = {
this._bookmarksPath = GLib.build_filenamev([GLib.get_home_dir(), '.gtk-bookmarks']); this._bookmarksPath = GLib.build_filenamev([GLib.get_home_dir(), '.gtk-bookmarks']);
this._bookmarksFile = Gio.file_new_for_path(this._bookmarksPath); this._bookmarksFile = Gio.file_new_for_path(this._bookmarksPath);
let monitor = this._bookmarksFile.monitor_file(Gio.FileMonitorFlags.NONE, null); this._monitor = this._bookmarksFile.monitor_file(Gio.FileMonitorFlags.NONE, null);
this._bookmarkTimeoutId = 0; this._bookmarkTimeoutId = 0;
monitor.connect('changed', Lang.bind(this, function () { this._monitor.connect('changed', Lang.bind(this, function () {
if (this._bookmarkTimeoutId > 0) if (this._bookmarkTimeoutId > 0)
return; return;
/* Defensive event compression */ /* Defensive event compression */