Commit 23a4b6d3 authored by Julian Sparber's avatar Julian Sparber

LinkSuggestion: Change orientation on suggestion based on avaible space

parent d66abfee
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.22 -->
<template class="ContactsLinkSuggestionGrid" parent="GtkGrid">
<property name="orientation">horizontal</property>
<template class="ContactsLinkSuggestionGrid" parent="GtkBox">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="valign">end</property>
<child>
<object class="GtkGrid" id="grid">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
<property name="column_spacing">6</property>
<child>
<object class="GtkLabel" id="description_label">
......@@ -39,10 +43,13 @@
<property name="height">1</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="valign">center</property>
<property name="halign">center</property>
<property name="orientation">horizontal</property>
<property name="spacing">6</property>
<property name="margin_top">12</property>
......@@ -79,11 +86,6 @@
</object>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</template>
</interface>
......@@ -102,6 +102,7 @@ public class Contacts.ContactPane : Stack {
remove_suggestion_grid ();
this.suggestion_grid = new LinkSuggestionGrid (c);
bind_property ("narrow", this.suggestion_grid, "orientation", BindingFlags.SYNC_CREATE);
parent_overlay.add_overlay (this.suggestion_grid);
this.suggestion_grid.suggestion_accepted.connect ( () => {
......
......@@ -25,9 +25,11 @@ using Gee;
* and another (hopefully) similar contact.
*/
[GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-link-suggestion-grid.ui")]
public class Contacts.LinkSuggestionGrid : Grid {
public class Contacts.LinkSuggestionGrid : Box {
private const int AVATAR_SIZE = 54;
[GtkChild]
private Gtk.Grid grid;
[GtkChild]
private Gtk.Label description_label;
[GtkChild]
......@@ -37,6 +39,8 @@ public class Contacts.LinkSuggestionGrid : Grid {
[GtkChild]
private Gtk.Button reject_button;
public bool narrow { get; set; default = true; }
public signal void suggestion_accepted ();
public signal void suggestion_rejected ();
......@@ -47,7 +51,7 @@ public class Contacts.LinkSuggestionGrid : Grid {
image_frame.hexpand = false;
image_frame.margin = 12;
image_frame.show ();
attach (image_frame, 0, 0, 1, 2);
grid.attach (image_frame, 0, 0, 1, 2);
this.description_label.xalign = 0;
this.description_label.label = contact.is_main?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment