aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/plugin
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-06-20 12:05:20 +0200
committerfiaxh <git@lightrise.org>2024-06-20 12:14:46 +0200
commit21ae42762d8a57da5cb1ec40b46e7510fc3121ad (patch)
treede91ddf080c3e1e433136235265d0d3682a976b8 /libdino/src/plugin
parentc8b20d0f5f33fb8b9898d216c3b4c9280abf31da (diff)
downloaddino-21ae42762d8a57da5cb1ec40b46e7510fc3121ad.tar.gz
dino-21ae42762d8a57da5cb1ec40b46e7510fc3121ad.zip
Redesign and rewrite accounts and settings dialog into a combined one
Diffstat (limited to 'libdino/src/plugin')
-rw-r--r--libdino/src/plugin/interfaces.vala7
-rw-r--r--libdino/src/plugin/registry.vala13
2 files changed, 20 insertions, 0 deletions
diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala
index cfe4d0cb..dd25c5f5 100644
--- a/libdino/src/plugin/interfaces.vala
+++ b/libdino/src/plugin/interfaces.vala
@@ -55,6 +55,13 @@ public abstract class AccountSettingsEntry : Object {
public abstract Object? get_widget(WidgetType type);
}
+public abstract class EncryptionPreferencesEntry : Object {
+ public abstract string id { get; }
+ public virtual Priority priority { get { return Priority.DEFAULT; } }
+
+ public abstract Object? get_widget(Account account, WidgetType type);
+}
+
public interface ContactDetailsProvider : Object {
public abstract string id { get; }
diff --git a/libdino/src/plugin/registry.vala b/libdino/src/plugin/registry.vala
index 6c0234ca..7180aa14 100644
--- a/libdino/src/plugin/registry.vala
+++ b/libdino/src/plugin/registry.vala
@@ -6,6 +6,7 @@ public class Registry {
public HashMap<Entities.Encryption, EncryptionListEntry> encryption_list_entries = new HashMap<Entities.Encryption, EncryptionListEntry>();
public HashMap<string, CallEncryptionEntry> call_encryption_entries = new HashMap<string, CallEncryptionEntry>();
public ArrayList<AccountSettingsEntry> account_settings_entries = new ArrayList<AccountSettingsEntry>();
+ public ArrayList<EncryptionPreferencesEntry> encryption_preferences_entries = new ArrayList<EncryptionPreferencesEntry>();
public ArrayList<ContactDetailsProvider> contact_details_entries = new ArrayList<ContactDetailsProvider>();
public Map<string, TextCommand> text_commands = new HashMap<string, TextCommand>();
public Gee.List<ConversationAdditionPopulator> conversation_addition_populators = new ArrayList<ConversationAdditionPopulator>();
@@ -43,6 +44,18 @@ public class Registry {
}
}
+ public bool register_encryption_preferences_entry(EncryptionPreferencesEntry entry) {
+ lock(encryption_preferences_entries) {
+ foreach(var e in encryption_preferences_entries) {
+ if (e.id == entry.id) return false;
+ }
+ encryption_preferences_entries.add(entry);
+ // TODO: Order by priority
+// encryption_preferences_entries.sort((a,b) => b.name.collate(a.name));
+ return true;
+ }
+ }
+
public bool register_contact_details_entry(ContactDetailsProvider entry) {
lock(contact_details_entries) {
foreach(ContactDetailsProvider e in contact_details_entries) {