aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/conversation_selector
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-04-12 17:43:47 +0200
committerfiaxh <git@lightrise.org>2019-04-14 09:46:54 +0200
commit6e1938b0893b47f0673bd773bdbfdbf6465ae018 (patch)
tree04ea42d63c7ef197923b49ebc5263371d4b81b9e /main/src/ui/conversation_selector
parentd9e45071d0d3cd5a7a162908267c98c6366038bf (diff)
downloaddino-6e1938b0893b47f0673bd773bdbfdbf6465ae018.tar.gz
dino-6e1938b0893b47f0673bd773bdbfdbf6465ae018.zip
Clean up ConversationTitlebar
Diffstat (limited to 'main/src/ui/conversation_selector')
-rw-r--r--main/src/ui/conversation_selector/conversation_selector.vala (renamed from main/src/ui/conversation_selector/list.vala)26
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala (renamed from main/src/ui/conversation_selector/conversation_row.vala)6
2 files changed, 16 insertions, 16 deletions
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/conversation_selector.vala
index 95e5aae7..d795120b 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/conversation_selector.vala
@@ -4,17 +4,17 @@ using Gtk;
using Xmpp;
using Dino.Entities;
-namespace Dino.Ui.ConversationSelector {
+namespace Dino.Ui {
-public class List : ListBox {
+public class ConversationSelector : ListBox {
public signal void conversation_selected(Conversation conversation);
private StreamInteractor stream_interactor;
private string[]? filter_values;
- private HashMap<Conversation, ConversationRow> rows = new HashMap<Conversation, ConversationRow>(Conversation.hash_func, Conversation.equals_func);
+ private HashMap<Conversation, ConversationSelectorRow> rows = new HashMap<Conversation, ConversationSelectorRow>(Conversation.hash_func, Conversation.equals_func);
- public List init(StreamInteractor stream_interactor) {
+ public ConversationSelector init(StreamInteractor stream_interactor) {
this.stream_interactor = stream_interactor;
stream_interactor.get_module(ConversationManager.IDENTITY).conversation_activated.connect(add_conversation);
@@ -22,7 +22,7 @@ public class List : ListBox {
stream_interactor.get_module(MessageProcessor.IDENTITY).message_received.connect(on_message_received);
stream_interactor.get_module(MessageProcessor.IDENTITY).message_sent.connect(on_message_received);
Timeout.add_seconds(60, () => {
- foreach (ConversationRow row in rows.values) row.update();
+ foreach (ConversationSelectorRow row in rows.values) row.update();
return true;
});
@@ -50,8 +50,8 @@ public class List : ListBox {
}
public override void row_activated(ListBoxRow r) {
- if (r.get_type().is_a(typeof(ConversationRow))) {
- ConversationRow row = r as ConversationRow;
+ ConversationSelectorRow? row = r as ConversationSelectorRow;
+ if (row != null) {
conversation_selected(row.conversation);
}
}
@@ -78,9 +78,9 @@ public class List : ListBox {
}
private void add_conversation(Conversation conversation) {
- ConversationRow row;
+ ConversationSelectorRow row;
if (!rows.has_key(conversation)) {
- row = new ConversationRow(stream_interactor, conversation);
+ row = new ConversationSelectorRow(stream_interactor, conversation);
rows[conversation] = row;
add(row);
row.closed.connect(() => { select_fallback_conversation(conversation); });
@@ -130,8 +130,8 @@ public class List : ListBox {
}
private bool filter(ListBoxRow r) {
- if (r.get_type().is_a(typeof(ConversationRow))) {
- ConversationRow row = r as ConversationRow;
+ ConversationSelectorRow? row = r as ConversationSelectorRow;
+ if (row != null) {
if (filter_values != null && filter_values.length != 0) {
foreach (string filter in filter_values) {
if (!(Util.get_conversation_display_name(stream_interactor, row.conversation).down().contains(filter.down()) ||
@@ -145,8 +145,8 @@ public class List : ListBox {
}
private int sort(ListBoxRow row1, ListBoxRow row2) {
- ConversationRow cr1 = row1 as ConversationRow;
- ConversationRow cr2 = row2 as ConversationRow;
+ ConversationSelectorRow cr1 = row1 as ConversationSelectorRow;
+ ConversationSelectorRow cr2 = row2 as ConversationSelectorRow;
if (cr1 != null && cr2 != null) {
Conversation c1 = cr1.conversation;
Conversation c2 = cr2.conversation;
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 0d0db23a..a1f0e706 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -7,10 +7,10 @@ using Dino;
using Dino.Entities;
using Xmpp;
-namespace Dino.Ui.ConversationSelector {
+namespace Dino.Ui {
[GtkTemplate (ui = "/im/dino/Dino/conversation_selector/conversation_row.ui")]
-public class ConversationRow : ListBoxRow {
+public class ConversationSelectorRow : ListBoxRow {
public signal void closed();
@@ -38,7 +38,7 @@ public class ConversationRow : ListBoxRow {
name_label.attributes = new AttrList();
}
- public ConversationRow(StreamInteractor stream_interactor, Conversation conversation) {
+ public ConversationSelectorRow(StreamInteractor stream_interactor, Conversation conversation) {
this.conversation = conversation;
this.stream_interactor = stream_interactor;