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:
parent
a1e26cdac1
commit
8ded3d956f
7 changed files with 12 additions and 20 deletions
|
@ -685,7 +685,7 @@ create_connection_cb (GtkWidget *button,
|
||||||
|
|
||||||
editor = net_connection_editor_new (NULL, NULL, NULL, self->client);
|
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))));
|
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
|
static void
|
||||||
|
|
|
@ -43,6 +43,12 @@
|
||||||
<object class="GtkStack" id="toplevel_stack">
|
<object class="GtkStack" id="toplevel_stack">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">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>
|
<child>
|
||||||
<object class="GtkNotebook" id="notebook">
|
<object class="GtkNotebook" id="notebook">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -74,7 +74,6 @@ struct _NetConnectionEditor
|
||||||
NMClientPermissionResult can_modify;
|
NMClientPermissionResult can_modify;
|
||||||
|
|
||||||
gboolean title_set;
|
gboolean title_set;
|
||||||
gboolean show_when_initialized;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
|
G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
|
||||||
|
@ -396,11 +395,9 @@ recheck_initialization (NetConnectionEditor *self)
|
||||||
if (!editor_is_initialized (self))
|
if (!editor_is_initialized (self))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
gtk_stack_set_visible_child (self->toplevel_stack, GTK_WIDGET (self->notebook));
|
||||||
gtk_notebook_set_current_page (self->notebook, 0);
|
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);
|
g_idle_add (idle_validate, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,16 +811,6 @@ net_connection_editor_new (NMConnection *connection,
|
||||||
return self;
|
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
|
static void
|
||||||
forgotten_cb (GObject *source_object,
|
forgotten_cb (GObject *source_object,
|
||||||
GAsyncResult *res,
|
GAsyncResult *res,
|
||||||
|
|
|
@ -34,7 +34,6 @@ NetConnectionEditor *net_connection_editor_new (NMConnection *connectio
|
||||||
NMClient *client);
|
NMClient *client);
|
||||||
void net_connection_editor_set_title (NetConnectionEditor *editor,
|
void net_connection_editor_set_title (NetConnectionEditor *editor,
|
||||||
const gchar *title);
|
const gchar *title);
|
||||||
void net_connection_editor_run (NetConnectionEditor *editor);
|
|
||||||
void net_connection_editor_forget (NetConnectionEditor *editor);
|
void net_connection_editor_forget (NetConnectionEditor *editor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -227,7 +227,7 @@ show_details (NetDeviceEthernet *self, GtkButton *button, const gchar *title)
|
||||||
if (title)
|
if (title)
|
||||||
net_connection_editor_set_title (editor, title);
|
net_connection_editor_set_title (editor, title);
|
||||||
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
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
|
static void
|
||||||
|
@ -412,7 +412,7 @@ add_profile_button_clicked_cb (NetDeviceEthernet *self)
|
||||||
editor = net_connection_editor_new (connection, self->device, NULL, self->client);
|
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))));
|
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);
|
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
|
static void
|
||||||
|
|
|
@ -974,7 +974,7 @@ show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConne
|
||||||
|
|
||||||
editor = net_connection_editor_new (connection, self->device, ap, self->client);
|
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))));
|
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
|
static void
|
||||||
|
|
|
@ -159,7 +159,7 @@ edit_connection (NetVpn *self)
|
||||||
net_connection_editor_set_title (editor, title);
|
net_connection_editor_set_title (editor, title);
|
||||||
|
|
||||||
g_signal_connect_object (editor, "done", G_CALLBACK (editor_done), self, G_CONNECT_SWAPPED);
|
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
|
static void
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue