[gnome-contacts] ContactEditor: set container_grid in the UI file
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] ContactEditor: set container_grid in the UI file
- Date: Thu, 18 Jan 2018 16:34:16 +0000 (UTC)
commit 1ebe4ffd8b7e289bb33f4f135171745a46e98324
Author: Niels De Graef <nielsdegraef gmail com>
Date: Thu Jan 18 17:22:55 2018 +0100
ContactEditor: set container_grid in the UI file
data/ui/contacts-contact-editor.ui | 12 ++++++++++++
src/contacts-contact-editor.vala | 21 +++++----------------
2 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/data/ui/contacts-contact-editor.ui b/data/ui/contacts-contact-editor.ui
index 06e37e8..57a862f 100644
--- a/data/ui/contacts-contact-editor.ui
+++ b/data/ui/contacts-contact-editor.ui
@@ -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>
diff --git a/src/contacts-contact-editor.vala b/src/contacts-contact-editor.vala
index 4b8a656..26130b1 100644
--- a/src/contacts-contact-editor.vala
+++ b/src/contacts-contact-editor.vala
@@ -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);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]