Question

I need to monitor multiple directories for changes. I'm using Gtk::Main, calling Gio::Init, and adding directory monitors exactly as the documentation suggests. However, the callback is never called, for any directory. Do I need another loop solely for the monitors, and if so, how would I use it in conjunction with Gtk::Main?

Was it helpful?

Solution

I had the same problem in Vala and here is the complete solution.

As pointed out by Andrea Azzarone, you can use the Gtk::Main loop.

However, pay attention to your Gio::FileMonitor reference. At the end of the function, it is destroyed so that the callback won't be called if you don't keep a reference to the Gio::FileMonitor object.

I found this idea in this answer.

OTHER TIPS

You can use just Gtk::Main loop because it is a Glib::MainLoop.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top