Пример #1
0
        public ObjectPath RegisterObject(string serviceName, object o, string objectName)
        {
            ObjectPath path = null;

            if (DBusConnection.Enabled && Bus.Session != null)
            {
                object [] attrs = o.GetType().GetCustomAttributes(typeof(DBusExportableAttribute), true);
                if (attrs != null && attrs.Length > 0)
                {
                    DBusExportableAttribute dbus_attr = (DBusExportableAttribute)attrs[0];
                    if (!String.IsNullOrEmpty(dbus_attr.ServiceName))
                    {
                        serviceName = dbus_attr.ServiceName;
                    }
                }

                lock (registered_objects) {
                    registered_objects.Add(o, path = new ObjectPath(objectName));
                }

                string bus_name = DBusConnection.MakeBusName(serviceName);

                Log.DebugFormat("Registering remote object {0} ({1}) on {2}", path, o.GetType(), bus_name);

                #pragma warning disable 0618
                Bus.Session.Register(bus_name, path, o);
                #pragma warning restore 0618
            }

            return(path);
        }
Пример #2
0
        public static void Run()
        {
#if WIN32
            // There are two sets of environement variables we need to impact with our LANG.
            // refer to : http://article.gmane.org/gmane.comp.gnu.mingw.user/8272
            var    lang_code = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
            string env       = String.Concat("LANG=", lang_code);
            Environment.SetEnvironmentVariable("LANG", lang_code);
            _putenv(env);
#endif

            Catalog.Init(Application.InternalName, System.IO.Path.Combine(
                             Hyena.Paths.InstalledApplicationDataRoot, "locale"));

            if (!DBusConnection.ConnectTried)
            {
                DBusConnection.Connect();
            }

            ServiceManager.Run();

            ServiceManager.SourceManager.AddSource(new MusicLibrarySource(), true);
            ServiceManager.SourceManager.AddSource(new VideoLibrarySource(), false);
            ServiceManager.SourceManager.LoadExtensionSources();
        }
Пример #3
0
        public static T FindInstance <T> (string serviceName, bool isFullBusName, string objectPath) where T : class
        {
            string busName = isFullBusName ? serviceName : DBusConnection.MakeBusName(serviceName);

            if (!DBusConnection.Enabled || !Bus.Session.NameHasOwner(busName))
            {
                return(null);
            }

            string full_object_path = objectPath;

            if (!objectPath.StartsWith(ObjectRoot))
            {
                full_object_path = ObjectRoot + objectPath;
            }

            return(Bus.Session.GetObject <T> (busName, new ObjectPath(full_object_path)));
        }
Пример #4
0
        public static void Run()
        {
            Banshee.Base.PlatformHacks.TrapMonoJitSegv();

            Catalog.Init(Application.InternalName, System.IO.Path.Combine(
                             Banshee.Base.Paths.InstalledApplicationDataRoot, "locale"));

            if (!DBusConnection.ConnectTried)
            {
                DBusConnection.Connect();
            }

            ServiceManager.Run();

            ServiceManager.SourceManager.AddSource(new MusicLibrarySource(), true);
            ServiceManager.SourceManager.AddSource(new VideoLibrarySource(), false);
            ServiceManager.SourceManager.LoadExtensionSources();

            Banshee.Base.PlatformHacks.RestoreMonoJitSegv();
        }