[gnome-control-center] network: Show spinner instead of delaying dialog



commit 8ded3d956fb58ee8861acd685dca6600a491a001
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Nov 19 11:43:16 2020 +1300

    network: Show spinner instead of delaying dialog
    
    It's better to respond to the user immediately rather than delay the window opening.

 panels/network/cc-network-panel.c                        |  2 +-
 panels/network/connection-editor/connection-editor.ui    |  6 ++++++
 panels/network/connection-editor/net-connection-editor.c | 15 +--------------
 panels/network/connection-editor/net-connection-editor.h |  1 -
 panels/network/net-device-ethernet.c                     |  4 ++--
 panels/network/net-device-wifi.c                         |  2 +-
 panels/network/net-vpn.c                                 |  2 +-
 7 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 0bfd14b72..01b164ea0 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -685,7 +685,7 @@ create_connection_cb (GtkWidget      *button,
 
         editor = net_connection_editor_new (NULL, NULL, NULL, self->client);
         gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET 
(self))));
-        net_connection_editor_run (editor);
+        gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void
diff --git a/panels/network/connection-editor/connection-editor.ui 
b/panels/network/connection-editor/connection-editor.ui
index 17a096f86..746e86b1c 100644
--- a/panels/network/connection-editor/connection-editor.ui
+++ b/panels/network/connection-editor/connection-editor.ui
@@ -43,6 +43,12 @@
           <object class="GtkStack" id="toplevel_stack">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <child>
+              <object class="GtkSpinner" id="spinner">
+                <property name="visible">True</property>
+                <property name="active">True</property>
+              </object>
+            </child>
             <child>
               <object class="GtkNotebook" id="notebook">
                 <property name="visible">True</property>
diff --git a/panels/network/connection-editor/net-connection-editor.c 
b/panels/network/connection-editor/net-connection-editor.c
index 4233d7393..0e8ae890f 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -74,7 +74,6 @@ struct _NetConnectionEditor
         NMClientPermissionResult can_modify;
 
         gboolean          title_set;
-        gboolean          show_when_initialized;
 };
 
 G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
@@ -396,11 +395,9 @@ recheck_initialization (NetConnectionEditor *self)
         if (!editor_is_initialized (self))
                 return;
 
+        gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->notebook));
         gtk_notebook_set_current_page (self->notebook, 0);
 
-        if (self->show_when_initialized)
-                gtk_window_present (GTK_WINDOW (self));
-
         g_idle_add (idle_validate, self);
 }
 
@@ -814,16 +811,6 @@ net_connection_editor_new (NMConnection     *connection,
         return self;
 }
 
-void
-net_connection_editor_run (NetConnectionEditor *self)
-{
-        if (!editor_is_initialized (self)) {
-                self->show_when_initialized = TRUE;
-                return;
-        }
-        gtk_window_present (GTK_WINDOW (self));
-}
-
 static void
 forgotten_cb (GObject *source_object,
               GAsyncResult *res,
diff --git a/panels/network/connection-editor/net-connection-editor.h 
b/panels/network/connection-editor/net-connection-editor.h
index c8132e39e..cbd197f9f 100644
--- a/panels/network/connection-editor/net-connection-editor.h
+++ b/panels/network/connection-editor/net-connection-editor.h
@@ -34,7 +34,6 @@ NetConnectionEditor *net_connection_editor_new      (NMConnection     *connectio
                                                      NMClient         *client);
 void                 net_connection_editor_set_title (NetConnectionEditor  *editor,
                                                       const gchar          *title);
-void                 net_connection_editor_run      (NetConnectionEditor   *editor);
 void                 net_connection_editor_forget   (NetConnectionEditor   *editor);
 
 G_END_DECLS
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index ac019f684..73adb62fc 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -227,7 +227,7 @@ show_details (NetDeviceEthernet *self, GtkButton *button, const gchar *title)
         if (title)
                 net_connection_editor_set_title (editor, title);
         g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
-        net_connection_editor_run (editor);
+        gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void
@@ -412,7 +412,7 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
         editor = net_connection_editor_new (connection, self->device, NULL, self->client);
         gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET 
(self))));
         g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
-        net_connection_editor_run (editor);
+        gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 8d262fd80..69fe2e122 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -974,7 +974,7 @@ show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConne
 
         editor = net_connection_editor_new (connection, self->device, ap, self->client);
         gtk_window_set_transient_for (GTK_WINDOW (editor), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET 
(row))));
-        net_connection_editor_run (editor);
+        gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index a1b8821ba..44400662b 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -159,7 +159,7 @@ edit_connection (NetVpn *self)
         net_connection_editor_set_title (editor, title);
 
         g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
-        net_connection_editor_run (editor);
+        gtk_window_present (GTK_WINDOW (editor));
 }
 
 static void


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