diff options
author | Christopher Davis <brainblasted@disroot.org> | 2021-02-05 22:44:12 -0800 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2021-02-13 09:44:40 +0000 |
commit | d2bb1a5d648aebe623eaf7894c00c61ebdf7a190 (patch) | |
tree | 4ca538ccfcf7efdf278573a340ed50de6ea1ac3a /src/contacts-contact-pane.vala | |
parent | 33df12dcecd813c9a42655c910026dd5442741bf (diff) | |
download | gnome-contacts-d2bb1a5d648aebe623eaf7894c00c61ebdf7a190.tar.gz |
contact-pane: Re-arrange widgets, subclass GtkBin
Subclassing GtkScrollWindow and putting the stack, etc.
nested in the hierarchy messed with HdyStatusPage and
caused it to have odd margins. Since HdyStatusPage also
includes a GtkScrolledWindow, this would cause double
scrolling as well.
This commit rearranges things to work well with HdyStatusPage.
Diffstat (limited to 'src/contacts-contact-pane.vala')
-rw-r--r-- | src/contacts-contact-pane.vala | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/contacts-contact-pane.vala b/src/contacts-contact-pane.vala index eae68ae..0796a11 100644 --- a/src/contacts-contact-pane.vala +++ b/src/contacts-contact-pane.vala @@ -25,7 +25,7 @@ const int PROFILE_SIZE = 128; * and a ContactEditor to edit contact information. */ [GtkTemplate (ui = "/org/gnome/Contacts/ui/contacts-contact-pane.ui")] -public class Contacts.ContactPane : Gtk.ScrolledWindow { +public class Contacts.ContactPane : Gtk.Bin { private MainWindow main_window; @@ -40,10 +40,16 @@ public class Contacts.ContactPane : Gtk.ScrolledWindow { private Hdy.StatusPage none_selected_page; [GtkChild] + private unowned Gtk.ScrolledWindow contact_sheet_view; + + [GtkChild] private Gtk.Container contact_sheet_page; private ContactSheet? sheet = null; [GtkChild] + private unowned Gtk.ScrolledWindow contact_editor_view; + + [GtkChild] private Gtk.Box contact_editor_page; private ContactEditor? editor = null; @@ -108,7 +114,7 @@ public class Contacts.ContactPane : Gtk.ScrolledWindow { remove_contact_sheet(); this.sheet = new ContactSheet (this.individual, this.store); this.contact_sheet_page.add (this.sheet); - this.stack.set_visible_child (this.contact_sheet_page); + this.stack.set_visible_child (this.contact_sheet_view); var matches = this.store.aggregator.get_potential_matches (this.individual, MatchResult.HIGH); foreach (var i in matches.keys) { @@ -154,7 +160,7 @@ public class Contacts.ContactPane : Gtk.ScrolledWindow { this.on_edit_mode = true; create_contact_editor (); - this.stack.set_visible_child (this.contact_editor_page); + this.stack.set_visible_child (this.contact_editor_view); } public void stop_editing (bool cancel = false) { @@ -169,7 +175,7 @@ public class Contacts.ContactPane : Gtk.ScrolledWindow { if (fake_individual != null && fake_individual.real_individual != null) { // Reset individual on to the real one this.individual = fake_individual.real_individual; - this.stack.set_visible_child (this.contact_sheet_page); + this.stack.set_visible_child (this.contact_sheet_view); } else { this.stack.set_visible_child (this.none_selected_page); } |