]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-tls-dialog.c
Move should_create_salut_account to local-xmpp-assistant-widget
[empathy.git] / libempathy-gtk / empathy-tls-dialog.c
index 9213ac45891bfe981cf03980456e6ca4bfb7de86..9fb2297a564be7d235bffb562f21bd36ad208cb0 100644 (file)
@@ -26,7 +26,7 @@
 #include <gcr/gcr.h>
 #include <telepathy-glib/util.h>
 
-#include "gcr-simple-certificate.h"
+#include <gcr/gcr.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_TLS
 #include <libempathy/empathy-debug.h>
@@ -256,6 +256,16 @@ checkbox_toggled_cb (GtkToggleButton *checkbox,
   g_object_notify (G_OBJECT (self), "remember");
 }
 
+static void
+certificate_invalidated_cb (EmpathyTLSCertificate *certificate,
+    guint domain,
+    gint code,
+    gchar *message,
+    EmpathyTLSDialog *self)
+{
+  gtk_widget_destroy (GTK_WIDGET (self));
+}
+
 static void
 empathy_tls_dialog_constructed (GObject *object)
 {
@@ -268,12 +278,13 @@ empathy_tls_dialog_constructed (GObject *object)
 
   gtk_dialog_add_buttons (dialog,
       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-      _("Continue"), GTK_RESPONSE_YES,
+      _("C_ontinue"), GTK_RESPONSE_YES,
       NULL);
 
   text = reason_to_string (self);
 
   g_object_set (message_dialog,
+      "title", _("Untrusted connection"),
       "text", _("This connection is untrusted. Would you like to "
           "continue anyway?"),
       "secondary-text", text,
@@ -283,21 +294,12 @@ empathy_tls_dialog_constructed (GObject *object)
 
   content_area = gtk_dialog_get_content_area (dialog);
 
-  /* FIXME: right now we do this only if the error is SelfSigned, as we can
-   * easily store the new CA cert in $XDG_CONFIG_DIR/telepathy/certs in that
-   * case. For the other errors, we probably need a smarter/more powerful
-   * certificate storage.
-   */
-  if (priv->reason == EMP_TLS_CERTIFICATE_REJECT_REASON_SELF_SIGNED)
-    {
-      checkbox = gtk_check_button_new_with_label (
-          _("Remember this choice for future connections"));
-      gtk_box_pack_end (GTK_BOX (content_area), checkbox, FALSE, FALSE, 0);
-      gtk_widget_show (checkbox);
-
-      g_signal_connect (checkbox, "toggled",
-          G_CALLBACK (checkbox_toggled_cb), self);
-    }
+  checkbox = gtk_check_button_new_with_label (
+      _("Remember this choice for future connections"));
+  gtk_box_pack_end (GTK_BOX (content_area), checkbox, FALSE, FALSE, 0);
+  gtk_widget_show (checkbox);
+  g_signal_connect (checkbox, "toggled", G_CALLBACK (checkbox_toggled_cb),
+      self);
 
   text = g_strdup_printf ("<b>%s</b>", _("Certificate Details"));
   expander = gtk_expander_new (text);
@@ -310,6 +312,11 @@ empathy_tls_dialog_constructed (GObject *object)
   details = build_gcr_widget (self);
   gtk_container_add (GTK_CONTAINER (expander), details);
   gtk_widget_show (details);
+
+  gtk_window_set_keep_above (GTK_WINDOW (self), TRUE);
+
+  tp_g_signal_connect_object (priv->certificate, "invalidated",
+      G_CALLBACK (certificate_invalidated_cb), self, 0);
 }
 
 static void