path: root/gtk/ssl_cert.c
diff options
authorVincent Sanders <>2015-06-13 11:31:23 +0100
committerVincent Sanders <>2015-06-17 21:35:40 +0100
commit8ef292b9caf5cae2197493a87480723138f10344 (patch)
treefa39583104ab806b81f382eb85bc9f5a05331dfd /gtk/ssl_cert.c
parent16fbb97dbb1688fd9b6f19546792b4173bc30bf1 (diff)
Change GTK UI builder handling to use resource API
GTK UI builder resources have till now been exclusively stored on disc requiring netsurf to ship numerous additional resource files. This requires going to disc every time a UI action is performed which can become a lot of unwanted file handling. GLib/GTK has moved towards GResource handling for such resources instead. It now seems that migrating to this style of usage is expected and indeed the only portable way to include pixbufs. This introduces an API to hide the various implementation details of how resources are handled from the rest of the codebase.
Diffstat (limited to 'gtk/ssl_cert.c')
1 files changed, 9 insertions, 9 deletions
diff --git a/gtk/ssl_cert.c b/gtk/ssl_cert.c
index 3c00d71c5..742029f83 100644
--- a/gtk/ssl_cert.c
+++ b/gtk/ssl_cert.c
@@ -19,14 +19,14 @@
#include <stdlib.h>
#include <gtk/gtk.h>
-#include "utils/errors.h"
+#include "utils/log.h"
#include "utils/nsurl.h"
#include "desktop/tree.h"
#include "desktop/sslcert_viewer.h"
-#include "gtk/gui.h"
#include "gtk/treeview.h"
#include "gtk/scaffolding.h"
+#include "gtk/resources.h"
#include "gtk/ssl_cert.h"
@@ -75,9 +75,9 @@ void gtk_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
GtkDialog *dlg;
GtkScrolledWindow *scrolled;
GtkDrawingArea *drawing_area;
- GError *error = NULL;
GtkBuilder *builder;
GtkWindow *gtk_parent;
+ nserror res;
/* state while dlg is open */
session = calloc(sizeof(void *), 3);
@@ -85,15 +85,16 @@ void gtk_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
- 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);
+ res = nsgtk_builder_new_from_resname("ssl", &builder);
+ if (res != NSERROR_OK) {
+ LOG("SSL UI builder init failed");
+ cb(false, cbpw);
+ gtk_builder_connect_signals(builder, NULL);
sslcert_viewer_create_session_data(num, url, cb, cbpw, certs, &data);
ssl_current_session = data;
@@ -106,7 +107,6 @@ void gtk_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
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, GTK_WINDOW(dlg), scrolled,