Display message sender in bold+text color instead of small+colored

This commit is contained in:
fiaxh 2022-01-05 19:46:16 +01:00
parent b3d452265f
commit ac2af04740
3 changed files with 8 additions and 24 deletions

View file

@ -1,38 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="DinoUiConversationSummaryItemMetaDataHeader"> <template class="DinoUiConversationSummaryItemMetaDataHeader">
<property name="spacing">4</property> <property name="spacing">6</property>
<property name="orientation">horizontal</property> <property name="orientation">horizontal</property>
<child> <child>
<object class="GtkLabel" id="name_label"> <object class="GtkLabel" id="name_label">
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="valign">start</property> <property name="valign">baseline</property>
<property name="visible">True</property> <property name="visible">True</property>
<attributes> <attributes>
<attribute name="scale" value="0.8"/> <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes> </attributes>
</object> </object>
</child> </child>
<child>
<object class="GtkLabel" id="dot_label">
<property name="label">·</property>
<property name="xalign">0</property>
<property name="valign">start</property>
<property name="visible">True</property>
<attributes>
<attribute name="scale" value="0.8"/>
</attributes>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child> <child>
<object class="GtkLabel" id="time_label"> <object class="GtkLabel" id="time_label">
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="valign">start</property> <property name="valign">baseline</property>
<property name="visible">True</property> <property name="visible">True</property>
<attributes> <attributes>
<attribute name="scale" value="0.8"/> <attribute name="scale" value="0.8"/>

View file

@ -216,9 +216,7 @@ public class ItemMetaDataHeader : Box {
} }
private void update_name_label() { private void update_name_label() {
string display_name = Markup.escape_text(Util.get_participant_display_name(stream_interactor, conversation, item.jid)); name_label.label = Markup.escape_text(Util.get_participant_display_name(stream_interactor, conversation, item.jid));
string color = Util.get_name_hex_color(stream_interactor, conversation.account, item.jid, Util.is_dark_theme(name_label));
name_label.label = @"<span foreground=\"#$color\">$display_name</span>";
} }
private void update_received_mark() { private void update_received_mark() {

View file

@ -261,9 +261,9 @@ public class GlobalSearch : Overlay {
grid.attach(image, 0, 0, 1, 2); grid.attach(image, 0, 0, 1, 2);
string display_name = Util.get_participant_display_name(stream_interactor, item.conversation, item.jid); string display_name = Util.get_participant_display_name(stream_interactor, item.conversation, item.jid);
string color = Util.get_name_hex_color(stream_interactor, item.message.account, item.jid, false); // TODO Util.is_dark_theme(name_label) Label name_label = new Label(display_name) { ellipsize=EllipsizeMode.END, use_markup=true, xalign=0, visible=true };
Label name_label = new Label("") { ellipsize=EllipsizeMode.END, use_markup=true, xalign=0, visible=true }; name_label.attributes = new AttrList();
name_label.label = "<span size='small' foreground=\"#%s\">%s</span>".printf(color, Markup.escape_text(display_name)); name_label.attributes.insert(attr_weight_new(Weight.BOLD));
grid.attach(name_label, 1, 0, 1, 1); grid.attach(name_label, 1, 0, 1, 1);
return grid; return grid;
} }