aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/conversation_content_view/chat_state_populator.vala2
-rw-r--r--main/src/ui/conversation_content_view/content_populator.vala6
-rw-r--r--main/src/ui/conversation_content_view/conversation_item_skeleton.vala6
-rw-r--r--main/src/ui/conversation_content_view/conversation_view.vala25
-rw-r--r--main/src/ui/conversation_content_view/date_separator_populator.vala6
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala4
-rw-r--r--main/src/ui/conversation_selector/conversation_selector_row.vala2
-rw-r--r--main/src/ui/global_search.vala6
8 files changed, 25 insertions, 32 deletions
diff --git a/main/src/ui/conversation_content_view/chat_state_populator.vala b/main/src/ui/conversation_content_view/chat_state_populator.vala
index 9b782959..247c83fe 100644
--- a/main/src/ui/conversation_content_view/chat_state_populator.vala
+++ b/main/src/ui/conversation_content_view/chat_state_populator.vala
@@ -62,7 +62,7 @@ class ChatStatePopulator : Plugins.ConversationItemPopulator, Plugins.Conversati
}
private class MetaChatStateItem : Plugins.MetaConversationItem {
- public override DateTime sort_time { get; set; default=new DateTime.now_utc().add_years(10); }
+ public override DateTime time { get; set; default=new DateTime.now_utc().add_years(10); }
private StreamInteractor stream_interactor;
private Conversation conversation;
diff --git a/main/src/ui/conversation_content_view/content_populator.vala b/main/src/ui/conversation_content_view/content_populator.vala
index 48a9e12a..97f15bf9 100644
--- a/main/src/ui/conversation_content_view/content_populator.vala
+++ b/main/src/ui/conversation_content_view/content_populator.vala
@@ -79,10 +79,8 @@ public abstract class ContentMetaItem : Plugins.MetaConversationItem {
protected ContentMetaItem(ContentItem content_item) {
this.jid = content_item.jid;
- this.sort_time = content_item.sort_time;
- this.seccondary_sort_indicator = (long) content_item.display_time.to_unix();
- this.tertiary_sort_indicator = content_item.id;
- this.display_time = content_item.display_time;
+ this.time = content_item.time;
+ this.secondary_sort_indicator = content_item.id;
this.encryption = content_item.encryption;
this.mark = content_item.mark;
diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
index 80aa4fd6..c3db09e0 100644
--- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
@@ -146,7 +146,7 @@ public class ItemMetaDataHeader : Box {
this.add(received_image);
- if (item.display_time != null) {
+ if (item.time != null) {
update_time();
}
@@ -170,7 +170,7 @@ public class ItemMetaDataHeader : Box {
}
private void update_time() {
- time_label.label = get_relative_time(item.display_time.to_local()).to_string();
+ time_label.label = get_relative_time(item.time.to_local()).to_string();
time_update_timeout = Timeout.add_seconds((int) get_next_time_change(), () => {
if (this.parent == null) return false;
@@ -226,7 +226,7 @@ public class ItemMetaDataHeader : Box {
private int get_next_time_change() {
DateTime now = new DateTime.now_local();
- DateTime item_time = item.display_time;
+ DateTime item_time = item.time;
TimeSpan timespan = now.difference(item_time);
if (timespan < 10 * TimeSpan.MINUTE) {
diff --git a/main/src/ui/conversation_content_view/conversation_view.vala b/main/src/ui/conversation_content_view/conversation_view.vala
index e46cd71f..70b16bd9 100644
--- a/main/src/ui/conversation_content_view/conversation_view.vala
+++ b/main/src/ui/conversation_content_view/conversation_view.vala
@@ -293,8 +293,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
public void insert_item(Plugins.MetaConversationItem item) {
if (meta_items.size > 0) {
- bool after_last = meta_items.last().sort_time.compare(item.sort_time) <= 0;
- bool within_range = meta_items.last().sort_time.compare(item.sort_time) > 0 && meta_items.first().sort_time.compare(item.sort_time) < 0;
+ bool after_last = meta_items.last().time.compare(item.time) <= 0;
+ bool within_range = meta_items.last().time.compare(item.time) > 0 && meta_items.first().time.compare(item.time) < 0;
bool accept = within_range || (at_current_content && after_last);
if (!accept) {
return;
@@ -398,11 +398,11 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
Dino.Application app = Dino.Application.get_default();
if (item_skeletons.size == 1) {
foreach (Plugins.ConversationAdditionPopulator populator in app.plugin_registry.conversation_addition_populators) {
- populator.populate_timespan(conversation, item.sort_time, new DateTime.now_utc());
+ populator.populate_timespan(conversation, item.time, new DateTime.now_utc());
}
} else {
foreach (Plugins.ConversationAdditionPopulator populator in app.plugin_registry.conversation_addition_populators) {
- populator.populate_timespan(conversation, item.sort_time, meta_items.higher(item).sort_time);
+ populator.populate_timespan(conversation, item.time, meta_items.higher(item).time);
}
}
}
@@ -410,8 +410,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
}
private bool can_merge(Plugins.MetaConversationItem upper_item /*more recent, displayed below*/, Plugins.MetaConversationItem lower_item /*less recent, displayed above*/) {
- return upper_item.display_time != null && lower_item.display_time != null &&
- upper_item.display_time.difference(lower_item.display_time) < TimeSpan.MINUTE &&
+ return upper_item.time != null && lower_item.time != null &&
+ upper_item.time.difference(lower_item.time) < TimeSpan.MINUTE &&
upper_item.jid != null && lower_item.jid != null &&
upper_item.jid.equals(lower_item.jid) &&
upper_item.encryption == lower_item.encryption &&
@@ -470,15 +470,10 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
}
private static int compare_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) {
- int cmp1 = a.sort_time.compare(b.sort_time);
- if (cmp1 == 0) {
- double cmp2 = a.seccondary_sort_indicator - b.seccondary_sort_indicator;
- if (cmp2 == 0) {
- return (int) (a.tertiary_sort_indicator - b.tertiary_sort_indicator);
- }
- return (int) cmp2;
- }
- return cmp1;
+ int cmp1 = a.time.compare(b.time);
+ if (cmp1 != 0) return cmp1;
+
+ return a.secondary_sort_indicator - b.secondary_sort_indicator;
}
private void clear() {
diff --git a/main/src/ui/conversation_content_view/date_separator_populator.vala b/main/src/ui/conversation_content_view/date_separator_populator.vala
index ff3b962d..5f6838e5 100644
--- a/main/src/ui/conversation_content_view/date_separator_populator.vala
+++ b/main/src/ui/conversation_content_view/date_separator_populator.vala
@@ -38,7 +38,7 @@ class DateSeparatorPopulator : Plugins.ConversationItemPopulator, Plugins.Conver
private void on_inserted_item(Plugins.MetaConversationItem item) {
if (!(item is ContentMetaItem)) return;
- DateTime time = item.sort_time.to_local();
+ DateTime time = item.time.to_local();
DateTime msg_date = new DateTime.local(time.get_year(), time.get_month(), time.get_day_of_month(), 0, 0, 0);
if (!insert_times.contains(msg_date)) {
if (insert_times.lower(msg_date) != null) {
@@ -52,13 +52,13 @@ class DateSeparatorPopulator : Plugins.ConversationItemPopulator, Plugins.Conver
}
public class MetaDateItem : Plugins.MetaConversationItem {
- public override DateTime sort_time { get; set; }
+ public override DateTime time { get; set; }
private DateTime date;
public MetaDateItem(DateTime date) {
this.date = date;
- this.sort_time = date;
+ this.time = date;
}
public override Object? get_widget(Plugins.WidgetType widget_type) {
diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala
index 05661e56..44584709 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -190,7 +190,7 @@ public class MessageItemWidget : SizeRequestBin {
// Append "pending..." iff message has not been sent yet
if (message.direction == Message.DIRECTION_SENT && (message.marked == Message.Marked.SENDING || message.marked == Message.Marked.UNSENT)) {
- if (message.local_time.compare(new DateTime.now_utc().add_seconds(-10)) < 0) {
+ if (message.time.compare(new DateTime.now_utc().add_seconds(-10)) < 0) {
markup_text += " <span size='small' color='%s'>%s</span>".printf(gray_color, "pending…");
// Update the label as soon as the sent state changes
@@ -201,7 +201,7 @@ public class MessageItemWidget : SizeRequestBin {
update_label();
});
} else {
- int time_diff = (- (int) message.local_time.difference(new DateTime.now_utc()) / 1000);
+ int time_diff = (- (int) message.time.difference(new DateTime.now_utc()) / 1000);
Timeout.add(10000 - time_diff, () => {
update_label();
return false;
diff --git a/main/src/ui/conversation_selector/conversation_selector_row.vala b/main/src/ui/conversation_selector/conversation_selector_row.vala
index 07e3f831..cd513d13 100644
--- a/main/src/ui/conversation_selector/conversation_selector_row.vala
+++ b/main/src/ui/conversation_selector/conversation_selector_row.vala
@@ -138,7 +138,7 @@ public class ConversationSelectorRow : ListBoxRow {
protected void update_time_label(DateTime? new_time = null) {
if (last_content_item != null) {
time_label.visible = true;
- time_label.label = get_relative_time(last_content_item.display_time.to_local());
+ time_label.label = get_relative_time(last_content_item.time.to_local());
}
}
diff --git a/main/src/ui/global_search.vala b/main/src/ui/global_search.vala
index 2de47f64..27ffb9d9 100644
--- a/main/src/ui/global_search.vala
+++ b/main/src/ui/global_search.vala
@@ -146,8 +146,8 @@ public class GlobalSearch : Overlay {
private void append_messages(Gee.List<MessageItem> messages) {
foreach (MessageItem item in messages) {
- Gee.List<MessageItem> before_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages_before_message(item.conversation, item.message.local_time, item.message.id, 1);
- Gee.List<MessageItem> after_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages_after_message(item.conversation, item.message.local_time, item.message.id, 1);
+ Gee.List<MessageItem> before_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages_before_message(item.conversation, item.message.time, item.message.id, 1);
+ Gee.List<MessageItem> after_message = stream_interactor.get_module(MessageStorage.IDENTITY).get_messages_after_message(item.conversation, item.message.time, item.message.id, 1);
Box context_box = new Box(Orientation.VERTICAL, 5) { visible=true };
if (before_message != null && before_message.size > 0) {
@@ -161,7 +161,7 @@ public class GlobalSearch : Overlay {
context_box.add(get_context_message_widget(after_message.first()));
}
- Label date_label = new Label(ConversationSummary.ItemMetaDataHeader.get_relative_time(item.display_time.to_local())) { xalign=0, visible=true };
+ Label date_label = new Label(ConversationSummary.ItemMetaDataHeader.get_relative_time(item.time.to_local())) { xalign=0, visible=true };
date_label.get_style_context().add_class("dim-label");
string display_name = Util.get_conversation_display_name(stream_interactor, item.conversation);