Esempio n. 1
0
    private void _connect_to_dock()
    {
        NDesk.DBus.BusG.Init();
        NDesk.DBus.Bus bus = NDesk.DBus.Bus.Session;
        this.icon                   = bus.GetObject <IApplet> ("org.cairodock.CairoDock", new ObjectPath(this.cBusPath));
        this.icon.on_click         += new OnClickEvent(on_click);
        this.icon.on_middle_click  += new OnMiddleClickEvent(on_middle_click);
        this.icon.on_scroll        += new OnScrollEvent(on_scroll);
        this.icon.on_build_menu    += new OnBuildMenuEvent(_on_build_menu);
        this.icon.on_menu_select   += new OnMenuSelectEvent(_on_menu_select);
        this.icon.on_drop_data     += new OnDropDataEvent(on_drop_data);
        this.icon.on_answer        += new OnAnswerEvent(on_answer);
        this.icon.on_answer_dialog += new OnAnswerDialogEvent(on_answer_dialog);
        this.icon._on_stop         += new OnStopModuleEvent(_on_stop);
        this.icon._on_reload       += new OnReloadModuleEvent(_on_reload);

        this.sub_icons = bus.GetObject <ISubApplet>("org.cairodock.CairoDock", new ObjectPath(this.cBusPath + "/sub_icons"));
        this.sub_icons.on_click_sub_icon        += new OnClickSubIconEvent(on_click_sub_icon);
        this.sub_icons.on_middle_click_sub_icon += new OnMiddleClickSubIconEvent(on_middle_click_sub_icon);
        this.sub_icons.on_scroll_sub_icon       += new OnScrollSubIconEvent(on_scroll_sub_icon);
        this.sub_icons.on_build_menu_sub_icon   += new OnBuildMenuSubIconEvent(_on_build_menu_sub_icon);
        this.sub_icons.on_menu_select_sub_icon  += new OnMenuSelectSubIconEvent(on_menu_select_sub_icon);
        this.sub_icons.on_drop_data_sub_icon    += new OnDropDataSubIconEvent(on_drop_data_sub_icon);
        this.sub_icons.on_answer_sub_icon       += new OnAnswerSubIconEvent(on_answer_sub_icon);
    }
Esempio n. 2
0
 public Presenterd(Settings settings, Bus bus)
 {
     currentSlide = Slide.UpcomingCompetitions;
     pausedFor = 0;
     this.settings = settings;
     this.bus = bus;
 }
Esempio n. 3
0
		//public static Connection Open (string address)
		public static new Bus Open (string address)
		{
			if (address == null)
				throw new ArgumentNullException ("address");

			if (buses.ContainsKey (address))
				return buses[address];

			Bus bus = new Bus (address);
			buses[address] = bus;

			return bus;
		}
Esempio n. 4
0
        internal Registry(bool startLoop)
            : base("org.a11y.atspi.Registry")
        {
            lock (sync) {
                if (instance != null)
                    throw new Exception ("Attempt to create a second registry");
                instance = this;
            }

            bus = GetAtspiBus ();
            if (bus == null)
                bus = Bus.Session;

            ObjectPath op = new ObjectPath ("/org/a11y/atspi/registry");
            proxy = Registry.Bus.GetObject<IRegistry> ("org.a11y.atspi.Registry", op);
            eventListeners = new Dictionary<string, int> ();
            RegisterEventListener ("Object:ChildrenChanged");
            RegisterEventListener ("Object:StateChanged");
            RegisterEventListener ("Object:PropertyChange");

            applications = new Dictionary<string, Application> ();
            applications [name] = this;
            desktop = new Desktop (this);
            applications [desktop.GetAlternateBusName ()] = this;
            accessibles [SPI_PATH_ROOT] = desktop;

            busProxy = Bus.GetObject<IBus> ("org.freedesktop.DBus", new ObjectPath ("/org/freedesktop/DBus"));

            PostInit ();
            desktop.PostInit ();

            if (DeviceEventController.Instance == null)
                new DeviceEventController ();

            if (startLoop && loopThread == null) {
                loopThread = new Thread (new ThreadStart (Iterate));
                loopThread.IsBackground = true;
                loopThread.Start ();
            }
        }
Esempio n. 5
0
        protected override void OnStart()
        {
            this.bus = Bus.Open("tcp:host=localhost,port=12345");
            //var bus = Bus.Open("win:path=dbus-session");
            var path = new ObjectPath("/org/mathias/xspservice");

            IXspService service;

            if (bus.RequestName(BusName) == RequestNameReply.PrimaryOwner)
            {
                this.port = 1254;
                this.websource = new XSPWebSource(IPAddress.Any, this.port);
                this.webAppServer = new ApplicationServer(this.websource);
                //this.webAppServer.AddApplicationsFromCommandLine(string.Format("localhost:{0}:{1}:{2}", port, "/", "Bundles/WebAspBundle"));
                this.webAppServer.Start(true);
                //create a new instance of the object to be exported
                bus.Register(path, this);

                //this.webAppServer.Start(true);
                this.listen = true;
                ThreadPool.QueueUserWorkItem((o) =>
                {
                    //run the main loop
                    while (true)
                    {
                        mutex.WaitOne();
                        try
                        {
                            if (!this.listen)
                                break;
                            bus.Iterate();
                        }
                        finally
                        {
                            mutex.ReleaseMutex();
                        }
                    }
                }, null);
            }
        }
Esempio n. 6
0
        public void DelayedInitialize ()
        {
            bus = Bus.Session;

            try {
                // Get the service and call a method on it to ensure that it is
                // running and able to answer queries.
                service = bus.GetObject<ITorrentService> (BusName, ServicePath);
                service.GetAvailableEngines ();
            } catch {
                // Try one more time
                try {
                    service = bus.GetObject<ITorrentService> (BusName, ServicePath);
                    service.GetAvailableEngines ();
                } catch {
                    Log.Error ("Torrent backend could not be found and could not be auto-started");
                    service = null;
                    return;
                }
            }

            // Register with Migo so we can handle .torrent downloads
            if (!RegisteredInMigo)
                Migo.DownloadCore.DownloadManager.Register ("torrent", typeof (TorrentFileDownloadTask));
            RegisteredInMigo = true;

            // Get the engine from DBus which we will use to download torrents with
            // and load the details for any existing downloads
            engine = bus.GetObject <IEngine> (BusName, service.GetEngine (EngineName));
            CheckExistingDownloads ();
        }
Esempio n. 7
0
        protected override void OnStop()
        {
            mutex.WaitOne();
            try
            {
                this.listen = false;
                this.bus.Close();
                this.bus = null;

                this.webAppServer.UnloadAll();
                this.webAppServer.Stop();
                this.webAppServer = null;

                this.websource.Dispose();
                this.websource = null;
            }
            finally
            {
                mutex.ReleaseMutex();
            }
        }
        private void createDBusLoopEvent(string activityId)
        {
            if (olpcDbusObj!=null) {
                return;
            }

            try {
                if (activityId==null || activityId.Trim().Length<1) {
                    activityId="123456789";
                }
                NDesk.DBus.BusG.Init ();

                bus = Bus.Session;

                bus_name = "org.laptop.Activity"+activityId;
                path = new ObjectPath ("/org/laptop/Activity/"+activityId);

                if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {

                    //create a new instance of the object to be exported
                    if (_window!=null) {
                        olpcDbusObj = new OlpcDBusObject (_window);
                    } else if (_activity != null) {
                        olpcDbusObj = new OlpcDBusObject (_activity);
                    }
                    bus.Register (path, olpcDbusObj);

                } else {
                    //import a remote to a local proxy
                    olpcDbusObj = bus.GetObject<OlpcDBusObject> (bus_name, path);
                }
            } catch (Exception ex) {

                System.Console.Out.WriteLine("Exception during the DBus Instance creation: "+ex.Message);
                System.Console.Out.WriteLine("Stack: "+ex.StackTrace);
            }
        }
        public DBusDatastore()
        {
            string activityId="";

            if (dataStoreInterfaceObj!=null) {
                return;
            }

            try {
                bus = Bus.Session;
                bus_name = "org.laptop.sugar.DataStore";
                path = new ObjectPath ("/org/laptop/sugar/DataStore");

                if (bus.RequestName (bus_name) == RequestNameReply.PrimaryOwner) {

                    System.Console.Out.WriteLine("Non found the service DataStore.");

                } else {
                    IBus ibus = bus.GetObject<IBus> (bus_name, path);

                    //import a remote to a local proxy
                    dataStoreInterfaceObj = bus.GetObject<DataStoreInterface> (bus_name, path);
                }
            } catch (Exception ex) {
                System.Console.Out.WriteLine("Exception during the DBus  Datastore Instance handling: "+ex.Message);
                System.Console.Out.WriteLine("Stack: "+ex.StackTrace);
            }
        }
Esempio n. 10
0
		public void Register (Bus bus)
		{
			this.bus = bus;
			bus.Register (new ObjectPath (DC.Constants.AutomationElementBasePath + pathId.ToString ()),
			              this);
		}
Esempio n. 11
0
		internal TextPatternWrapper (ITextProvider provider, Bus bus, string patternPath)
		{
			this.provider = provider;
			this.bus = bus;
			this.patternPath = patternPath;
		}