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); }
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 (); }
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); } }