From ea174ab632ced082eb0f1c51cea1bc9dc5c7c89e Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 2 Aug 2017 17:29:55 +0200 Subject: Http file upload --- libdino/src/plugin/interfaces.vala | 12 +++++++++++- libdino/src/plugin/registry.vala | 21 ++++++++++++++++++++- libdino/src/service/database.vala | 4 ++-- .../src/service/entity_capabilities_storage.vala | 6 +++--- 4 files changed, 36 insertions(+), 7 deletions(-) (limited to 'libdino') diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala index 705cdfe1..178ca1ab 100644 --- a/libdino/src/plugin/interfaces.vala +++ b/libdino/src/plugin/interfaces.vala @@ -53,4 +53,14 @@ public class ContactDetails : Object { public signal void add(string category, string label, string desc, Widget widget); } -} \ No newline at end of file +public abstract class ConversationTitlebarEntry : Object { + public abstract string id { get; } + public abstract double order { get; } + public abstract ConversationTitlebarWidget get_widget(); +} + +public interface ConversationTitlebarWidget : Gtk.Widget { + public abstract void set_conversation(Conversation conversation); +} + +} diff --git a/libdino/src/plugin/registry.vala b/libdino/src/plugin/registry.vala index e1ba605d..01d18d5f 100644 --- a/libdino/src/plugin/registry.vala +++ b/libdino/src/plugin/registry.vala @@ -6,6 +6,15 @@ public class Registry { internal ArrayList encryption_list_entries = new ArrayList(); internal ArrayList account_settings_entries = new ArrayList(); internal ArrayList contact_details_entries = new ArrayList(); + internal Gee.Collection conversation_titlebar_entries = new Gee.TreeSet((a, b) => { + if (a.order < b.order) { + return -1; + } else if (a.order > b.order) { + return 1; + } else { + return 0; + } + }); public bool register_encryption_list_entry(EncryptionListEntry entry) { lock(encryption_list_entries) { @@ -39,6 +48,16 @@ public class Registry { return true; } } + + public bool register_contact_titlebar_entry(ConversationTitlebarEntry entry) { + lock(conversation_titlebar_entries) { + foreach(ConversationTitlebarEntry e in conversation_titlebar_entries) { + if (e.id == entry.id) return false; + } + conversation_titlebar_entries.add(entry); + return true; + } + } } -} \ No newline at end of file +} diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index 333c599b..b414b943 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -276,7 +276,7 @@ public class Database : Qlite.Database { return ret; } - public void add_entity_features(string entity, ArrayList features) { + public void add_entity_features(string entity, Gee.List features) { foreach (string feature in features) { entity_feature.insert() .value(entity_feature.entity, entity) @@ -285,7 +285,7 @@ public class Database : Qlite.Database { } } - public ArrayList get_entity_features(string entity) { + public Gee.List get_entity_features(string entity) { ArrayList ret = new ArrayList(); foreach (Row row in entity_feature.select({entity_feature.feature}).with(entity_feature.entity, "=", entity)) { ret.add(row[entity_feature.feature]); diff --git a/libdino/src/service/entity_capabilities_storage.vala b/libdino/src/service/entity_capabilities_storage.vala index 9774739a..910ce48d 100644 --- a/libdino/src/service/entity_capabilities_storage.vala +++ b/libdino/src/service/entity_capabilities_storage.vala @@ -12,12 +12,12 @@ public class EntityCapabilitiesStorage : Xep.EntityCapabilities.Storage, Object this.db = db; } - public void store_features(string entity, ArrayList features) { + public void store_features(string entity, Gee.List features) { db.add_entity_features(entity, features); } - public ArrayList get_features(string entitiy) { + public Gee.List get_features(string entitiy) { return db.get_entity_features(entitiy); } } -} \ No newline at end of file +} -- cgit v1.2.3-70-g09d2