summaryrefslogtreecommitdiff
path: root/frontends/gtk/scaffolding.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/gtk/scaffolding.c')
-rw-r--r--frontends/gtk/scaffolding.c445
1 files changed, 209 insertions, 236 deletions
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index bbc568e15..bedad9140 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -61,6 +61,7 @@
#include "gtk/bitmap.h"
#include "gtk/gui.h"
#include "gtk/global_history.h"
+#include "gtk/local_history.h"
#include "gtk/hotlist.h"
#include "gtk/download.h"
#include "gtk/menu.h"
@@ -103,15 +104,12 @@ static gboolean nsgtk_on_##q##_activate(GtkButton *widget, gpointer data)
/** Core scaffolding structure. */
struct nsgtk_scaffolding {
- /** global linked list of scaffoldings for gui interface adjustments */
+ /** global linked list of scaffolding for gui interface adjustments */
struct nsgtk_scaffolding *next, *prev;
/** currently active gui browsing context */
struct gui_window *top_level;
- /** local history window */
- struct gtk_history_window *history_window;
-
/** Builder object scaffold was created from */
GtkBuilder *builder;
@@ -150,7 +148,6 @@ struct nsgtk_scaffolding {
/** link popup menu */
struct nsgtk_link_menu *link_menu;
-
};
/** current scaffold for model dialogue use */
@@ -159,19 +156,30 @@ static struct nsgtk_scaffolding *scaf_current;
/** global list for interface changes */
static struct nsgtk_scaffolding *scaf_list = NULL;
-/** holds the context data for what's under the pointer, when the contextual
- * menu is opened.
+/**
+ * holds the context data for what's under the pointer, when the
+ * contextual menu is opened.
*/
static struct browser_window_features current_menu_features;
/**
- * Helper to hide popup menu entries by grouping
+ * Helper to hide popup menu entries by grouping.
+ *
+ * \param menu The popup menu to modify.
+ * \param submenu flag to indicate if submenus should be hidden.
+ * \param nav flag to indicate if navigation entries should be hidden.
+ * \param cnp flag to indicate if cut and paste entries should be hidden.
+ * \param custom flag to indicate if menu customisation is hidden.
*/
-static void popup_menu_hide(struct nsgtk_popup_menu *menu, bool submenu,
- bool nav, bool cnp, bool custom)
+static void
+popup_menu_hide(struct nsgtk_popup_menu *menu,
+ bool submenu,
+ bool nav,
+ bool cnp,
+ bool custom)
{
- if (submenu){
+ if (submenu) {
gtk_widget_hide(GTK_WIDGET(menu->file_menuitem));
gtk_widget_hide(GTK_WIDGET(menu->edit_menuitem));
gtk_widget_hide(GTK_WIDGET(menu->view_menuitem));
@@ -200,13 +208,24 @@ static void popup_menu_hide(struct nsgtk_popup_menu *menu, bool submenu,
}
+
/**
- * Helper to show popup menu entries by grouping
+ * Helper to show popup menu entries by grouping.
+ *
+ * \param menu The popup menu to modify.
+ * \param submenu flag to indicate if submenus should be visible.
+ * \param nav flag to indicate if navigation entries should be visible.
+ * \param cnp flag to indicate if cut and paste entries should be visible.
+ * \param custom flag to indicate if menu customisation is visible.
*/
-static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
- bool nav, bool cnp, bool custom)
+static void
+popup_menu_show(struct nsgtk_popup_menu *menu,
+ bool submenu,
+ bool nav,
+ bool cnp,
+ bool custom)
{
- if (submenu){
+ if (submenu) {
gtk_widget_show(GTK_WIDGET(menu->file_menuitem));
gtk_widget_show(GTK_WIDGET(menu->edit_menuitem));
gtk_widget_show(GTK_WIDGET(menu->view_menuitem));
@@ -232,7 +251,6 @@ static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
if (custom) {
gtk_widget_show(GTK_WIDGET(menu->customize_menuitem));
}
-
}
@@ -240,16 +258,20 @@ static void popup_menu_show(struct nsgtk_popup_menu *menu, bool submenu,
/**
* resource cleanup function for window destruction.
+ *
+ * gtk event called when window is being destroyed. Need to free any
+ * resources associated with this scaffold,
+ *
+ * \param widget the widget being destroyed
+ * \param data The context pointer passed when the connection was made.
*/
static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
{
struct nsgtk_scaffolding *gs = data;
- LOG("scaffold:%p", gs);
+ NSLOG(netsurf, INFO, "scaffold:%p", gs);
- if ((gs->history_window) && (gs->history_window->window)) {
- gtk_widget_destroy(GTK_WIDGET(gs->history_window->window));
- }
+ nsgtk_local_history_hide();
if (gs->prev != NULL) {
gs->prev->next = gs->next;
@@ -260,7 +282,7 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
gs->next->prev = gs->prev;
}
- LOG("scaffold list head: %p", scaf_list);
+ NSLOG(netsurf, INFO, "scaffold list head: %p", scaf_list);
if (scaf_list == NULL) {
/* no more open windows - stop the browser */
@@ -268,11 +290,21 @@ static void scaffolding_window_destroy(GtkWidget *widget, gpointer data)
}
}
-/* signal delivered on window delete event, allowing to halt close if
- * download is in progress
+
+/**
+ * gtk event callback on window delete event.
+ *
+ * prevent window close if download is in progress
+ *
+ * \param widget The widget receiving the delete event
+ * \param event The event
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate message handled.
*/
-static gboolean scaffolding_window_delete_event(GtkWidget *widget,
- GdkEvent *event, gpointer data)
+static gboolean
+scaffolding_window_delete_event(GtkWidget *widget,
+ GdkEvent *event,
+ gpointer data)
{
struct nsgtk_scaffolding *g = data;
@@ -282,12 +314,16 @@ static gboolean scaffolding_window_delete_event(GtkWidget *widget,
return TRUE;
}
+
/**
- * Update the scaffoling button sensitivity, url bar and local history size
+ * Update the scaffolding controls
+ *
+ * The button sensitivity, url bar and local history visibility are updated
+ *
+ * \param g The scaffolding context to update
*/
static void scaffolding_update_context(struct nsgtk_scaffolding *g)
{
- int width, height;
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
g->buttons[BACK_BUTTON]->sensitivity =
@@ -300,34 +336,41 @@ static void scaffolding_update_context(struct nsgtk_scaffolding *g)
/* update the url bar, particularly necessary when tabbing */
browser_window_refresh_url_bar(bw);
- /* update the local history window, as well as queuing a redraw
- * for it.
- */
- browser_window_history_size(bw, &width, &height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->drawing_area),
- width, height);
- gtk_widget_queue_draw(GTK_WIDGET(g->history_window->drawing_area));
+ nsgtk_local_history_hide();
}
+
/**
* Make the throbber run.
+ *
+ * scheduled callback to update the throbber
+ *
+ * \param p The context passed when scheduled.
*/
static void nsgtk_throb(void *p)
{
struct nsgtk_scaffolding *g = p;
- if (g->throb_frame >= (nsgtk_throbber->nframes - 1))
+ if (g->throb_frame >= (nsgtk_throbber->nframes - 1)) {
g->throb_frame = 1;
- else
+ } else {
g->throb_frame++;
+ }
- gtk_image_set_from_pixbuf(g->throbber, nsgtk_throbber->framedata[
- g->throb_frame]);
+ gtk_image_set_from_pixbuf(g->throbber,
+ nsgtk_throbber->framedata[g->throb_frame]);
nsgtk_schedule(100, nsgtk_throb, p);
}
-static guint nsgtk_scaffolding_update_edit_actions_sensitivity(
+
+/**
+ * edit the sensitivity of focused widget
+ *
+ * \param g The scaffolding context.
+ */
+static guint
+nsgtk_scaffolding_update_edit_actions_sensitivity(
struct nsgtk_scaffolding *g)
{
GtkWidget *widget = gtk_window_get_focus(g->window);
@@ -361,7 +404,13 @@ static guint nsgtk_scaffolding_update_edit_actions_sensitivity(
}
-static void nsgtk_scaffolding_enable_edit_actions_sensitivity(
+/**
+ * make edit actions sensitive
+ *
+ * \param g The scaffolding context.
+ */
+static void
+nsgtk_scaffolding_enable_edit_actions_sensitivity(
struct nsgtk_scaffolding *g)
{
@@ -374,22 +423,46 @@ static void nsgtk_scaffolding_enable_edit_actions_sensitivity(
}
/* signal handling functions for the toolbar, URL bar, and menu bar */
-static gboolean nsgtk_window_edit_menu_clicked(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
+
+/**
+ * gtk event for edit menu being show
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
+static gboolean
+nsgtk_window_edit_menu_shown(GtkWidget *widget,
+ struct nsgtk_scaffolding *g)
{
nsgtk_scaffolding_update_edit_actions_sensitivity(g);
return TRUE;
}
-static gboolean nsgtk_window_edit_menu_hidden(GtkWidget *widget,
- struct nsgtk_scaffolding *g)
+/**
+ * gtk event handler for edit menu being hidden
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
+static gboolean
+nsgtk_window_edit_menu_hidden(GtkWidget *widget,
+ struct nsgtk_scaffolding *g)
{
nsgtk_scaffolding_enable_edit_actions_sensitivity(g);
return TRUE;
}
+/**
+ * gtk event handler for popup menu being hidden.
+ *
+ * \param widget The menu widget
+ * \param g scaffolding handle
+ * \return TRUE to indicate event handled
+ */
static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget,
struct nsgtk_scaffolding *g)
{
@@ -397,6 +470,7 @@ static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget,
return TRUE;
}
+/* exported interface documented in gtk/scaffolding.h */
gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
{
struct nsgtk_scaffolding *g = data;
@@ -419,8 +493,14 @@ gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
return TRUE;
}
+
/**
* update handler for URL entry widget
+ *
+ * \param widget The widget receiving the delete event
+ * \param event The event
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate signal handled.
*/
gboolean
nsgtk_window_url_changed(GtkWidget *widget,
@@ -430,11 +510,23 @@ nsgtk_window_url_changed(GtkWidget *widget,
return nsgtk_completion_update(GTK_ENTRY(widget));
}
+
/**
* Event handler for popup menu on toolbar.
+ *
+ * \param toolbar The toolbar being clicked
+ * \param x The x coordinate where the click happened
+ * \param y The x coordinate where the click happened
+ * \param button the buttons being pressed
+ * \param data The context pointer passed when the connection was made.
+ * \return TRUE to indicate event handled.
*/
-static gboolean nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
- gint x, gint y, gint button, gpointer data)
+static gboolean
+nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
+ gint x,
+ gint y,
+ gint button,
+ gpointer data)
{
struct nsgtk_scaffolding *g = (struct nsgtk_scaffolding *)data;
@@ -448,23 +540,40 @@ static gboolean nsgtk_window_tool_bar_clicked(GtkToolbar *toolbar,
return TRUE;
}
+
/**
* Update the menus when the number of tabs changes.
+ *
+ * \param notebook The notebook all the tabs are in
+ * \param page The newly added page container widget
+ * \param page_num The index of the newly added page
+ * \param g The scaffolding context containing the notebook
*/
-static void nsgtk_window_tabs_add(GtkNotebook *notebook,
- GtkWidget *page, guint page_num, struct nsgtk_scaffolding *g)
+static void
+nsgtk_window_tabs_add(GtkNotebook *notebook,
+ GtkWidget *page,
+ guint page_num,
+ struct nsgtk_scaffolding *g)
{
gboolean visible = gtk_notebook_get_show_tabs(g->notebook);
- g_object_set(g->menu_bar->view_submenu->tabs_menuitem, "visible", visible, NULL);
- g_object_set(g->menu_popup->view_submenu->tabs_menuitem, "visible", visible, NULL);
+ g_object_set(g->menu_bar->view_submenu->tabs_menuitem,
+ "visible", visible, NULL);
+ g_object_set(g->menu_popup->view_submenu->tabs_menuitem,
+ "visible", visible, NULL);
g->buttons[NEXTTAB_BUTTON]->sensitivity = visible;
g->buttons[PREVTAB_BUTTON]->sensitivity = visible;
g->buttons[CLOSETAB_BUTTON]->sensitivity = visible;
nsgtk_scaffolding_set_sensitivity(g);
}
+
/**
* Update the menus when the number of tabs changes.
+ *
+ * \param notebook The notebook all the tabs are in
+ * \param page The page container widget being removed
+ * \param page_num The index of the removed page
+ * \param gs The scaffolding context containing the notebook
*/
static void
nsgtk_window_tabs_remove(GtkNotebook *notebook,
@@ -473,7 +582,7 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
struct nsgtk_scaffolding *gs)
{
/* if the scaffold is being destroyed it is not useful to
- * update the state, futher many of the widgets may have
+ * update the state, further many of the widgets may have
* already been destroyed.
*/
if (gtk_widget_in_destruction(GTK_WIDGET(gs->window)) == TRUE) {
@@ -497,6 +606,8 @@ nsgtk_window_tabs_remove(GtkNotebook *notebook,
/**
* Handle opening a file path.
+ *
+ * \param filename The filename to open.
*/
static void nsgtk_openfile_open(const char *filename)
{
@@ -560,6 +671,7 @@ MULTIHANDLER(newwindow)
return TRUE;
}
+/* exported interface documented in gtk/scaffolding.h */
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw)
{
struct browser_window *bw = nsgtk_get_browser_window(gw);
@@ -629,8 +741,16 @@ MULTIHANDLER(openfile)
return TRUE;
}
-static gboolean nsgtk_filter_directory(const GtkFileFilterInfo *info,
- gpointer data)
+/**
+ * callback to determine if a path is a directory.
+ *
+ * \param info The path information
+ * \param data context pointer set to NULL
+ * \return TRUE if path is a directory else false
+ */
+static gboolean
+nsgtk_filter_directory(const GtkFileFilterInfo *info,
+ gpointer data)
{
DIR *d = opendir(info->filename);
if (d == NULL)
@@ -660,7 +780,7 @@ MULTIHANDLER(savepage)
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(fc), filter);
- res = nsurl_nice(browser_window_get_url(
+ res = nsurl_nice(browser_window_access_url(
nsgtk_get_browser_window(g->top_level)), &path, false);
if (res != NSERROR_OK) {
path = strdup(messages_get("SaveText"));
@@ -685,7 +805,10 @@ MULTIHANDLER(savepage)
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
d = opendir(path);
if (d == NULL) {
- LOG("Unable to open directory %s for complete save: %s", path, strerror(errno));
+ NSLOG(netsurf, INFO,
+ "Unable to open directory %s for complete save: %s",
+ path,
+ strerror(errno));
if (errno == ENOTDIR)
nsgtk_warning("NoDirError", path);
else
@@ -717,9 +840,9 @@ MULTIHANDLER(pdf)
char *url_name;
nserror res;
- LOG("Print preview (generating PDF) started.");
+ NSLOG(netsurf, INFO, "Print preview (generating PDF) started.");
- res = nsurl_nice(browser_window_get_url(bw), &url_name, true);
+ res = nsurl_nice(browser_window_access_url(bw), &url_name, true);
if (res != NSERROR_OK) {
nsgtk_warning(messages_get_errorcode(res), 0);
return TRUE;
@@ -735,7 +858,7 @@ MULTIHANDLER(pdf)
strncat(dirname, "/", PATH_MAX - strlen(dirname));
dirname[PATH_MAX - 1] = '\0';
- /* this way the scale used by PDF functions is synchronized with that
+ /* this way the scale used by PDF functions is synchronised with that
* used by the all-purpose print interface
*/
haru_nsfont_set_scale((float)option_export_scale / 100);
@@ -792,7 +915,7 @@ MULTIHANDLER(plaintext)
char *filename;
nserror res;
- res = nsurl_nice(browser_window_get_url(
+ res = nsurl_nice(browser_window_access_url(
nsgtk_get_browser_window(g->top_level)),
&filename, false);
if (res != NSERROR_OK) {
@@ -891,7 +1014,7 @@ MULTIHANDLER(print)
CONTENT_TEXTPLAIN) {
res = gtk_print_operation_run(print_op,
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
- g->window,
+ g->window,
NULL);
}
@@ -1101,10 +1224,10 @@ MULTIHANDLER(selectall)
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) {
- LOG("Selecting all URL bar text");
+ NSLOG(netsurf, INFO, "Selecting all URL bar text");
gtk_editable_select_region(GTK_EDITABLE(g->url_bar), 0, -1);
} else {
- LOG("Selecting all document text");
+ NSLOG(netsurf, INFO, "Selecting all document text");
browser_window_key_press(bw, NS_KEY_SELECT_ALL);
}
@@ -1466,31 +1589,13 @@ MULTIHANDLER(home)
MULTIHANDLER(localhistory)
{
struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
+ nserror res;
- int x,y, width, height, mainwidth, mainheight, margin = 20;
- /* if entries of the same url but different frag_ids have been added
- * the history needs redrawing (what throbber code normally does)
- */
-
- scaffolding_update_context(g);
- gtk_window_get_position(g->window, &x, &y);
- gtk_window_get_size(g->window, &mainwidth, &mainheight);
- browser_window_history_size(bw, &width, &height);
- width = (width + g->historybase + margin > mainwidth) ?
- mainwidth - g->historybase : width + margin;
- height = (height + g->toolbarbase + margin > mainheight) ?
- mainheight - g->toolbarbase : height + margin;
- gtk_window_set_default_size(g->history_window->window, width, height);
- gtk_widget_set_size_request(GTK_WIDGET(g->history_window->window),
- -1, -1);
- gtk_window_resize(g->history_window->window, width, height);
- gtk_window_set_transient_for(g->history_window->window, g->window);
- nsgtk_window_set_opacity(g->history_window->window, 0.9);
- gtk_widget_show(GTK_WIDGET(g->history_window->window));
- gtk_window_move(g->history_window->window, x + g->historybase, y +
- g->toolbarbase);
- gdk_window_raise(nsgtk_widget_get_window(GTK_WIDGET(g->history_window->window)));
-
+ res = nsgtk_local_history_present(g->window, bw);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO,
+ "Unable to initialise local history window.");
+ }
return TRUE;
}
@@ -1499,7 +1604,8 @@ MULTIHANDLER(globalhistory)
nserror res;
res = nsgtk_global_history_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise global history window.");
+ NSLOG(netsurf, INFO,
+ "Unable to initialise global history window.");
}
return TRUE;
}
@@ -1510,7 +1616,7 @@ MULTIHANDLER(addbookmarks)
if (bw == NULL || !browser_window_has_content(bw))
return TRUE;
- hotlist_add_url(browser_window_get_url(bw));
+ hotlist_add_url(browser_window_access_url(bw));
return TRUE;
}
@@ -1519,7 +1625,7 @@ MULTIHANDLER(showbookmarks)
nserror res;
res = nsgtk_hotlist_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise bookmark window.");
+ NSLOG(netsurf, INFO, "Unable to initialise bookmark window.");
}
return TRUE;
}
@@ -1529,7 +1635,7 @@ MULTIHANDLER(showcookies)
nserror res;
res = nsgtk_cookies_present();
if (res != NSERROR_OK) {
- LOG("Unable to initialise cookies window.");
+ NSLOG(netsurf, INFO, "Unable to initialise cookies window.");
}
return TRUE;
}
@@ -1643,98 +1749,6 @@ BUTTONHANDLER(history)
#undef CHECKHANDLER
#undef BUTTONHANDLER
-#if GTK_CHECK_VERSION(3,0,0)
-
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)data;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
- double x1;
- double y1;
- double x2;
- double y2;
-
- current_widget = widget;
- current_cr = cr;
-
- cairo_clip_extents(cr, &x1, &y1, &x2, &y2);
-
- clip.x0 = x1;
- clip.y0 = y1;
- clip.x1 = x2;
- clip.y1 = y2;
-
- ctx.plot->clip(&clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- current_widget = NULL;
-
- return FALSE;
-}
-#else
-
-/* signal handler functions for the local history window */
-static gboolean
-nsgtk_history_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer g)
-{
- struct rect clip;
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &nsgtk_plotters
- };
-
- current_widget = widget;
-
- current_cr = gdk_cairo_create(nsgtk_widget_get_window(widget));
-
- clip.x0 = event->area.x;
- clip.y0 = event->area.y;
- clip.x1 = event->area.x + event->area.width;
- clip.y1 = event->area.y + event->area.height;
- ctx.plot->clip(&clip);
-
- browser_window_history_redraw(bw, &ctx);
-
- cairo_destroy(current_cr);
-
- current_widget = NULL;
-
- return FALSE;
-}
-
-#endif /* GTK_CHECK_VERSION(3,0,0) */
-
-static gboolean nsgtk_history_button_press_event(GtkWidget *widget,
- GdkEventButton *event, gpointer g)
-{
- struct gtk_history_window *hw = (struct gtk_history_window *)g;
- struct browser_window *bw =
- nsgtk_get_browser_window(hw->g->top_level);
-
- LOG("X=%g, Y=%g", event->x, event->y);
-
- browser_window_history_click(bw, event->x, event->y, false);
-
- return TRUE;
-}
-
-
-
static void nsgtk_attach_menu_handlers(struct nsgtk_scaffolding *g)
{
for (int i = BACK_BUTTON; i < PLACEHOLDER_BUTTON; i++) {
@@ -2059,12 +2073,13 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
int i;
GtkAccelGroup *group;
- gs = malloc(sizeof(*gs));
+ gs = calloc(1, sizeof(*gs));
if (gs == NULL) {
return NULL;
}
- LOG("Constructing a scaffold of %p for gui_window %p", gs, toplevel);
+ NSLOG(netsurf, INFO,
+ "Constructing a scaffold of %p for gui_window %p", gs, toplevel);
gs->top_level = toplevel;
@@ -2188,35 +2203,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
gtk_widget_set_size_request(GTK_WIDGET(
gs->buttons[HISTORY_BUTTON]->button), 20, -1);
- /* create the local history window to be associated with this scaffold */
- gs->history_window = malloc(sizeof(struct gtk_history_window));
- gs->history_window->g = gs;
- gs->history_window->window =
- GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL));
- gtk_window_set_transient_for(gs->history_window->window, gs->window);
- gtk_window_set_title(gs->history_window->window, "NetSurf History");
- gtk_window_set_type_hint(gs->history_window->window,
- GDK_WINDOW_TYPE_HINT_UTILITY);
- gs->history_window->scrolled =
- GTK_SCROLLED_WINDOW(gtk_scrolled_window_new(0, 0));
- gtk_container_add(GTK_CONTAINER(gs->history_window->window),
- GTK_WIDGET(gs->history_window->scrolled));
-
- gtk_widget_show(GTK_WIDGET(gs->history_window->scrolled));
- gs->history_window->drawing_area =
- GTK_DRAWING_AREA(gtk_drawing_area_new());
-
- gtk_widget_set_events(GTK_WIDGET(gs->history_window->drawing_area),
- GDK_EXPOSURE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_PRESS_MASK);
- nsgtk_widget_override_background_color(GTK_WIDGET(gs->history_window->drawing_area),
- GTK_STATE_NORMAL,
- 0, 0xffff, 0xffff, 0xffff);
- nsgtk_scrolled_window_add_with_viewport(gs->history_window->scrolled,
- GTK_WIDGET(gs->history_window->drawing_area));
- gtk_widget_show(GTK_WIDGET(gs->history_window->drawing_area));
-
/* set up URL bar completion */
gs->url_bar_completion = nsgtk_url_entry_completion_new(gs);
@@ -2228,17 +2214,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
#define CONNECT(obj, sig, callback, ptr) \
g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
- /* connect history window signals to their handlers */
- nsgtk_connect_draw_event(GTK_WIDGET(gs->history_window->drawing_area),
- G_CALLBACK(nsgtk_history_draw_event),
- gs->history_window);
- /*CONNECT(gs->history_window->drawing_area, "motion_notify_event",
- nsgtk_history_motion_notify_event, gs->history_window);*/
- CONNECT(gs->history_window->drawing_area, "button_press_event",
- nsgtk_history_button_press_event, gs->history_window);
- CONNECT(gs->history_window->window, "delete_event",
- gtk_widget_hide_on_delete, NULL);
-
g_signal_connect_after(gs->notebook, "page-added",
G_CALLBACK(nsgtk_window_tabs_add), gs);
g_signal_connect_after(gs->notebook, "page-removed",
@@ -2252,7 +2227,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
/* toolbar URL bar menu bar search bar signal handlers */
CONNECT(gs->menu_bar->edit_submenu->edit, "show",
- nsgtk_window_edit_menu_clicked, gs);
+ nsgtk_window_edit_menu_shown, gs);
CONNECT(gs->menu_bar->edit_submenu->edit, "hide",
nsgtk_window_edit_menu_hidden, gs);
@@ -2309,7 +2284,7 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(gs->window));
- LOG("creation complete");
+ NSLOG(netsurf, INFO, "creation complete");
return gs;
}
@@ -2497,7 +2472,8 @@ gui_search_web_provider_update(const char *provider_name,
GdkPixbuf *srch_pixbuf = NULL;
char *searchcontent;
- LOG("name:%s bitmap %p", provider_name, provider_bitmap);
+ NSLOG(netsurf, INFO, "name:%s bitmap %p", provider_name,
+ provider_bitmap);
if (provider_bitmap != NULL) {
srch_pixbuf = nsgdk_pixbuf_get_from_surface(provider_bitmap->surface, 16, 16);
@@ -2515,7 +2491,11 @@ gui_search_web_provider_update(const char *provider_name,
/* set the search provider parameters up in each scaffold */
for (current = scaf_list; current != NULL; current = current->next) {
- /* add ico to each window's toolbar */
+ if (current->webSearchEntry == NULL) {
+ continue;
+ }
+
+ /* add ico to each window's toolbar */
if (srch_pixbuf != NULL) {
nsgtk_entry_set_icon_from_pixbuf(current->webSearchEntry,
GTK_ENTRY_ICON_PRIMARY,
@@ -2599,13 +2579,6 @@ GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g)
}
/* exported interface documented in gtk/scaffolding.h */
-struct gtk_history_window *
-nsgtk_scaffolding_history_window(struct nsgtk_scaffolding *g)
-{
- return g->history_window;
-}
-
-/* exported interface documented in gtk/scaffolding.h */
struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g)
{
if (g == NULL) {
@@ -2774,7 +2747,7 @@ void nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g,
gtk_widget_show(GTK_WIDGET(g->menu_popup->paste_menuitem));
}
- /* hide customize */
+ /* hide customise */
popup_menu_hide(g->menu_popup, false, false, false, true);
}