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;
/*************************************************/
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
handle_arguments (GApplication *application,
const char *type,
......@@ -85,7 +52,6 @@ handle_arguments (GApplication *application,
GType ctype = 0;
gs_free char *type_tmp = NULL;
const char *p, *detail = NULL;
CreateConnectionInfo *info;
if (type) {
p = strchr (type, ':');
......@@ -113,21 +79,15 @@ handle_arguments (GApplication *application,
if (show) {
/* Just show the given connection type page */
nm_connection_list_set_type (list, ctype);
} else if (create || import) {
/* If type is "vpn" and the user cancels the "vpn type" dialog, we need
* to quit. But we haven't even started yet. So postpone this to an idle.
*/
info = g_slice_new0 (CreateConnectionInfo);
info->list = g_object_ref (list);
info->create = create;
info->detail = g_strdup (detail);
if (create)
info->ctype = ctype;
else {
info->ctype = NM_TYPE_SETTING_VPN;
info->import_filename = g_strdup (import);
}
g_idle_add (idle_create_connection, info);
} else if (create) {
if (!ctype)
nm_connection_list_add (list);
else
nm_connection_list_create (list, ctype, detail, NULL);
show_list = FALSE;
} else if (import) {
/* import */
nm_connection_list_create (list, ctype, detail, import);
show_list = FALSE;
} else if (edit_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