network: Show spinner instead of delaying dialog

It's better to respond to the user immediately rather than delay the window opening.
This commit is contained in:
Robert Ancell 2020-11-19 11:43:16 +13:00 committed by Georges Basile Stavracas Neto
parent a1e26cdac1
commit 8ded3d956f
7 changed files with 12 additions and 20 deletions

View file

@ -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

View file

@ -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>

View file

@ -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,

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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