Fixup gtk3 ssl certificate dialog and ensure its parent is set.
This commit is contained in:
parent
997e8999d5
commit
fb73ff80ed
97
gtk/gui.c
97
gtk/gui.c
|
@ -82,11 +82,6 @@ struct glade_file_location_s *glade_file_location;
|
|||
static GtkWindow *nsgtk_warning_window;
|
||||
GtkWidget *widWarning;
|
||||
|
||||
static void nsgtk_ssl_accept(GtkButton *w, gpointer data);
|
||||
static void nsgtk_ssl_reject(GtkWidget *w, gpointer data);
|
||||
static gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event,
|
||||
gpointer data);
|
||||
|
||||
#define THROBBER_FRAMES 9
|
||||
|
||||
char **respaths; /** resource search path vector */
|
||||
|
@ -583,6 +578,39 @@ void warn_user(const char *warning, const char *detail)
|
|||
}
|
||||
|
||||
|
||||
static void nsgtk_ssl_accept(GtkButton *w, gpointer data)
|
||||
{
|
||||
void **session = data;
|
||||
GtkBuilder *x = session[0];
|
||||
struct nsgtk_treeview *wnd = session[1];
|
||||
struct sslcert_session_data *ssl_data = session[2];
|
||||
|
||||
sslcert_viewer_accept(ssl_data);
|
||||
|
||||
nsgtk_treeview_destroy(wnd);
|
||||
g_object_unref(G_OBJECT(x));
|
||||
free(session);
|
||||
}
|
||||
|
||||
static void nsgtk_ssl_reject(GtkWidget *w, gpointer data)
|
||||
{
|
||||
void **session = data;
|
||||
GtkBuilder *x = session[0];
|
||||
struct nsgtk_treeview *wnd = session[1];
|
||||
struct sslcert_session_data *ssl_data = session[2];
|
||||
|
||||
sslcert_viewer_reject(ssl_data);
|
||||
|
||||
nsgtk_treeview_destroy(wnd);
|
||||
g_object_unref(G_OBJECT(x));
|
||||
free(session);
|
||||
}
|
||||
|
||||
static gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event, gpointer data)
|
||||
{
|
||||
nsgtk_ssl_reject(w, data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
||||
unsigned long num, nserror (*cb)(bool proceed, void *pw),
|
||||
|
@ -592,19 +620,20 @@ static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
|||
struct sslcert_session_data *data;
|
||||
GtkButton *accept, *reject;
|
||||
void **session;
|
||||
GtkWindow *window;
|
||||
GtkDialog *dlg;
|
||||
GtkScrolledWindow *scrolled;
|
||||
GtkDrawingArea *drawing_area;
|
||||
GError* error = NULL;
|
||||
GtkBuilder* builder;
|
||||
GError *error = NULL;
|
||||
GtkBuilder *builder;
|
||||
GtkWindow *gtk_parent;
|
||||
|
||||
/* state while window is open */
|
||||
/* state while dlg is open */
|
||||
session = calloc(sizeof(void *), 3);
|
||||
if (session == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
builder = gtk_builder_new ();
|
||||
builder = gtk_builder_new();
|
||||
if (!gtk_builder_add_from_file(builder, glade_file_location->ssl, &error)) {
|
||||
g_warning("Couldn't load builder file: %s", error->message);
|
||||
g_error_free(error);
|
||||
|
@ -616,16 +645,22 @@ static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
|||
sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, &data);
|
||||
ssl_current_session = data;
|
||||
|
||||
window = GTK_WINDOW(gtk_builder_get_object(builder, "wndSSLProblem"));
|
||||
dlg = GTK_DIALOG(gtk_builder_get_object(builder, "wndSSLProblem"));
|
||||
|
||||
/* set parent for transient dialog */
|
||||
gtk_parent = nsgtk_scaffolding_window(nsgtk_current_scaffolding());
|
||||
gtk_window_set_transient_for(GTK_WINDOW(dlg), gtk_parent);
|
||||
|
||||
scrolled = GTK_SCROLLED_WINDOW(gtk_builder_get_object(builder, "SSLScrolled"));
|
||||
drawing_area = GTK_DRAWING_AREA(gtk_builder_get_object(builder, "SSLDrawingArea"));
|
||||
|
||||
|
||||
ssl_window = nsgtk_treeview_create(TREE_SSLCERT, window, scrolled,
|
||||
ssl_window = nsgtk_treeview_create(TREE_SSLCERT, GTK_WINDOW(dlg), scrolled,
|
||||
drawing_area);
|
||||
|
||||
if (ssl_window == NULL) {
|
||||
free(session);
|
||||
g_object_unref(G_OBJECT(dlg));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -641,44 +676,10 @@ static void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
|
|||
|
||||
CONNECT(accept, "clicked", nsgtk_ssl_accept, session);
|
||||
CONNECT(reject, "clicked", nsgtk_ssl_reject, session);
|
||||
CONNECT(window, "delete_event", G_CALLBACK(nsgtk_ssl_delete_event),
|
||||
CONNECT(dlg, "delete_event", G_CALLBACK(nsgtk_ssl_delete_event),
|
||||
(gpointer)session);
|
||||
|
||||
gtk_widget_show(GTK_WIDGET(window));
|
||||
}
|
||||
|
||||
void nsgtk_ssl_accept(GtkButton *w, gpointer data)
|
||||
{
|
||||
void **session = data;
|
||||
GtkBuilder *x = session[0];
|
||||
struct nsgtk_treeview *wnd = session[1];
|
||||
struct sslcert_session_data *ssl_data = session[2];
|
||||
|
||||
sslcert_viewer_accept(ssl_data);
|
||||
|
||||
nsgtk_treeview_destroy(wnd);
|
||||
g_object_unref(G_OBJECT(x));
|
||||
free(session);
|
||||
}
|
||||
|
||||
void nsgtk_ssl_reject(GtkWidget *w, gpointer data)
|
||||
{
|
||||
void **session = data;
|
||||
GtkBuilder *x = session[0];
|
||||
struct nsgtk_treeview *wnd = session[1];
|
||||
struct sslcert_session_data *ssl_data = session[2];
|
||||
|
||||
sslcert_viewer_reject(ssl_data);
|
||||
|
||||
nsgtk_treeview_destroy(wnd);
|
||||
g_object_unref(G_OBJECT(x));
|
||||
free(session);
|
||||
}
|
||||
|
||||
gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event, gpointer data)
|
||||
{
|
||||
nsgtk_ssl_reject(w, data);
|
||||
return FALSE;
|
||||
gtk_widget_show(GTK_WIDGET(dlg));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,70 +1,146 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--*- mode: xml -*-->
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkImage" id="image2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="image3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</object>
|
||||
<object class="GtkDialog" id="wndSSLProblem">
|
||||
<property name="border_width">1</property>
|
||||
<property name="title" translatable="yes">SSL certificate problem</property>
|
||||
<property name="modal">True</property>
|
||||
<property name="default_width">500</property>
|
||||
<property name="default_height">250</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="default_width">440</property>
|
||||
<property name="default_height">260</property>
|
||||
<property name="destroy_with_parent">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<child internal-child="vbox">
|
||||
<object class="GtkVBox" id="dialog-vbox3">
|
||||
<property name="visible">True</property>
|
||||
<object class="GtkBox" id="dialog-vbox1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">2</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox15">
|
||||
<object class="GtkButton" id="sslreject">
|
||||
<property name="label" translatable="yes">_Reject</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image6">
|
||||
<property name="visible">True</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="icon_size">6</property>
|
||||
<property name="icon_name">gtk-dialog-warning</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">image3</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox13">
|
||||
<object class="GtkButton" id="sslaccept">
|
||||
<property name="label" translatable="yes">_Accept</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="image">image2</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label62">
|
||||
<object class="GtkBox" id="box1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">8</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
<property name="icon-size">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">NetSurf failed to verify the authenticity of an SSL certificate. Please verify the details presented below.</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame13">
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="shadow_type">none</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment17">
|
||||
<object class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="SSLScrolled">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport" id="SSLViewport">
|
||||
<property name="visible">True</property>
|
||||
<property name="resize_mode">GTK_RESIZE_QUEUE</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="SSLDrawingArea">
|
||||
<property name="visible">True</property>
|
||||
<property name="app_paintable">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_EXPOSURE_MASK | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -74,122 +150,25 @@
|
|||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label63">
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Certificate chain</b></property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Certificate Chain</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkHButtonBox" id="dialog-action_area3">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="sslreject">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment16">
|
||||
<property name="visible">True</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox14">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image5">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-cancel</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label61">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Reject</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="sslaccept">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment15">
|
||||
<property name="visible">True</property>
|
||||
<property name="xscale">0</property>
|
||||
<property name="yscale">0</property>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox13">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">2</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image4">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-apply</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label60">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Accept</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="pack_type">GTK_PACK_END</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in New Issue