我正在尝试将budgie-trash python applet转换为Vala,并且正在尝试根据Vala documentation监视“ trash:///”目录,以便可以正确监视房屋。但我无法监视“垃圾箱:///”。 python applet可以在所有目录下正常工作。
public void initialiseTrashFileMonitor(){
try {
GLib.File file = GLib.File.new_for_uri("trash:///");
GLib.FileMonitor monitor = file.monitor_directory(0, null);
print ("\n initialiseTrashFileMonitor Monitoring: %s\n", file.get_path ());
monitor.changed.connect ((src, dest, event) => {
print ("\n initialiseTrashFileMonitor monitor.changed.connect \n");
if (dest != null) {
print ("%s: %s, %s\n", event.to_string (), src.get_path (), dest.get_path ());
} else {
print ("%s: %s\n", event.to_string (), src.get_path ());
}
});
} catch (Error err) {
print ("\n initialiseTrashFileMonitor Error: %s\n", err.message);
}
}
initialiseTrashFileMonitor Monitoring: (null)
我也为此在这里提出了一个问题:How can I monitor the ~/.local directory using Vala?