aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-08-31 22:22:44 +0200
committerfiaxh <git@mx.ax.lt>2017-08-31 23:52:15 +0200
commitd0e86d0a8ebb6bbb254a0fb7474d09c58d8379e3 (patch)
tree7f3d7344f279ee83d5f3a726b85affeabcd57506
parentd2a5287effcf60a44084568a37c9c9091d336178 (diff)
downloaddino-d0e86d0a8ebb6bbb254a0fb7474d09c58d8379e3.tar.gz
dino-d0e86d0a8ebb6bbb254a0fb7474d09c58d8379e3.zip
small fixes
-rw-r--r--libdino/src/plugin/interfaces.vala1
-rw-r--r--main/src/ui/add_conversation/list_row.vala2
-rw-r--r--main/src/ui/conversation_selector/conversation_row.vala4
-rw-r--r--main/src/ui/conversation_selector/list.vala2
-rw-r--r--main/src/ui/conversation_summary/conversation_view.vala11
-rw-r--r--main/src/ui/conversation_summary/default_message_display.vala1
-rw-r--r--main/src/ui/conversation_summary/file_populator.vala1
-rw-r--r--main/src/ui/conversation_summary/slashme_message_display.vala1
8 files changed, 18 insertions, 5 deletions
diff --git a/libdino/src/plugin/interfaces.vala b/libdino/src/plugin/interfaces.vala
index 0e0ad27c..09877560 100644
--- a/libdino/src/plugin/interfaces.vala
+++ b/libdino/src/plugin/interfaces.vala
@@ -85,6 +85,7 @@ public abstract class MetaConversationItem : Object {
public virtual string display_name { get; set; default=null; }
public virtual bool dim { get; set; default=false; }
public virtual DateTime? sort_time { get; set; default=null; }
+ public virtual double seccondary_sort_indicator { get; set; }
public virtual DateTime? display_time { get; set; default=null; }
public virtual Encryption? encryption { get; set; default=null; }
public virtual Entities.Message.Marked? mark { get; set; default=null; }
diff --git a/main/src/ui/add_conversation/list_row.vala b/main/src/ui/add_conversation/list_row.vala
index 1f69074d..5c33095f 100644
--- a/main/src/ui/add_conversation/list_row.vala
+++ b/main/src/ui/add_conversation/list_row.vala
@@ -32,7 +32,7 @@ public class ListRow : ListBoxRow {
via_label.visible = false;
}
name_label.label = display_name;
- image.set_from_pixbuf((new AvatarGenerator(35, 35, image.scale_factor)).draw_jid(stream_interactor, jid, account));
+ Util.image_set_from_scaled_pixbuf(image, (new AvatarGenerator(35, 35, image.scale_factor)).draw_jid(stream_interactor, jid, account));
}
}
diff --git a/main/src/ui/conversation_selector/conversation_row.vala b/main/src/ui/conversation_selector/conversation_row.vala
index d9432583..ec00349b 100644
--- a/main/src/ui/conversation_selector/conversation_row.vala
+++ b/main/src/ui/conversation_selector/conversation_row.vala
@@ -56,7 +56,7 @@ public abstract class ConversationRow : ListBoxRow {
Entities.Message? message = stream_interactor.get_module(MessageStorage.IDENTITY).get_last_message(conversation);
if (message != null) {
update_message(message.body.replace("\n", " "));
- update_time(message.time.to_utc());
+ update_time(message.time);
}
}
@@ -89,7 +89,7 @@ public abstract class ConversationRow : ListBoxRow {
time = new_time;
}
if (time != null) {
- time_label.label = get_relative_time(time);
+ time_label.label = get_relative_time(time.to_local());
}
}
diff --git a/main/src/ui/conversation_selector/list.vala b/main/src/ui/conversation_selector/list.vala
index 0e0ce554..c46376ed 100644
--- a/main/src/ui/conversation_selector/list.vala
+++ b/main/src/ui/conversation_selector/list.vala
@@ -206,4 +206,4 @@ public class List : ListBox {
}
}
-} \ No newline at end of file
+}
diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala
index 9379e8ba..3f5a85b6 100644
--- a/main/src/ui/conversation_summary/conversation_view.vala
+++ b/main/src/ui/conversation_summary/conversation_view.vala
@@ -16,7 +16,7 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
[GtkChild] private Stack stack;
private StreamInteractor stream_interactor;
- private Gee.TreeSet<Plugins.MetaConversationItem> meta_items = new TreeSet<Plugins.MetaConversationItem>((a, b) => { return a.sort_time.compare(b.sort_time); });
+ private Gee.TreeSet<Plugins.MetaConversationItem> meta_items = new TreeSet<Plugins.MetaConversationItem>(sort_meta_items);
private Gee.Map<Plugins.MetaConversationItem, Gee.List<Plugins.MetaConversationItem>> meta_after_items = new Gee.HashMap<Plugins.MetaConversationItem, Gee.List<Plugins.MetaConversationItem>>();
private Gee.HashMap<Plugins.MetaConversationItem, ConversationItemSkeleton> item_item_skeletons = new Gee.HashMap<Plugins.MetaConversationItem, ConversationItemSkeleton>();
private Gee.HashMap<Plugins.MetaConversationItem, Widget> widgets = new Gee.HashMap<Plugins.MetaConversationItem, Widget>();
@@ -169,6 +169,15 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
if (meta_items.size > 0) message_item_populator.populate_number(conversation, meta_items.first().sort_time, 20);
}
+ private static int sort_meta_items(Plugins.MetaConversationItem a, Plugins.MetaConversationItem b) {
+ int res = a.sort_time.compare(b.sort_time);
+ if (res == 0) {
+ if (a.seccondary_sort_indicator < b.seccondary_sort_indicator) res = -1;
+ else if (a.seccondary_sort_indicator > b.seccondary_sort_indicator) res = 1;
+ }
+ return res;
+ }
+
// Workaround GTK TextView issues
private void force_alloc_width(Widget widget, int width) {
Allocation alloc = Allocation();
diff --git a/main/src/ui/conversation_summary/default_message_display.vala b/main/src/ui/conversation_summary/default_message_display.vala
index 6082253d..44040a3b 100644
--- a/main/src/ui/conversation_summary/default_message_display.vala
+++ b/main/src/ui/conversation_summary/default_message_display.vala
@@ -35,6 +35,7 @@ public class MetaMessageItem : Plugins.MetaConversationItem {
this.message = message;
this.jid = message.from;
this.sort_time = message.local_time;
+ this.seccondary_sort_indicator = message.id + 0.2085;
this.display_time = message.time;
this.encryption = message.encryption;
}
diff --git a/main/src/ui/conversation_summary/file_populator.vala b/main/src/ui/conversation_summary/file_populator.vala
index 9046155a..d1a26d12 100644
--- a/main/src/ui/conversation_summary/file_populator.vala
+++ b/main/src/ui/conversation_summary/file_populator.vala
@@ -70,6 +70,7 @@ public class ImageItem : Plugins.MetaConversationItem {
this.jid = file_transfer.direction == FileTransfer.DIRECTION_SENT ? new Jid.with_resource(file_transfer.account.bare_jid.to_string(), file_transfer.account.resourcepart) : file_transfer.counterpart;
this.sort_time = file_transfer.time;
+ this.seccondary_sort_indicator = file_transfer.id + 0.2903;
this.display_time = file_transfer.time;
this.encryption = file_transfer.encryption;
this.mark = file_to_message_state(file_transfer.state);
diff --git a/main/src/ui/conversation_summary/slashme_message_display.vala b/main/src/ui/conversation_summary/slashme_message_display.vala
index 58d93142..cb3d5cd2 100644
--- a/main/src/ui/conversation_summary/slashme_message_display.vala
+++ b/main/src/ui/conversation_summary/slashme_message_display.vala
@@ -41,6 +41,7 @@ public class MetaSlashmeItem : Plugins.MetaConversationItem {
this.message = message;
this.jid = message.from;
this.sort_time = message.local_time;
+ this.seccondary_sort_indicator = message.id + 0.0845;
this.display_time = message.time;
this.encryption = message.encryption;
}