online-accounts: Replace GtkStack child names with widget references

The child names are easier to break if widgets are changed - this can't be
detected by the compiler.
This commit is contained in:
Robert Ancell 2019-11-20 15:03:00 +13:00 committed by Robert Ancell
parent 97ac89b88f
commit ece1911f40
2 changed files with 5 additions and 9 deletions

View file

@ -42,6 +42,7 @@ struct _CcGoaPanel
GtkListBox *accounts_listbox;
GtkDialog *edit_account_dialog;
GtkHeaderBar *edit_account_headerbar;
GtkBox *editor_box;
GtkListBoxRow *more_providers_row;
GtkBox *new_account_vbox;
GtkLabel *notification_label;
@ -255,7 +256,7 @@ add_account (CcGoaPanel *self,
reset_headerbar (self);
/* Move to the new account page */
gtk_stack_set_visible_child_name (self->stack, "new-account");
gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->new_account_vbox));
/* Reset the dialog size */
gtk_window_resize (GTK_WINDOW (self->edit_account_dialog), 1, 1);
@ -547,6 +548,7 @@ cc_goa_panel_class_init (CcGoaPanelClass *klass)
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, accounts_vbox);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_dialog);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, edit_account_headerbar);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, editor_box);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, more_providers_row);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, new_account_vbox);
gtk_widget_class_bind_template_child (widget_class, CcGoaPanel, notification_label);
@ -590,7 +592,7 @@ show_page_account (CcGoaPanel *panel,
reset_headerbar (panel);
/* Move to the account editor page */
gtk_stack_set_visible_child_name (panel->stack, "editor");
gtk_stack_set_visible_child (panel->stack, GTK_WIDGET (panel->editor_box));
/* Out with the old */
children = gtk_container_get_children (GTK_CONTAINER (panel->accounts_vbox));

View file

@ -213,12 +213,9 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="name">new-account</property>
</packing>
</child>
<child>
<object class="GtkBox">
<object class="GtkBox" id="editor_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin-bottom">24</property>
@ -248,9 +245,6 @@
</object>
</child>
</object>
<packing>
<property name="name">editor</property>
</packing>
</child>
</object>
</child>