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

@ -53,15 +53,15 @@ device_ethernet_get_speed (NetDeviceSimple *device_simple)
}
static GtkWidget *
device_ethernet_add_to_notebook (NetObject *object,
GtkNotebook *notebook,
GtkSizeGroup *heading_size_group)
device_ethernet_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
GtkWidget *vbox;
vbox = GTK_WIDGET (gtk_builder_get_object (device->builder, "vbox6"));
gtk_notebook_append_page (notebook, vbox, NULL);
gtk_stack_add_named (stack, vbox, net_object_get_id (object));
return vbox;
}
@ -612,7 +612,7 @@ net_device_ethernet_class_init (NetDeviceEthernetClass *klass)
simple_class->get_speed = device_ethernet_get_speed;
obj_class->refresh = device_ethernet_refresh;
obj_class->add_to_notebook = device_ethernet_add_to_notebook;
obj_class->add_to_stack = device_ethernet_add_to_stack;
object_class->constructed = device_ethernet_constructed;
object_class->finalize = device_ethernet_finalize;
}