network: Show configuration button during wifi association

While connecting to a Wifi network g-c-c would hide the button that
launches the connection preferences dialog. This is inconvenient
when network manager keeps on attempting to reconnect to a
misconfigured network.

These changes rework the logic of the buttons by always presenting
the configuration button and toggling the visibility of the spinner
accordingly.

Fixes #493
This commit is contained in:
Felipe Borges 2021-08-25 16:30:06 +02:00 committed by Georges Basile Stavracas Neto
parent af4ad7ade2
commit c7bd442839
2 changed files with 25 additions and 57 deletions

View file

@ -33,7 +33,6 @@ struct _CcWifiConnectionRow
NMConnection *connection; NMConnection *connection;
GtkLabel *active_label; GtkLabel *active_label;
GtkStack *button_stack;
GtkCheckButton *checkbutton; GtkCheckButton *checkbutton;
GtkSpinner *connecting_spinner; GtkSpinner *connecting_spinner;
GtkImage *encrypted_icon; GtkImage *encrypted_icon;
@ -240,19 +239,14 @@ update_ui (CcWifiConnectionRow *self)
strength = nm_access_point_get_strength (best_ap); strength = nm_access_point_get_strength (best_ap);
} }
gtk_widget_set_visible (GTK_WIDGET (self->connecting_spinner), connecting);
if (connecting) if (connecting)
{ {
gtk_stack_set_visible_child_name (self->button_stack, "connecting");
gtk_spinner_start (self->connecting_spinner); gtk_spinner_start (self->connecting_spinner);
} }
else else
{ {
gtk_spinner_stop (self->connecting_spinner); gtk_spinner_stop (self->connecting_spinner);
if (self->connection)
gtk_stack_set_visible_child_name (self->button_stack, "configure");
else
gtk_stack_set_visible_child_name (self->button_stack, "empty");
} }
gtk_widget_set_visible (GTK_WIDGET (self->active_label), active); gtk_widget_set_visible (GTK_WIDGET (self->active_label), active);
@ -459,7 +453,6 @@ cc_wifi_connection_row_class_init (CcWifiConnectionRowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/cc-wifi-connection-row.ui"); gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/network/cc-wifi-connection-row.ui");
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, active_label); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, active_label);
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, button_stack);
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, checkbutton); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, checkbutton);
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, connecting_spinner); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, connecting_spinner);
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, encrypted_icon); gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, encrypted_icon);

View file

@ -72,12 +72,14 @@
</object> </object>
</child> </child>
<child> <child>
<object class="GtkStack" id="button_stack"> <object class="GtkSpinner" id="connecting_spinner">
<property name="name">button_stack</property> <property name="name">connecting_spinner</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">end</property> <property name="halign">center</property>
<property name="hexpand">False</property> <property name="valign">center</property>
</object>
</child>
<child> <child>
<object class="GtkButton"> <object class="GtkButton">
<property name="name">options_button</property> <property name="name">options_button</property>
@ -104,33 +106,6 @@
<class name="image-button"/> <class name="image-button"/>
</style> </style>
</object> </object>
<packing>
<property name="name">configure</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="connecting_spinner">
<property name="name">connecting_spinner</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<property name="name">connecting</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="name">empty_box</property>
</object>
<packing>
<property name="name">empty</property>
</packing>
</child>
</object>
</child> </child>
</object> </object>
</child> </child>