/* * Copyright (C) 2004 Sergio Rubio * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ // TODO: Can DBusService inherit from DBus.Service? using System; using NDesk.DBus; using org.freedesktop.DBus; namespace Muine { public sealed class DBusService { // Static // Static :: Objects private static DBusService instance; // Static :: Properties // Static :: Properties :: Instance (get;) /// /// Retreives a new or existing . /// /// /// This only allows a single /// to exist for Muine. /// /// /// A . /// public static DBusService Instance { get { if (instance == null) instance = new DBusService (); return instance; } } // Constructor /// /// Create a new . /// /// /// /// The property should be used /// instead of this constructor to ensure that only one /// exists for Muine. /// /// /// /// The name of the is "org.gnome.Muine". /// /// private DBusService () { try { // XXX: Check the result of requesting the name. Bus.Session.RequestName("org.gnome.Muine"); } catch { } } // Methods // Methods :: Public // Methods :: Public :: RegisterObject /// /// Registers an object with DBus. /// /// /// This just invokes /// for the service. /// /// /// The to register. /// /// /// The path to register the object at. /// public void RegisterObject (object obj, string path) { Bus.Session.Register ("/org/gnome/Muine/", new ObjectPath (path), obj); } } }