/// <summary> /// Private static method to get an existing /// telepathy connection, if one exists /// </summary> private static IConnection GetExistingConnection(string tpManager, string accountName) { Logger.Debug("GetExistingConnection - called"); // Existing gabble connection IConnection conn = null; try { ObjectPath opath = new ObjectPath("/org/freedesktop/DBus"); string name = "org.freedesktop.DBus"; string gabbleConnectionName = "org.freedesktop.telepathy.connection.gabble.jabber"; org.freedesktop.DBus.IBus bus = Bus.Session.GetObject <org.freedesktop.DBus.IBus> (name, opath); string[] busnames = bus.ListNames(); foreach (string busname in busnames) { if (busname.ToLower().StartsWith(gabbleConnectionName) == true) { string gpath = "/" + busname.Replace('.', '/'); conn = Bus.Session.GetObject <IConnection> ( busname, new ObjectPath(gpath)); break; } } } catch {} return(conn); }
/// <summary> /// Initializes the backend /// </summary> public void Initialize() { BusG.Init(); // Watch the session bus for when ICEcore Daemon comes or goes. // When it comes, attempt to connect to it. sessionBus = Bus.Session.GetObject <org.freedesktop.DBus.IBus> ( "org.freedesktop.DBus", new ObjectPath("/org/freedesktop/DBus")); sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged; // Force the daemon to start up if it's not already running if (!Bus.Session.NameHasOwner(DaemonNamespace)) { Bus.Session.StartServiceByName(DaemonNamespace); } // Register for ICEcore Daemon's events ConnectToICEcoreDaemon(); // // Add in the AllCategory // AllCategory allCategory = new AllCategory(); Gtk.TreeIter iter = categories.Append(); categories.SetValue(iter, 0, allCategory); // Populate the models Refresh(); initialized = true; if (BackendInitialized != null) { try { BackendInitialized(); } catch (Exception e) { Logger.Debug("Exception in IceBackend.BackendInitialized handler: {0}", e.Message); } } }
/// <summary> /// Initializes the backend /// </summary> public void Initialize() { BusG.Init (); // Watch the session bus for when ICEcore Daemon comes or goes. // When it comes, attempt to connect to it. sessionBus = Bus.Session.GetObject<org.freedesktop.DBus.IBus> ( "org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus")); sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged; // Force the daemon to start up if it's not already running if (!Bus.Session.NameHasOwner (DaemonNamespace)) { Bus.Session.StartServiceByName (DaemonNamespace); } // Register for ICEcore Daemon's events ConnectToICEcoreDaemon (); // // Add in the AllCategory // AllCategory allCategory = new AllCategory (); Gtk.TreeIter iter = categories.Append (); categories.SetValue (iter, 0, allCategory); // Populate the models Refresh (); initialized = true; if (BackendInitialized != null) { try { BackendInitialized (); } catch (Exception e) { Logger.Debug ("Exception in IceBackend.BackendInitialized handler: {0}", e.Message); } } }
static SpDBus() { org.freedesktop.DBus.IBus sessionBus = Bus.Session.GetObject <org.freedesktop.DBus.IBus>( "org.freedesktop.DBus", new ObjectPath("/org/freedesktop/DBus")); sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged; }
static TomboyDBus() { // Listen for coming/going of Tomboy service org.freedesktop.DBus.IBus sessionBus = Bus.Session.GetObject <org.freedesktop.DBus.IBus> ("org.freedesktop.DBus", new ObjectPath("/org/freedesktop/DBus")); sessionBus.NameOwnerChanged += OnDBusNameOwnerChanged; }