aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Le Bihan <michel@lebihan.pl>2021-01-15 16:58:59 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-05 14:32:08 +0200
commit76aa820720fc220dd2bf51448466cf4b66509af2 (patch)
treedffe6ca07e114332fd9216b23a8145b00b1f21ba
parent806ce34c21efed84c79fcbab531abf58a2b4233c (diff)
Change contact details dialog container to HdyClamp and enable label wrap (#948)
-rw-r--r--main/data/contact_details_dialog.ui167
-rw-r--r--main/src/ui/contact_details/dialog.vala6
2 files changed, 89 insertions, 84 deletions
diff --git a/main/data/contact_details_dialog.ui b/main/data/contact_details_dialog.ui
index 4058bc77..7ebfaaa5 100644
--- a/main/data/contact_details_dialog.ui
+++ b/main/data/contact_details_dialog.ui
@@ -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>
+ <object class="GtkBox">
+ <property name="orientation">vertical</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>
+ <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>
- <attributes>
- <attribute name="weight" value="PANGO_WEIGHT_BOLD"/>
- </attributes>
+ <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>
- <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>
+ <object class="GtkBox" id="main_box">
+ <property name="orientation">vertical</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">
- <property name="orientation">vertical</property>
- <property name="margin-right">100</property>
- <property name="margin-left">100</property>
- <property name="visible">True</property>
</object>
</child>
</object>
diff --git a/main/src/ui/contact_details/dialog.vala b/main/src/ui/contact_details/dialog.vala
index f29d068e..fe21cbba 100644
--- a/main/src/ui/contact_details/dialog.vala
+++ b/main/src/ui/contact_details/dialog.vala
@@ -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));
}