Change contact details dialog container to HdyClamp and enable label wrap (#948)

This commit is contained in:
Michel Le Bihan 2021-01-15 16:58:59 +01:00 committed by Xavier Del Campo Romero
parent 806ce34c21
commit 76aa820720
Signed by: xavi
GPG Key ID: 84FF3612A9BF43F2
2 changed files with 96 additions and 91 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="DinoUiContactDetailsDialog">
<property name="default_width">800</property>
<property name="modal">True</property>
<child type="titlebar">
<object class="GtkHeaderBar">
@ -21,98 +22,102 @@
<property name="expand">True</property>
<property name="visible">True</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<object class="HdyClamp">
<property name="margin-right">18</property>
<property name="margin-left">18</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkGrid">
<property name="margin-top">20</property>
<property name="margin-bottom">12</property>
<property name="margin-right">100</property>
<property name="margin-left">100</property>
<property name="column-spacing">10</property>
<property name="visible">True</property>
<child>
<object class="DinoUiAvatarImage" id="avatar">
<property name="height">50</property>
<property name="width">50</property>
<property name="visible">True</property>
<property name="allow_gray">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="DinoUiUtilEntryLabelHybrid" id="name_hybrid">
<property name="xalign">0</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="xalign">0</property>
<property name="expand">True</property>
<property name="visible">True</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="jid_label">
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="selectable">True</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account_label">
<property name="xalign">1</property>
<property name="yalign">1</property>
<property name="margin">5</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="main_box">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-right">100</property>
<property name="margin-left">100</property>
<property name="visible">True</property>
<child>
<object class="GtkGrid">
<property name="margin-top">20</property>
<property name="margin-bottom">12</property>
<property name="column-spacing">10</property>
<property name="visible">True</property>
<child>
<object class="DinoUiAvatarImage" id="avatar">
<property name="height">50</property>
<property name="width">50</property>
<property name="visible">True</property>
<property name="allow_gray">False</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">2</property>
</packing>
</child>
<child>
<object class="DinoUiUtilEntryLabelHybrid" id="name_hybrid">
<property name="xalign">0</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="name_label">
<property name="xalign">0</property>
<property name="expand">True</property>
<property name="visible">True</property>
<attributes>
<attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="jid_label">
<property name="xalign">0</property>
<property name="yalign">0</property>
<property name="selectable">True</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="account_label">
<property name="xalign">1</property>
<property name="yalign">1</property>
<property name="margin">5</property>
<property name="expand">True</property>
<property name="visible">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="main_box">
<property name="orientation">vertical</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</object>

View File

@ -85,11 +85,11 @@ public class Dialog : Gtk.Dialog {
ListBoxRow list_row = new ListBoxRow() { activatable=false, visible=true };
Box row = new Box(Orientation.HORIZONTAL, 20) { margin_start=15, margin_end=15, margin_top=3, margin_bottom=3, visible=true };
list_row.add(row);
Label label_label = new Label(label) { xalign=0, yalign=0.5f, hexpand=true, visible=true };
Label label_label = new Label(label) { xalign=0, yalign=0.5f, hexpand=true, wrap=true, visible=true };
if (description != null && description != "") {
Box box = new Box(Orientation.VERTICAL, 0) { visible=true };
box.add(label_label);
Label desc_label = new Label("") { xalign=0, yalign=0.5f, hexpand=true, visible=true };
Label desc_label = new Label("") { xalign=0, yalign=0.5f, hexpand=true, wrap=true, visible=true };
desc_label.set_markup("<span size='small'>%s</span>".printf(Markup.escape_text(description)));
desc_label.get_style_context().add_class("dim-label");
box.add(desc_label);
@ -117,7 +117,7 @@ public class Dialog : Gtk.Dialog {
int pref_height, pref_width;
get_content_area().get_preferred_height(null, out pref_height);
get_preferred_width(out pref_width, null);
get_default_size(out pref_width, null);
resize(pref_width, int.min(500, pref_height));
}