void gui_cert_verify(const char *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw) { static struct nsgtk_treeview *ssl_window; struct sslcert_session_data *data; GtkButton *accept, *reject; void **session = calloc(sizeof(void *), 3); GtkWindow *window; GtkScrolledWindow *scrolled; GtkDrawingArea *drawing_area; GError* error = NULL; GtkBuilder* builder; 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); return; } data = sslcert_create_session_data(num, url, cb, cbpw); window = GTK_WINDOW(gtk_builder_get_object(builder, "wndSSLProblem")); 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(sslcert_get_tree_flags(), window, scrolled, drawing_area); if (ssl_window == NULL) return; sslcert_load_tree(nsgtk_treeview_get_tree(ssl_window), certs, data); accept = GTK_BUTTON(gtk_builder_get_object(builder, "sslaccept")); reject = GTK_BUTTON(gtk_builder_get_object(builder, "sslreject")); session[0] = builder; session[1] = ssl_window; session[2] = data; #define CONNECT(obj, sig, callback, ptr) \ g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr)) CONNECT(accept, "clicked", nsgtk_ssl_accept, session); CONNECT(reject, "clicked", nsgtk_ssl_reject, session); CONNECT(window, "delete_event", G_CALLBACK(nsgtk_ssl_delete_event), (gpointer)session); gtk_widget_show(GTK_WIDGET(window)); }
/* exported interface documented in gtk/cookies.h */ nserror nsgtk_cookies_init(void) { GtkScrolledWindow *scrolled; GtkDrawingArea *drawing_area; nserror res; res = nsgtk_builder_new_from_resname("cookies", &cookie_builder); if (res != NSERROR_OK) { LOG("Cookie UI builder init failed"); return res; } gtk_builder_connect_signals(cookie_builder, NULL); wndCookies = GTK_WINDOW(gtk_builder_get_object(cookie_builder, "wndCookies")); scrolled = GTK_SCROLLED_WINDOW(gtk_builder_get_object(cookie_builder, "cookiesScrolled")); drawing_area = GTK_DRAWING_AREA(gtk_builder_get_object(cookie_builder, "cookiesDrawingArea")); cookies_treeview = nsgtk_treeview_create(TREE_COOKIES, wndCookies, scrolled, drawing_area, NULL); if (cookies_treeview == NULL) { return NSERROR_INIT_FAILED; } #define CONNECT(obj, sig, callback, ptr) \ g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr)) CONNECT(wndCookies, "delete_event", gtk_widget_hide_on_delete, NULL); CONNECT(wndCookies, "hide", nsgtk_tree_window_hide, cookies_treeview); nsgtk_cookies_init_menu(); return NSERROR_OK; }