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;
GtkLabel *active_label;
GtkStack *button_stack;
GtkCheckButton *checkbutton;
GtkSpinner *connecting_spinner;
GtkImage *encrypted_icon;
@ -240,19 +239,14 @@ update_ui (CcWifiConnectionRow *self)
strength = nm_access_point_get_strength (best_ap);
}
gtk_widget_set_visible (GTK_WIDGET (self->connecting_spinner), connecting);
if (connecting)
{
gtk_stack_set_visible_child_name (self->button_stack, "connecting");
gtk_spinner_start (self->connecting_spinner);
}
else
{
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);
@ -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_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, connecting_spinner);
gtk_widget_class_bind_template_child (widget_class, CcWifiConnectionRow, encrypted_icon);

View file

@ -72,64 +72,39 @@
</object>
</child>
<child>
<object class="GtkStack" id="button_stack">
<property name="name">button_stack</property>
<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">end</property>
<property name="hexpand">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="name">options_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="configure_clicked_cb" object="CcWifiConnectionRow" swapped="yes"/>
<child>
<object class="GtkButton">
<property name="name">options_button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<signal name="clicked" handler="configure_clicked_cb" object="CcWifiConnectionRow" swapped="yes"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">emblem-system-symbolic</property>
<property name="icon_size">1</property>
</object>
</child>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-name" translatable="yes">Options…</property>
</object>
</child>
<style>
<class name="image-button"/>
</style>
</object>
<packing>
<property name="name">configure</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="connecting_spinner">
<property name="name">connecting_spinner</property>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon_name">emblem-system-symbolic</property>
<property name="icon_size">1</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>
<child internal-child="accessible">
<object class="AtkObject">
<property name="AtkObject::accessible-name" translatable="yes">Options…</property>
</object>
<packing>
<property name="name">empty</property>
</packing>
</child>
<style>
<class name="image-button"/>
</style>
</object>
</child>
</object>