Export to GitHub

nautilussvn - issue #20

Use gio.GFileMonitor for watching file changes


Posted on Jan 4, 2009 by Grumpy Dog

using gio.GFileMonitor for monitoring file changes rather than pyinotify will help make nautilussvn platform independent. The gio module appears to be present in pygobject 2.15 en up, so fairly recent bindings are required (e.g. my Hardy install only has pygobject 2.12 by default)

Comment #1

Posted on Jan 4, 2009 by Helpful Giraffe

(No comment was entered for this change.)

Comment #2

Posted on Feb 23, 2009 by Happy Elephant

gio lib, works only for gtk right?

And about FAM (File Alteration Monitor),
would not be a better choice?

Nautilus use it.

Comment #3

Posted on Mar 14, 2009 by Helpful Giraffe

(No comment was entered for this change.)

Comment #4

Posted on Apr 17, 2009 by Helpful Giraffe

gio is a better choice to use. crdlb on #pygtk also confirmed

Comment #5

Posted on May 9, 2009 by Helpful Giraffe

@mchiareli: I didn't initially comment because I wasn't sure though I already knew FAM wasn't the way to go (long dead), Vladimuses is right, gio is the way to go. Nautilus actually uses gio.GFileMonitor too, see nautilus-monitor.c:

file = g_file_new_for_path (g_get_home_dir ()); dir_monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);

And it's incredibly easy to use so I am going to use it as I'm already majorly refactoring NautilusSvn to use anyvc (for all VCS support) and to have a useful status monitor. Here's how GFileMonitor works:

import gio import gobject

file = gio.File("/home/bruce/Temporary/nautilussvn_tests/working_copy") monitor = file.monitor_directory()

def handler(monitor, file, other_file, event_type): print file, event_type

monitor.connect("changed", handler)

main_loop = gobject.MainLoop() main_loop.run()

Results:

Creation:

Deletion:

Modification:

Comment #6

Posted on May 10, 2009 by Helpful Giraffe

I've basically completed the work for this in the status_monitor_reincarnation branch.

See:

http://code.google.com/p/nautilussvn/source/browse/branches/status_monitor_reincarnation/nautilussvn/extension/nautilus/NautilusSvn.py

Comment #7

Posted on May 10, 2009 by Helpful Giraffe

Reopening. Note to self: update dependencies in control file for Debian package.

Comment #8

Posted on Sep 7, 2009 by Swift Monkey

I'd just like to ping this - is the GIO stuff still in a branch somewhere?

Comment #9

Posted on Sep 7, 2009 by Helpful Giraffe

Yeah it's in status_monitor_reincarnation:

http://code.google.com/p/nautilussvn/source/browse/branches/status_monitor_reincarnation/nautilussvn/statusmonitor.py

Comment #10

Posted on Sep 23, 2009 by Helpful Giraffe

(No comment was entered for this change.)

Comment #11

Posted on Sep 28, 2009 by Helpful Giraffe

The NautilusSVN project has been renamed to RabbitVCS, all issues have been moved to our new issue tracker. You can access the issue tracker here:

http://code.google.com/p/rabbitvcs/issues/list

Closing all open bugs.

Status: Moved

Labels:
Type-Enhancement Priority-Medium Milestone-Release0.13 Component-StatusMonitor