File: TestMonitor.cs

package info (click to toggle)
gtk-sharp2 2.8.3-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 21,208 kB
  • ctags: 5,843
  • sloc: xml: 245,420; cs: 24,183; sh: 8,547; ansic: 2,739; makefile: 1,582; perl: 1,177
file content (51 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using GLib;
using Gnome.Vfs;
using System;
using System.Text;

namespace TestGnomeVfs {
	public class TestMonitor {
		static void Main (string[] args)
		{
			if (args.Length != 1) {
				Console.WriteLine ("Usage: TestMonitor <uri>");
				return;
			}
		
			Gnome.Vfs.Vfs.Initialize ();

			Monitor monitor = new Monitor ();
			monitor.Changed += OnChanged;
			monitor.Deleted += OnDeleted;
			monitor.Created += OnCreated;
			monitor.MetadataChanged += OnMetadataChanged;
			
			monitor.Add (args[0], MonitorType.Directory);
			monitor.Add ("/tmp", MonitorType.Directory);
			
			new MainLoop ().Run ();
			
			Gnome.Vfs.Vfs.Shutdown ();
		}
		
		public static void OnChanged (string monitor, string uri)
		{
			Console.WriteLine ("Uri changed: {0}", uri);
		}
		
		public static void OnDeleted (string monitor, string uri)
		{
			Console.WriteLine ("Uri deleted: {0}", uri);
		}
		
		public static void OnCreated (string monitor, string uri)
		{
			Console.WriteLine ("Uri created: {0}", uri);
		}
		
		public static void OnMetadataChanged (string monitor, string uri)
		{
			Console.WriteLine ("Uri metadata changed: {0}", uri);
		}
	}
}