我在gnome shell上遇到d-bus的问题,我正在尝试通过带有javascript的消息dbus管理截屏视频,这是一个代码:`
this.gdbusConnection = Gio.bus_get_sync(Gio.BusType.SESSION, null);
this.gdbusProxy = new Gio.DBusProxy({g_connection: this.gdbusConnection,
g_flags: Gio.DBusProxyFlags.NONE ,
g_interface_name: "org.gnome.Shell.Screencast",
g_name: "org.gnome.Shell.Screencast",
g_object_path: "/org/gnome/Shell/Screencast"});
this.gdbusProxy.call("org.gnome.Shell.Screencast.Screencast", null, Gio.DBusCallFlags.NONE, -1, null, this._doExtensionPreferences, null);`
当我执行此代码时,我在dbus监视器中看到了这一点:
~$ dbus-monitor "interface=org.gnome.Shell.Screencast"
signal sender=org.freedesktop.DBus -> dest=:1.103 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.103"
method call sender=:1.19 -> dest=org.gnome.Shell.Screencast serial=495 path=/org/gnome/Shell/Screencast; interface=org.gnome.Shell.Screencast; member=Screencast
method call sender=:1.19 -> dest=org.gnome.Shell.Screencast serial=500 path=/org/gnome/Shell/Screencast; interface=org.gnome.Shell.Screencast; member=StopScreencast
我认为问题是发件人,因为如果我在dbus监视器中以传统方式启动sceencast被称为相同功能但发送者不同,您有什么建议吗?
method call sender=:1.6 -> dest=:1.19 serial=228 path=/org/gnome/Shell/Screencast; interface=org.gnome.Shell.Screencast; member=Screencast
string "Screencast da %d %t.webm"
array [
]
method call sender=:1.6 -> dest=:1.19 serial=229 path=/org/gnome/Shell/Screencast; interface=org.gnome.Shell.Screencast; member=StopScreencast
编辑:这是严格的代码。
const MyProxy = Gio.DBusProxy.makeProxyWrapper(LibRecorder.ScreencastIface);
this.instance = new MyProxy(Gio.DBus.session, 'org.gnome.Shell.Screencast','/org/gnome/Shel/Screencast'
, Lang.bind(this, function(proxy, error) {
if (error) {
log(error.message);
return;
} else
Lib.TalkativeLog('ESC > d-bus proy connected');
}));
this.instance.ScreencastRemote("test_proxy_ %d_ %t.webm", null, Lang.bind(this, function(result, error) {
if (error) {
log(error.message);
return;
} else
Lib.TalkativeLog('ESC > screencast execute - '+result[0]+' - '+result[1]);
}));