aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/service
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-03-20 22:12:20 +0100
committerfiaxh <git@mx.ax.lt>2017-03-20 22:28:32 +0100
commit6f3225979cb497db99381556adb7e42119b44ec3 (patch)
tree1f7352d12eaf1aec7a38d388d3b1917bcd06e479 /libdino/src/service
parentdb57a973534f099af2b150f1a1307d1948553d9f (diff)
downloaddino-6f3225979cb497db99381556adb7e42119b44ec3.tar.gz
dino-6f3225979cb497db99381556adb7e42119b44ec3.zip
Select conversation on startup, placeholder for "No conversation selected", start services before UI
Diffstat (limited to 'libdino/src/service')
-rw-r--r--libdino/src/service/conversation_manager.vala15
-rw-r--r--libdino/src/service/stream_interactor.vala2
2 files changed, 16 insertions, 1 deletions
diff --git a/libdino/src/service/conversation_manager.vala b/libdino/src/service/conversation_manager.vala
index ada9ee9d..10c6ac51 100644
--- a/libdino/src/service/conversation_manager.vala
+++ b/libdino/src/service/conversation_manager.vala
@@ -9,6 +9,7 @@ public class ConversationManager : StreamInteractionModule, Object {
public string id { get { return IDENTITY.id; } }
public signal void conversation_activated(Conversation conversation);
+ public signal void conversation_deactivated(Conversation conversation);
private StreamInteractor stream_interactor;
private Database db;
@@ -37,6 +38,16 @@ public class ConversationManager : StreamInteractionModule, Object {
return null;
}
+ public Gee.List<Conversation> get_active_conversations() {
+ ArrayList<Conversation> ret = new ArrayList<Conversation>(Conversation.equals_func);
+ foreach (Account account in conversations.keys) {
+ foreach (Conversation conversation in conversations[account].values) {
+ if(conversation.active) ret.add(conversation);
+ }
+ }
+ return ret;
+ }
+
public Conversation get_add_conversation(Jid jid, Account account) {
ensure_add_conversation(jid, account, Conversation.Type.CHAT);
return get_conversation(jid, account);
@@ -52,7 +63,11 @@ public class ConversationManager : StreamInteractionModule, Object {
conversation_activated(conversation);
}
}
+ }
+ public void close_conversation(Conversation conversation) {
+ conversation.active = false;
+ conversation_deactivated(conversation);
}
private void on_account_added(Account account) {
diff --git a/libdino/src/service/stream_interactor.vala b/libdino/src/service/stream_interactor.vala
index bdc1ac96..81ddfebd 100644
--- a/libdino/src/service/stream_interactor.vala
+++ b/libdino/src/service/stream_interactor.vala
@@ -72,7 +72,7 @@ public class ModuleIdentity<T> : Object {
}
public T? cast(StreamInteractionModule module) {
- return (T?) module;
+ return module.get_type().is_a(typeof(T)) ? (T?) module : null;
}
public bool matches(StreamInteractionModule module) {