Commit d9215e1a authored by Lubomir Rintel's avatar Lubomir Rintel
Browse files

connection-editor: don't defer creation of vpn connection to idle

Now that GtkApplication makes good decisions about when to quit (when no
windows are present), the magic that deferred creation of vpn type
selector is useless. Worse even, it makes GtkApplication believe that
we're done and shuts it down before an editor window is added to it.

#9

Reported-by: Jan Tojnar
parent 346630de
Pipeline #19296 passed with stages
in 16 minutes and 52 seconds
...@@ -39,39 +39,6 @@ gboolean nm_ce_keep_above; ...@@ -39,39 +39,6 @@ gboolean nm_ce_keep_above;
/*************************************************/ /*************************************************/
typedef struct {
gboolean create;
NMConnectionList *list;
GType ctype;
char *detail;
char *import_filename;
} CreateConnectionInfo;
static gboolean
idle_create_connection (gpointer user_data)
{
CreateConnectionInfo *info = user_data;
if (info->create) {
if (!info->ctype)
nm_connection_list_add (info->list);
else {
nm_connection_list_create (info->list, info->ctype,
info->detail, NULL);
}
} else {
/* import */
nm_connection_list_create (info->list, info->ctype,
info->detail, info->import_filename);
}
g_object_unref (info->list);
g_free (info->detail);
g_free (info->import_filename);
g_slice_free (CreateConnectionInfo, info);
return FALSE;
}
static gboolean static gboolean
handle_arguments (GApplication *application, handle_arguments (GApplication *application,
const char *type, const char *type,
...@@ -85,7 +52,6 @@ handle_arguments (GApplication *application, ...@@ -85,7 +52,6 @@ handle_arguments (GApplication *application,
GType ctype = 0; GType ctype = 0;
gs_free char *type_tmp = NULL; gs_free char *type_tmp = NULL;
const char *p, *detail = NULL; const char *p, *detail = NULL;
CreateConnectionInfo *info;
if (type) { if (type) {
p = strchr (type, ':'); p = strchr (type, ':');
...@@ -113,21 +79,15 @@ handle_arguments (GApplication *application, ...@@ -113,21 +79,15 @@ handle_arguments (GApplication *application,
if (show) { if (show) {
/* Just show the given connection type page */ /* Just show the given connection type page */
nm_connection_list_set_type (list, ctype); nm_connection_list_set_type (list, ctype);
} else if (create || import) { } else if (create) {
/* If type is "vpn" and the user cancels the "vpn type" dialog, we need if (!ctype)
* to quit. But we haven't even started yet. So postpone this to an idle. nm_connection_list_add (list);
*/ else
info = g_slice_new0 (CreateConnectionInfo); nm_connection_list_create (list, ctype, detail, NULL);
info->list = g_object_ref (list); show_list = FALSE;
info->create = create; } else if (import) {
info->detail = g_strdup (detail); /* import */
if (create) nm_connection_list_create (list, ctype, detail, import);
info->ctype = ctype;
else {
info->ctype = NM_TYPE_SETTING_VPN;
info->import_filename = g_strdup (import);
}
g_idle_add (idle_create_connection, info);
show_list = FALSE; show_list = FALSE;
} else if (edit_uuid) { } else if (edit_uuid) {
/* Show the edit dialog for the given UUID */ /* Show the edit dialog for the given UUID */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment