Beispiel #1
0
    private void _connect_to_dock()
    {
        DBus.BusG.Init();
        DBus.Bus bus = 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);
    }
Beispiel #2
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 ();
        }