Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Namespace Members | Data Fields | Related Pages

BusListener.cs

00001 namespace Foo
00002 {
00003         using System;
00004         using DBus;
00005         using Gtk;
00006 
00007         public class BusListener
00008         {
00009 
00010                 static void OnNameOwnerChanged (string name,
00011                                                 string oldOwner,
00012                                                 string newOwner)
00013                 {
00014                         if (oldOwner == "")
00015                                 Console.WriteLine ("{0} created by {1}",
00016                                                    name, newOwner);
00017                         else if (newOwner == "")
00018                                 Console.WriteLine ("{0} released by {1}", 
00019                                                    name, oldOwner);
00020                         else
00021                                 Console.WriteLine ("{0} transfered from {1} to {2}",
00022                                                    name, oldOwner, newOwner);
00023                 }
00024 
00025                 public static int Main (string [] args)
00026                 {
00027                         Application.Init ();
00028 
00029                         Connection connection;
00030                         connection = Bus.GetSessionBus ();
00031 
00032                         BusDriver driver = BusDriver.New (connection);
00033                         driver.NameOwnerChanged += new NameOwnerChangedHandler (OnNameOwnerChanged);
00034 
00035                         Console.WriteLine ("Listening for name owner changes...");
00036 
00037                         Application.Run ();
00038 
00039                         return 0;
00040                 }
00041         }
00042 
00043         
00044 }

Generated on Tue Sep 13 01:28:06 2005 for D-BUS by  doxygen 1.4.4