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); }
public GenerationMenuWidget(Window parent, IElement referer, Bus bus, string busName) { if (referer.Data != null) { MenuItem path = new MenuItem("Call " + referer.Name + "..."); ObjectPath p = new ObjectPath(referer.Parent.Parent.Path); if (!referer.Data.IsProperty) { path.Activated += delegate { MethodInvokeDialog diag = new MethodInvokeDialog (parent, bus, busName, p, referer); while (diag.Run () == (int)ResponseType.None); diag.Destroy(); }; } else { path.Activated += delegate { PropertyInvokeDialog diag = new PropertyInvokeDialog (parent, bus, busName, p, referer); while (diag.Run () == (int)ResponseType.None); diag.Destroy(); }; } this.Append(path); path.ShowAll(); } }
public DBusExplorator(Bus bus) { this.bus = bus; ibus = this.bus.GetObject<IBus>(DBusName, DBusPath); SetupEvents (ibus); updater = GetElementsFromBus; }
public MethodCaller(Bus bus, string busName, ObjectPath path, string iname, string name, InvocationData data) : base(iname) { this.bus = bus; this.busName = busName; this.path = path; this.name = name; this.data = data; }
public PropertyInvokeDialog(Window parent, Bus bus, string busName, ObjectPath path, IElement element) : base(element.Name, parent, DialogFlags.DestroyWithParent | DialogFlags.Modal) { this.Build (); this.parent = parent; this.setAlign.HideAll (); this.WidthRequest = 250; this.HeightRequest = 150; this.propertyName.Text = element.Name; this.propertyType = Mapper.DTypeFromString (element.Data.ReturnType); try { this.caller = new PropertyCaller (bus, busName, path, element.Parent.Name, element.Name, element.Data); } catch (Exception e) { Logging.Error ("Error while creating the invocation proxy", e, parent); buttonExecute.Sensitive = false; } }
bool InitializePrivateBus (Bus bus) { if (bus.RequestName (BusName) != RequestNameReply.PrimaryOwner) { Log<DBusManager>.Error ("Bus Name '{0}' is already owned", BusName); return false; } docky = new DockyDBus (); docky.QuitCalled += HandleQuitCalled; docky.SettingsCalled += HandleSettingsCalled; docky.AboutCalled += HandleAboutCalled; ObjectPath dockyPath = new ObjectPath (DockyPath); bus.Register (dockyPath, docky); Log<DBusManager>.Debug ("DBus Registered: {0}", BusName); return true; }
public MethodInvokeDialog(Window parent, Bus bus, string busName, ObjectPath path, IElement element) : base(element.Name, parent, DialogFlags.DestroyWithParent | DialogFlags.Modal) { this.Build (); this.SetDefaultSize (-1, -1); this.methodName.Text = element.Name; this.parent = parent; this.TransientFor = parent; try { BuildInterface (element); caller = new MethodCaller(bus, busName, path, element.Parent.Name, element.Name, element.Data); } catch (Exception e) { Logging.Error ("Error while creating the invocation proxy", e, parent); buttonExecute.Sensitive = false; } this.ShowAll (); }
private void DBusLoop() { try { _system=Bus.System; } catch (Exception ex) { _startupException = ex; return; } finally { _started.Set(); } while (_run) { _system.Iterate(); } }
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 (); }
void InitializeSharedBus (Bus bus) { if (bus.RequestName (DockManagerBusName) != RequestNameReply.PrimaryOwner) { Log<DBusManager>.Warn ("Bus Name '{0}' is already owned", DockManagerBusName); return; } item_dict = new Dictionary<AbstractDockItem, DockManagerDBusItem> (); dock_manager = new DockManagerDBus (); ObjectPath dockPath = new ObjectPath (DockManagerPath); bus.Register (dockPath, dock_manager); Log<DBusManager>.Debug ("DBus Registered: {0}", DockManagerBusName); }