diff --git a/frontends/gtk/res/netsurf.gtk3.ui b/frontends/gtk/res/netsurf.gtk3.ui index ce47c6370..6ea8f07a7 100644 --- a/frontends/gtk/res/netsurf.gtk3.ui +++ b/frontends/gtk/res/netsurf.gtk3.ui @@ -1,8 +1,12 @@ + - + False + + + True @@ -19,156 +23,6 @@ 0 - - - True - False - both - - - False - False - 1 - - - - - False - both - - - False - True - False - False - gtk-close - gtk-close - - - False - True - - - - - False - True - False - False - - - True - False - 4 - Match - - - - - False - - - - - False - True - False - False - - - True - True - - - - - - False - - - - - False - True - False - False - Search _Back - True - gtk-go-back - - - False - True - - - - - False - True - False - False - Search _Forward - True - gtk-go-forward - - - False - True - - - - - False - True - False - False - - - All - False - True - True - False - False - 0 - True - - - - - False - - - - - False - True - False - False - - - Case - False - True - True - False - False - 0 - True - - - - - False - - - - - False - False - 2 - - True diff --git a/frontends/gtk/res/tabcontents.gtk3.ui b/frontends/gtk/res/tabcontents.gtk3.ui index 607d511a5..5d7a40bbe 100644 --- a/frontends/gtk/res/tabcontents.gtk3.ui +++ b/frontends/gtk/res/tabcontents.gtk3.ui @@ -29,15 +29,109 @@ - + False both - + False True False - gtk-close + + + True + True + + gtkFindPlaceholder + + + + + True + False + + + + + False + True + False + gtkFindBack + gtkFindBack + True + gtk-go-up + + + False + True + + + + + False + True + False + gtkFindForward + gtkFindForward + True + gtk-go-down + + + False + True + + + + + False + True + False + + + gtkFindHighlightAll + False + True + True + False + 0 + True + + + + + False + False + + + + + False + True + False + + + gtkFindMatchCase + False + True + True + False + 0 + True + + + + + False + False + + + + + False + True + False + gtkFindClose + gtkFindClose gtk-close @@ -45,115 +139,6 @@ True - - - False - True - False - - - True - False - 4 - Match - - - - - False - False - - - - - False - True - False - - - True - True - - - - - - False - False - - - - - False - True - False - Search _Back - True - gtk-go-back - - - False - True - - - - - False - True - False - Search _Forward - True - gtk-go-forward - - - False - True - - - - - False - True - False - - - All - False - True - True - False - 0 - True - - - - - False - False - - - - - False - True - False - - - Case - False - True - True - False - 0 - True - - - - - False - False - - False diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index b86b9147d..5a50d8101 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -1,6 +1,5 @@ /* - * Copyright 2006 Rob Kendrick - * Copyright 2009 Mark Benjamin + * Copyright 2019 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -18,26 +17,25 @@ */ #include +#include #include "utils/utils.h" #include "utils/log.h" -#include "utils/nsurl.h" #include "utils/messages.h" +#include "utils/nsurl.h" #include "utils/nsoption.h" #include "netsurf/browser_window.h" #include "desktop/browser_history.h" #include "desktop/hotlist.h" #include "gtk/compat.h" -#include "gtk/warn.h" #include "gtk/toolbar_items.h" -#include "gtk/toolbar.h" #include "gtk/menu.h" #include "gtk/local_history.h" -#include "gtk/download.h" #include "gtk/gui.h" +#include "gtk/download.h" #include "gtk/window.h" -#include "gtk/completion.h" +#include "gtk/warn.h" #include "gtk/tabs.h" #include "gtk/resources.h" #include "gtk/scaffolding.h" diff --git a/frontends/gtk/search.c b/frontends/gtk/search.c index a75dc9474..ead511fe5 100644 --- a/frontends/gtk/search.c +++ b/frontends/gtk/search.c @@ -1,5 +1,5 @@ /* - * Copyright 2009 Mark Benjamin + * Copyright 2019 Vincent Sanders * * This file is part of NetSurf, http://www.netsurf-browser.org/ * @@ -19,30 +19,24 @@ /** * \file - * Free text search (front component) + * find in page gtk frontend implementation + * + * \todo this whole thing should be named find rather than search as + * that generally means web search and is confusing. */ -#include -#include -#include -#include +#include +#include -#include "utils/config.h" -#include "utils/log.h" -#include "utils/messages.h" -#include "utils/nsurl.h" #include "utils/nsoption.h" #include "netsurf/search.h" -#include "netsurf/browser_window.h" #include "desktop/search.h" -#include "desktop/searchweb.h" -#include "gtk/warn.h" #include "gtk/compat.h" -#include "gtk/search.h" #include "gtk/toolbar_items.h" -#include "gtk/scaffolding.h" #include "gtk/window.h" +#include "gtk/search.h" + /** * activate search forwards button in gui. @@ -161,12 +155,9 @@ static gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data) search = (struct gtk_search *)data; - nsgtk_search_set_forward_state(true, search->gw); - nsgtk_search_set_back_state(true, search->gw); - bw = nsgtk_get_browser_window(search->gw); - flags = SEARCH_FLAG_FORWARDS; + flags = 0; if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(search->caseSens))) { flags |= SEARCH_FLAG_CASE_SENSITIVE; @@ -241,14 +232,15 @@ nserror nsgtk_search_toggle_visibility(struct gtk_search *search) { gboolean vis; + browser_window_search_clear(nsgtk_get_browser_window(search->gw)); + g_object_get(G_OBJECT(search->bar), "visible", &vis, NULL); if (vis) { - browser_window_search_clear(nsgtk_get_browser_window(search->gw)); - gtk_widget_hide(GTK_WIDGET(search->bar)); } else { gtk_widget_show(GTK_WIDGET(search->bar)); gtk_widget_grab_focus(GTK_WIDGET(search->entry)); + nsgtk_search_entry_changed(GTK_WIDGET(search->entry), search); } return NSERROR_OK; @@ -306,20 +298,18 @@ nsgtk_search_create(GtkBuilder *builder, search->gw = gw; - search->bar = GTK_TOOLBAR(gtk_builder_get_object(builder, - "searchbar")); - search->entry = GTK_ENTRY(gtk_builder_get_object(builder, - "searchEntry")); + search->bar = GTK_TOOLBAR(gtk_builder_get_object(builder, "findbar")); + search->entry = GTK_ENTRY(gtk_builder_get_object(builder, "Find")); search->back = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, - "searchBackButton")); + "FindBack")); search->forward = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, - "searchForwardButton")); + "FindForward")); search->close = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, - "closeSearchButton")); + "FindClose")); search->checkAll = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, - "checkAllSearch")); + "FindHightlightAll")); search->caseSens = GTK_CHECK_BUTTON(gtk_builder_get_object(builder, - "caseSensButton")); + "FindMatchCase")); g_signal_connect(search->forward, "clicked", @@ -356,8 +346,14 @@ nsgtk_search_create(GtkBuilder *builder, G_CALLBACK(nsgtk_search_entry_changed), search); + g_signal_connect(search->checkAll, + "toggled", + G_CALLBACK(nsgtk_search_entry_changed), + search); + nsgtk_search_restyle(search); + *search_out = search; return NSERROR_OK; diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c index a8badc488..8a93f37ea 100644 --- a/frontends/gtk/window.c +++ b/frontends/gtk/window.c @@ -889,8 +889,8 @@ gui_window_create(struct browser_window *bw, } nsgtk_tab_add(g, g->container, tempback, messages_get("NewTab"), g->icon); - /* \todo move search bar properly */ - gtk_widget_hide(GTK_WIDGET(gtk_builder_get_object(tab_builder, "searchbar"))); + /* initialy should not be visible */ + nsgtk_search_toggle_visibility(g->search); /* safe to drop the reference to the tab_builder as the container is * referenced by the notebook now. diff --git a/resources/FatMessages b/resources/FatMessages index ee56dee79..912586674 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -3301,6 +3301,15 @@ nl.gtk.gtkThemeAdd:Thema is succesvol toegevoegd en.gtk.gtkCustomizeToolbarTitle:Customise Toolbar en.gtk.gtkCustomizeToolbarInstructions:Drag toolbar items into and out of the toolbar. +# GTK find in page + +en.gtk.gtkFindPlaceholder:Find in page +en.gtk.gtkFindBack:Find Previous Occurrence +en.gtk.gtkFindForward:Find _Next Occurrence +en.gtk.gtkFindHighlightAll:Highlight All +en.gtk.gtkFindMatchCase:Match Case +en.gtk.gtkFindClose:Close Find Bar + # GTK preferences dialog en.gtk.preferencesTitle:Netsurf Preferences