summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-12-01 16:20:42 +0000
committerVincent Sanders <vince@kyllikki.org>2019-12-01 16:21:16 +0000
commit08e2cc32bab262979126837b82de6db2922b9afb (patch)
tree95f9bf5c6a76a2a3c00fee38fbcf757f5cf9da5d /frontends
parenta0af810966d37ca176fc78225b3156e5a69c77ee (diff)
downloadnetsurf-08e2cc32bab262979126837b82de6db2922b9afb.tar.gz
netsurf-08e2cc32bab262979126837b82de6db2922b9afb.tar.bz2
repurpose ssl certificate core window for nitial page infor window on gtk
Diffstat (limited to 'frontends')
-rw-r--r--frontends/gtk/Makefile2
-rw-r--r--frontends/gtk/gui.c1
-rw-r--r--frontends/gtk/page_info.c (renamed from frontends/gtk/ssl_cert.c)25
-rw-r--r--frontends/gtk/page_info.h (renamed from frontends/gtk/ssl_cert.h)19
-rw-r--r--frontends/gtk/toolbar.c36
5 files changed, 60 insertions, 23 deletions
diff --git a/frontends/gtk/Makefile b/frontends/gtk/Makefile
index 2f151e7b7..ae2e856ab 100644
--- a/frontends/gtk/Makefile
+++ b/frontends/gtk/Makefile
@@ -169,7 +169,7 @@ S_FRONTEND := gui.c schedule.c layout_pango.c bitmap.c plotters.c \
selection.c window.c fetch.c download.c menu.c print.c \
search.c tabs.c toolbar.c gettext.c compat.c viewdata.c \
viewsource.c preferences.c about.c resources.c corewindow.c \
- local_history.c global_history.c cookies.c hotlist.c ssl_cert.c
+ local_history.c global_history.c cookies.c hotlist.c page_info.c
# This is the final source build list
# Note this is deliberately *not* expanded here as common and image
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index 351b00281..609662e05 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -69,7 +69,6 @@
#include "gtk/schedule.h"
#include "gtk/selection.h"
#include "gtk/search.h"
-#include "gtk/ssl_cert.h"
#include "gtk/bitmap.h"
#include "gtk/resources.h"
#include "gtk/layout_pango.h"
diff --git a/frontends/gtk/ssl_cert.c b/frontends/gtk/page_info.c
index 9d98db1f6..adc2dfa66 100644
--- a/frontends/gtk/ssl_cert.c
+++ b/frontends/gtk/page_info.c
@@ -28,12 +28,13 @@
#include "utils/log.h"
#include "netsurf/keypress.h"
#include "netsurf/plotters.h"
+#include "netsurf/browser_window.h"
#include "desktop/sslcert_viewer.h"
#include "gtk/plotters.h"
#include "gtk/scaffolding.h"
#include "gtk/resources.h"
-#include "gtk/ssl_cert.h"
+#include "gtk/page_info.h"
#include "gtk/corewindow.h"
@@ -166,16 +167,24 @@ nsgtk_crtvrfy_draw(struct nsgtk_corewindow *nsgtk_cw, struct rect *r)
return NSERROR_OK;
}
-/* exported interface documented in gtk/ssl_cert.h */
-nserror gtk_cert_verify(struct nsurl *url,
- const struct ssl_cert_info *certs,
- unsigned long num,
- nserror (*cb)(bool proceed, void *pw),
- void *cbpw)
+static nserror dummy_cb(bool proceed, void *pw)
+{
+ return NSERROR_OK;
+}
+
+/* exported interface documented in gtk/page_info.h */
+nserror nsgtk_page_info(struct browser_window *bw)
{
struct nsgtk_crtvrfy_window *ncwin;
nserror res;
+ size_t num;
+ struct ssl_cert_info *chain;
+ struct nsurl *url;
+
+ browser_window_get_ssl_chain(bw, &num, &chain);
+ url = browser_window_access_url(bw);
+
ncwin = malloc(sizeof(struct nsgtk_crtvrfy_window));
if (ncwin == NULL) {
return NSERROR_NOMEM;
@@ -236,7 +245,7 @@ nserror gtk_cert_verify(struct nsurl *url,
}
/* initialise certificate viewing interface */
- res = sslcert_viewer_create_session_data(num, url, cb, cbpw, certs,
+ res = sslcert_viewer_create_session_data(num, url, dummy_cb, NULL, chain,
&ncwin->ssl_data);
if (res != NSERROR_OK) {
g_object_unref(G_OBJECT(ncwin->dlg));
diff --git a/frontends/gtk/ssl_cert.h b/frontends/gtk/page_info.h
index 1712756e9..ad443fcfd 100644
--- a/frontends/gtk/ssl_cert.h
+++ b/frontends/gtk/page_info.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2005 James Bursa <bursa@users.sourceforge.net>
+ * Copyright 2019 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -16,22 +16,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef NETSURF_GTK_SSL_CERT_H
-#define NETSURF_GTK_SSL_CERT_H 1
-
-struct nsurl;
-struct ssl_cert_info;
+#ifndef NETSURF_GTK_PAGE_INFO_H
+#define NETSURF_GTK_PAGE_INFO_H 1
/**
- * Prompt the user to verify a certificate with issuse.
+ * Page information window
*
- * \param url The URL being verified.
- * \param certs The certificate to be verified
- * \param num The number of certificates to be verified.
- * \param cb Callback upon user decision.
- * \param cbpw Context pointer passed to cb
+ * \param bw the browser window to get page information for
* \return NSERROR_OK or error code if prompt creation failed.
*/
-nserror gtk_cert_verify(struct nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
+nserror nsgtk_page_info(struct browser_window *bw);
#endif
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index 8eba86718..5d7d3f461 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -69,6 +69,7 @@
#include "gtk/about.h"
#include "gtk/gdk.h"
#include "gtk/bitmap.h"
+#include "gtk/page_info.h"
#include "gtk/toolbar.h"
/**
@@ -301,6 +302,9 @@ make_toolbar_item_throbber(bool sensitivity, bool edit)
* create url bar toolbar item widget
*
* create a gtk entry widget with a completion attached
+ *
+ * \param sensitivity if the entry should be created sensitive to input
+ * \param edit if the entry should be editable
*/
static GtkToolItem *
make_toolbar_item_url_bar(bool sensitivity, bool edit)
@@ -314,6 +318,9 @@ make_toolbar_item_url_bar(bool sensitivity, bool edit)
if (entry == NULL) {
return NULL;
}
+ nsgtk_entry_set_icon_from_icon_name(entry,
+ GTK_ENTRY_ICON_PRIMARY,
+ NSGTK_STOCK_INFO);
if (edit) {
gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
@@ -1941,6 +1948,31 @@ url_entry_changed_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
/**
+ * callback for url entry widget icon button release
+ *
+ * handler connected to url entry widget for the icon release signal
+ *
+ * \param widget The widget the signal is being delivered to.
+ * \param event The key change event that changed the entry.
+ * \param data The toolbar context passed when the signal was connected
+ * \return TRUE to allow activation.
+ */
+static void
+url_entry_icon_release_cb(GtkEntry *entry,
+ GtkEntryIconPosition icon_pos,
+ GdkEvent *event,
+ gpointer data)
+{
+ struct nsgtk_toolbar *tb = (struct nsgtk_toolbar *)data;
+ struct browser_window *bw;
+
+ bw = tb->get_bw(tb->get_ctx);
+
+ nsgtk_page_info(bw);
+}
+
+
+/**
* handler for web search tool bar entry item activate signal
*
* handler connected to web search entry widget for the activate signal
@@ -3276,6 +3308,10 @@ toolbar_connect_signal(struct nsgtk_toolbar *tb, nsgtk_toolbar_button itemid)
"changed",
G_CALLBACK(url_entry_changed_cb),
tb);
+ g_signal_connect(GTK_WIDGET(entry),
+ "icon-release",
+ G_CALLBACK(url_entry_icon_release_cb),
+ tb);
nsgtk_completion_connect_signals(entry,
tb->get_bw,