blob: d999360f85f8091c0b488c8ea02bc5e5317de7bb (
plain)
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
|
namespace Foo
{
using System;
using DBus;
using Gtk;
public class BusListener
{
static void OnNameOwnerChanged (string name,
string oldOwner,
string newOwner)
{
if (oldOwner == "")
Console.WriteLine ("{0} created by {1}",
name, newOwner);
else if (newOwner == "")
Console.WriteLine ("{0} released by {1}",
name, oldOwner);
else
Console.WriteLine ("{0} transfered from {1} to {2}",
name, oldOwner, newOwner);
}
public static int Main (string [] args)
{
Application.Init ();
Connection connection;
connection = Bus.GetSessionBus ();
BusDriver driver = BusDriver.New (connection);
driver.NameOwnerChanged += new NameOwnerChangedHandler (OnNameOwnerChanged);
Console.WriteLine ("Listening for name owner changes...");
Application.Run ();
return 0;
}
}
}
|