[gnome-control-center/always-show-config-button-on-wifi-list: 11/11] network: Show configuration button during wifi association




commit c7bd4428399588dc777cdca45f5f415f37cfec66
Author: Felipe Borges <felipeborges gnome org>
Date:   Wed Aug 25 16:30:06 2021 +0200

    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

 panels/network/cc-wifi-connection-row.c  |  9 +---
 panels/network/cc-wifi-connection-row.ui | 73 +++++++++++---------------------
 2 files changed, 25 insertions(+), 57 deletions(-)
---
diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c
index cee92db61..d1ded0fc9 100644
--- a/panels/network/cc-wifi-connection-row.c
+++ b/panels/network/cc-wifi-connection-row.c
@@ -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);
diff --git a/panels/network/cc-wifi-connection-row.ui b/panels/network/cc-wifi-connection-row.ui
index 38bb8a988..39bb6db8b 100644
--- a/panels/network/cc-wifi-connection-row.ui
+++ b/panels/network/cc-wifi-connection-row.ui
@@ -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>
-            <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>
+            <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="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>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]