network-connection-editor: Align Routes labels

Even though the routes_metric_label is in a GtkSizeGroup with the
GtkEntry for the metric, its size was set too big after adding the entry
to the size group. To fix this, add all the other labels and
corresponding entries to size groups as well. The hexpand can then be
removed as well on the labels.

Fixes #1235
This commit is contained in:
velsinki 2023-10-18 22:20:46 +02:00 committed by Robert Ancell
parent 549496f68f
commit ef644deb3d
4 changed files with 67 additions and 13 deletions

View file

@ -52,12 +52,15 @@ struct _CEPageIP4
GtkEntry *dns_entry;
GtkGrid *main_box;
GtkCheckButton *never_default_check;
GtkLabel *routes_address_label;
GtkBox *routes_box;
GtkLabel *routes_address_label;
GtkLabel *routes_gateway_label;
GtkLabel *routes_metric_label;
GtkSizeGroup *routes_metric_sizegroup;
GtkLabel *routes_netmask_label;
GtkLabel *routes_metric_label;
GtkSizeGroup *routes_address_sizegroup;
GtkSizeGroup *routes_gateway_sizegroup;
GtkSizeGroup *routes_netmask_sizegroup;
GtkSizeGroup *routes_metric_sizegroup;
GtkSizeGroup *routes_sizegroup;
GtkCheckButton *shared_radio;
@ -371,6 +374,8 @@ add_route_row (CEPageIP4 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_address_sizegroup, widget);
widget = GTK_WIDGET (ce_netmask_entry_new ());
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -383,6 +388,8 @@ add_route_row (CEPageIP4 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_netmask_sizegroup, widget);
widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET));
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -395,6 +402,8 @@ add_route_row (CEPageIP4 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_gateway_sizegroup, widget);
widget = gtk_entry_new ();
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -812,6 +821,9 @@ ce_page_ip4_class_init (CEPageIP4Class *klass)
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_netmask_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_gateway_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_metric_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_address_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_netmask_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_gateway_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_metric_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, routes_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP4, shared_radio);

View file

@ -53,10 +53,13 @@ struct _CEPageIP6
GtkGrid *main_box;
GtkCheckButton *never_default_check;
GtkBox *routes_box;
GtkLabel *routes_address_label;
GtkLabel *routes_prefix_label;
GtkLabel *routes_gateway_label;
GtkLabel *routes_metric_label;
GtkLabel *routes_address_label;
GtkLabel *routes_prefix_label;
GtkLabel *routes_gateway_label;
GtkLabel *routes_metric_label;
GtkSizeGroup *routes_address_sizegroup;
GtkSizeGroup *routes_prefix_sizegroup;
GtkSizeGroup *routes_gateway_sizegroup;
GtkSizeGroup *routes_metric_sizegroup;
GtkSizeGroup *routes_sizegroup;
GtkCheckButton *shared_radio;
@ -342,6 +345,8 @@ add_route_row (CEPageIP6 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_address_sizegroup, widget);
widget = gtk_entry_new ();
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -354,6 +359,8 @@ add_route_row (CEPageIP6 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_prefix_sizegroup, widget);
widget = GTK_WIDGET (ce_ip_address_entry_new (AF_INET6));
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -366,6 +373,8 @@ add_route_row (CEPageIP6 *self,
-1);
gtk_box_append (GTK_BOX (row_box), widget);
gtk_size_group_add_widget (self->routes_gateway_sizegroup, widget);
widget = gtk_entry_new ();
g_signal_connect_object (widget, "changed", G_CALLBACK (ce_page_changed), self, G_CONNECT_SWAPPED);
g_signal_connect_object (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self, G_CONNECT_SWAPPED);
@ -773,8 +782,11 @@ ce_page_ip6_class_init (CEPageIP6Class *klass)
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, never_default_check);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_box);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_address_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_address_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_prefix_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_prefix_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_gateway_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_gateway_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_metric_label);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_metric_sizegroup);
gtk_widget_class_bind_template_child (widget_class, CEPageIP6, routes_sizegroup);

View file

@ -252,7 +252,6 @@
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel" id="routes_address_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Address</property>
<style>
<class name="dim-label" />
@ -264,7 +263,6 @@
</child>
<child>
<object class="GtkLabel" id="routes_netmask_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Netmask</property>
<style>
<class name="dim-label" />
@ -276,7 +274,6 @@
</child>
<child>
<object class="GtkLabel" id="routes_gateway_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Gateway</property>
<style>
<class name="dim-label" />
@ -324,6 +321,24 @@
</object>
</child>
</template>
<object class="GtkSizeGroup" id="routes_address_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_address_label" />
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_netmask_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_netmask_label"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_gateway_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_gateway_label" />
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_metric_sizegroup">
<property name="mode">horizontal</property>
<widgets>

View file

@ -263,7 +263,6 @@
<property name="orientation">horizontal</property>
<child>
<object class="GtkLabel" id="routes_address_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Address</property>
<style>
<class name="dim-label" />
@ -275,7 +274,6 @@
</child>
<child>
<object class="GtkLabel" id="routes_prefix_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Prefix</property>
<style>
<class name="dim-label" />
@ -287,7 +285,6 @@
</child>
<child>
<object class="GtkLabel" id="routes_gateway_label">
<property name="hexpand">True</property>
<property name="label" translatable="yes">Gateway</property>
<style>
<class name="dim-label" />
@ -335,6 +332,24 @@
</object>
</child>
</template>
<object class="GtkSizeGroup" id="routes_address_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_address_label" />
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_prefix_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_prefix_label"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_gateway_sizegroup">
<property name="mode">horizontal</property>
<widgets>
<widget name="routes_gateway_label" />
</widgets>
</object>
<object class="GtkSizeGroup" id="routes_metric_sizegroup">
<property name="mode">horizontal</property>
<widgets>