Commit 8560752d authored by Jens Georg's avatar Jens Georg
Browse files

piwigo: Add option to show the certificate



So the user can inspect the certificate before proceeding
Signed-off-by: Jens Georg's avatarJens Georg <mail@jensge.org>

https://bugzilla.gnome.org/show_bug.cgi?id=767473
parent 9c2aa03d
......@@ -113,7 +113,7 @@ PKG_CHECK_MODULES(IMPORT, [gee-0.8 >= 0.8.5 glib-2.0 gio-2.0 sqlite3])
PKG_CHECK_MODULES(PUBLISHING, [gobject-2.0 glib-2.0 gexiv2 json-glib-1.0
gee-0.8 libsoup-2.4 libxml-2.0 gtk+-3.0
webkit2gtk-4.0])
webkit2gtk-4.0 gcr-3 gcr-ui-3])
PKG_CHECK_MODULES(TRANSITIONS, [gobject-2.0 cairo gio-2.0 gdk-pixbuf-2.0
gdk-3.0])
......
......@@ -192,8 +192,7 @@ public class Transaction {
}
/* Texts copied from epiphany */
public string detailed_error_from_tls_flags () {
TlsCertificate cert;
public string detailed_error_from_tls_flags (out TlsCertificate cert) {
TlsCertificateFlags tls_errors;
this.message.get_https_status (out cert, out tls_errors);
......
......@@ -1014,6 +1014,7 @@ internal class SSLErrorPane : Spit.Publishing.DialogPane, Object {
public SSLErrorPane (SessionLoginTransaction transaction,
string host) {
try {
TlsCertificate cert;
this.builder = new Gtk.Builder ();
this.builder.add_from_resource (Resources.RESOURCE_PATH +
"/piwigo_ssl_failure_pane.ui");
......@@ -1024,7 +1025,23 @@ internal class SSLErrorPane : Spit.Publishing.DialogPane, Object {
label.use_markup = true;
label = this.builder.get_object ("ssl_errors") as Gtk.Label;
label.set_text (transaction.detailed_error_from_tls_flags ());
var text = transaction.detailed_error_from_tls_flags (out cert);
label.set_text (text);
var info = this.builder.get_object ("default") as Gtk.Button;
info.clicked.connect (() => {
var simple_cert = new Gcr.SimpleCertificate (cert.certificate.data);
var widget = new Gcr.CertificateWidget (simple_cert);
var dialog = new Gtk.Dialog ();
dialog.get_content_area ().add (widget);
dialog.add_button ("_OK", Gtk.ResponseType.OK);
dialog.set_default_response (Gtk.ResponseType.OK);
dialog.set_default_size (640, -1);
dialog.show_all ();
dialog.run ();
dialog.destroy ();
});
var proceed = this.builder.get_object ("proceed_button") as Gtk.Button;
proceed.clicked.connect (() => { this.proceed (); });
......@@ -1047,7 +1064,7 @@ internal class SSLErrorPane : Spit.Publishing.DialogPane, Object {
}
public Gtk.Widget get_default_widget () {
return this.builder.get_object ("cancel_button") as Gtk.Widget;
return this.builder.get_object ("default") as Gtk.Widget;
}
public void on_pane_installed () { }
......
......@@ -67,8 +67,22 @@
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="default">
<property name="label" translatable="yes">Show the certificate…</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="proceed_button">
<property name="label" translatable="yes">I understand, please _proceed.</property>
......
......@@ -41,12 +41,16 @@ plugins_shotwell_publishing_shotwell_publishing_la_VALAFLAGS = \
--pkg shotwell-plugin-dev-1.0 \
--pkg libxml-2.0 \
--pkg webkit2gtk-4.0 \
--pkg gcr-3 \
--pkg gcr-ui-3 \
--vapidir $(abs_top_srcdir)/plugins
plugins_shotwell_publishing_shotwell_publishing_la_CFLAGS = \
-DPLUGIN_RESOURCE_PATH='"/org/gnome/Shotwell/Publishing"' \
$(PLUGIN_CFLAGS) \
$(COMMON_CFLAGS) \
-DGCR_API_SUBJECT_TO_CHANGE \
$(PUBLISHING_CFLAGS) \
-I $(top_srcdir)/plugins
plugins_shotwell_publishing_shotwell_publishing_la_LDFLAGS = \
......
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