gtk: implement get_attachment_fd and texture/attachment cache, viewport loading
This commit is contained in:
@@ -144,4 +144,35 @@ public class Repository : DBusServiceProxy {
|
||||
var info = dbus_repository.get_attachment_info(attachment_guid);
|
||||
return new AttachmentInfo(info.attr1, info.attr2, info.attr3, info.attr4);
|
||||
}
|
||||
|
||||
public int open_attachment_fd(string attachment_guid, bool preview) throws DBusServiceProxyError, GLib.Error {
|
||||
if (dbus_repository == null) {
|
||||
throw new DBusServiceProxyError.NOT_CONNECTED("Repository not connected");
|
||||
}
|
||||
|
||||
var connection = Bus.get_sync(BusType.SESSION);
|
||||
UnixFDList? out_fd_list = null;
|
||||
var result = connection.call_with_unix_fd_list_sync(
|
||||
DBUS_NAME,
|
||||
DBUS_PATH,
|
||||
"net.buzzert.kordophone.Repository",
|
||||
"OpenAttachmentFd",
|
||||
new Variant("(sb)", attachment_guid, preview),
|
||||
new VariantType("(h)"),
|
||||
DBusCallFlags.NONE,
|
||||
120000,
|
||||
null,
|
||||
out out_fd_list,
|
||||
null
|
||||
);
|
||||
|
||||
int fd_handle = -1;
|
||||
result.get("(h)", out fd_handle);
|
||||
|
||||
if (out_fd_list == null) {
|
||||
throw new DBusServiceProxyError.NOT_CONNECTED("Missing UnixFDList from OpenAttachmentFd");
|
||||
}
|
||||
|
||||
return out_fd_list.get(fd_handle);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user