Commit 1ebe4ffd authored by Niels De Graef's avatar Niels De Graef

ContactEditor: set container_grid in the UI file

parent 70f36bc3
......@@ -60,6 +60,18 @@
<property name="shadow_type">none</property>
<property name="hscrollbar_policy">never</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<object class="GtkGrid" id="container_grid">
<property name="visible">True</property>
<property name="margin">36</property>
<property name="margin_bottom">24</property>
<property name="row_spacing">12</property>
<property name="column_spacing">12</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<signal name="size-allocate" handler="on_container_grid_size_allocate" after="true" />
</object>
</child>
</object>
</child>
<child>
......
......@@ -71,6 +71,7 @@ public class Contacts.ContactEditor : Grid {
private Contact contact;
[GtkChild]
private Grid container_grid;
private weak Widget focus_widget;
......@@ -752,7 +753,8 @@ public class Contacts.ContactEditor : Grid {
container_grid.insert_row (idx);
}
void size_allocate_cb (Allocation alloc) {
[GtkCallback]
private void on_container_grid_size_allocate (Allocation alloc) {
if (focus_widget != null &&
focus_widget is Widget) {
focus_widget.grab_focus ();
......@@ -761,27 +763,14 @@ public class Contacts.ContactEditor : Grid {
}
public ContactEditor (SimpleActionGroup editor_actions) {
this.container_grid = new Grid ();
this.container_grid.set_row_spacing (12);
this.container_grid.set_column_spacing (12);
this.container_grid.set_vexpand (true);
this.container_grid.set_hexpand (true);
this.container_grid.margin = 36;
this.container_grid.set_margin_bottom (24);
this.main_sw.add (this.container_grid);
this.container_grid.set_focus_vadjustment (this.main_sw.get_vadjustment ());
this.main_sw.get_child ().get_style_context ().add_class ("contacts-main-view");
this.main_sw.get_child ().get_style_context ().add_class ("view");
this.main_sw.show_all ();
this.main_sw.get_style_context ().add_class ("contacts-main-view");
this.main_sw.get_style_context ().add_class ("view");
this.add_detail_button.get_popover ().insert_action_group ("edit", editor_actions);
this.writable_personas = new HashMap<string, HashMap<string, Field?>> ();
this.container_grid.size_allocate.connect_after (size_allocate_cb);
}
/**
......
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