network: Replace the notebook with a stack

The Network panel uses a GtkNotebook internally to manage
the different setup pages of the network devices. While it
does the job, we now have a modern widget for that: GtkStack.

With GtkStack, managing the pages becomes a lot easier and
we gain almost for free the nice transition between pages,
besides of course being a widget that consumes slightly less
resources.

Besides all these gains, using a GtkStack will allow us to
implement the new Wi-Fi panel in a more cohesive manner,
sharing large portions of code and avoiding copy pasta.

This commit then turns the GtkNotebook into a GtkStack, and
renames and adapts the code to reflect that. Fortunately,
the code got actually simpler with the move.

https://bugzilla.gnome.org/show_bug.cgi?id=784818
This commit is contained in:
Georges Basile Stavracas Neto 2017-07-11 13:02:51 -03:00
parent c37ce6fcb4
commit 158591a346
10 changed files with 59 additions and 95 deletions

View file

@ -135,23 +135,21 @@ net_object_get_panel (NetObject *object)
}
GtkWidget *
net_object_add_to_notebook (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group)
net_object_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
GtkWidget *widget;
NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
if (klass->add_to_notebook != NULL) {
widget = klass->add_to_notebook (object,
notebook,
heading_size_group);
if (klass->add_to_stack != NULL) {
widget = klass->add_to_stack (object, stack, heading_size_group);
g_object_set_data_full (G_OBJECT (widget),
"NetObject::id",
g_strdup (object->priv->id),
g_free);
return widget;
}
g_debug ("no klass->add_to_notebook for %s", object->priv->id);
g_debug ("no klass->add_to_stack for %s", object->priv->id);
return NULL;
}