Repository: add support for attachment uploading
This commit is contained in:
@@ -5,6 +5,7 @@ public class Repository : DBusServiceProxy {
|
||||
public signal void conversations_updated();
|
||||
public signal void messages_updated(string conversation_guid);
|
||||
public signal void attachment_downloaded(string attachment_guid);
|
||||
public signal void attachment_uploaded(string upload_guid, string attachment_guid);
|
||||
|
||||
public static Repository get_instance() {
|
||||
if (instance == null) {
|
||||
@@ -41,6 +42,10 @@ public class Repository : DBusServiceProxy {
|
||||
attachment_downloaded(attachment_guid);
|
||||
});
|
||||
|
||||
this.dbus_repository.attachment_upload_completed.connect((upload_guid, attachment_guid) => {
|
||||
attachment_uploaded(upload_guid, attachment_guid);
|
||||
});
|
||||
|
||||
conversations_updated();
|
||||
} catch (GLib.Error e) {
|
||||
warning("Failed to connect to repository: %s", e.message);
|
||||
@@ -100,4 +105,12 @@ public class Repository : DBusServiceProxy {
|
||||
|
||||
dbus_repository.download_attachment(attachment_guid, preview);
|
||||
}
|
||||
|
||||
public string upload_attachment(string filename) throws DBusServiceProxyError, GLib.Error {
|
||||
if (dbus_repository == null) {
|
||||
throw new DBusServiceProxyError.NOT_CONNECTED("Repository not connected");
|
||||
}
|
||||
|
||||
return dbus_repository.upload_attachment(filename);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user