summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiří Klimeš <jklimes@redhat.com>2013-01-11 13:44:35 +0100
committerJiří Klimeš <jklimes@redhat.com>2013-01-11 13:44:35 +0100
commitc671d94a8458fea5fc54964558103d97d6be06e1 (patch)
tree01c140cf87939e0da12e06ab9c7ea8858182028d
parent0ca9e3fabcb9243c107535e84c125de408df7d66 (diff)
downloadnetwork-manager-applet-c671d94a8458fea5fc54964558103d97d6be06e1.tar.gz
editor: fix saving connection when ignoring CA certificate (bgo #691492)
When a nag dialog appeared and the user opted to ignore the warning, the connection was wot saved.
-rw-r--r--src/connection-editor/nm-connection-editor.c89
1 files changed, 48 insertions, 41 deletions
diff --git a/src/connection-editor/nm-connection-editor.c b/src/connection-editor/nm-connection-editor.c
index 816d3142..e03160da 100644
--- a/src/connection-editor/nm-connection-editor.c
+++ b/src/connection-editor/nm-connection-editor.c
@@ -939,22 +939,6 @@ editor_closed_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
}
static void
-nag_dialog_response_cb (GtkDialog *dialog,
- gint response,
- gpointer user_data)
-{
- NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
-
- gtk_widget_hide (GTK_WIDGET (dialog));
- if (response == GTK_RESPONSE_NO) {
- /* user opted not to correct the warning */
- g_signal_emit (self, editor_signals[EDITOR_DONE], 0, GTK_RESPONSE_OK, NULL);
- }
- g_signal_handler_disconnect (dialog, self->nag_id);
- self->nag_id = 0;
-}
-
-static void
added_connection_cb (NMRemoteSettings *settings,
NMRemoteConnection *connection,
GError *error,
@@ -996,34 +980,10 @@ updated_connection_cb (NMRemoteConnection *connection, GError *error, gpointer u
}
static void
-ok_button_clicked_cb (GtkWidget *widget, gpointer user_data)
+ok_button_clicked_save_connection (NMConnectionEditor *self)
{
- NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
- GSList *iter;
GError *error = NULL;
- /* If the dialog is busy waiting for authorization or something,
- * don't destroy it until authorization returns.
- */
- if (self->busy)
- return;
-
- /* Make sure the user is warned about insecure security options like no
- * CA certificate.
- */
- g_warn_if_fail (self->nag_id == 0);
- for (iter = self->pages; iter; iter = g_slist_next (iter)) {
- CEPage *page = iter->data;
- GtkWidget *nag_dialog;
-
- nag_dialog = ce_page_nag_user (page);
- if (nag_dialog) {
- gtk_window_set_transient_for (GTK_WINDOW (nag_dialog), GTK_WINDOW (self->window));
- self->nag_id = g_signal_connect (nag_dialog, "response", G_CALLBACK (nag_dialog_response_cb), self);
- return;
- }
- }
-
if (!nm_connection_editor_update_connection (self))
return;
@@ -1055,6 +1015,53 @@ ok_button_clicked_cb (GtkWidget *widget, gpointer user_data)
}
static void
+nag_dialog_response_cb (GtkDialog *dialog,
+ gint response,
+ gpointer user_data)
+{
+ NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
+
+ gtk_widget_hide (GTK_WIDGET (dialog));
+ if (response == GTK_RESPONSE_NO) {
+ /* user opted not to correct the warning */
+ ok_button_clicked_save_connection (self);
+ }
+ g_signal_handler_disconnect (dialog, self->nag_id);
+ self->nag_id = 0;
+}
+
+static void
+ok_button_clicked_cb (GtkWidget *widget, gpointer user_data)
+{
+ NMConnectionEditor *self = NM_CONNECTION_EDITOR (user_data);
+ GSList *iter;
+
+ /* If the dialog is busy waiting for authorization or something,
+ * don't destroy it until authorization returns.
+ */
+ if (self->busy)
+ return;
+
+ /* Make sure the user is warned about insecure security options like no
+ * CA certificate.
+ */
+ g_warn_if_fail (self->nag_id == 0);
+ for (iter = self->pages; iter; iter = g_slist_next (iter)) {
+ CEPage *page = iter->data;
+ GtkWidget *nag_dialog;
+
+ nag_dialog = ce_page_nag_user (page);
+ if (nag_dialog) {
+ gtk_window_set_transient_for (GTK_WINDOW (nag_dialog), GTK_WINDOW (self->window));
+ self->nag_id = g_signal_connect (nag_dialog, "response", G_CALLBACK (nag_dialog_response_cb), self);
+ return;
+ }
+ }
+
+ ok_button_clicked_save_connection (self);
+}
+
+static void
vpn_export_get_secrets_cb (NMRemoteConnection *connection,
GHashTable *secrets,
GError *error,