summaryrefslogtreecommitdiff
path: root/frontends
diff options
context:
space:
mode:
Diffstat (limited to 'frontends')
-rw-r--r--frontends/gtk/res/netsurf.gtk3.ui156
-rw-r--r--frontends/gtk/res/tabcontents.gtk3.ui81
-rw-r--r--frontends/gtk/scaffolding.c12
-rw-r--r--frontends/gtk/search.c56
-rw-r--r--frontends/gtk/window.c4
5 files changed, 71 insertions, 238 deletions
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,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="wndBrowser">
<property name="can_focus">False</property>
<child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -20,156 +24,6 @@
</packing>
</child>
<child>
- <object class="GtkToolbar" id="toolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="toolbar_style">both</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolbar" id="searchbar">
- <property name="can_focus">False</property>
- <property name="toolbar_style">both</property>
- <child>
- <object class="GtkToolButton" id="closeSearchButton">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">gtk-close</property>
- <property name="stock_id">gtk-close</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="searchLabelItem">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <child>
- <object class="GtkLabel" id="searchlabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xpad">4</property>
- <property name="label" translatable="yes">Match</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="toolSearch">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <child>
- <object class="GtkEntry" id="searchEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="invisible_char">●</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="searchBackButton">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Search _Back</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-go-back</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolButton" id="searchForwardButton">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <property name="label" translatable="yes">Search _Forward</property>
- <property name="use_underline">True</property>
- <property name="stock_id">gtk-go-forward</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="checkAllSearchItem">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <child>
- <object class="GtkCheckButton" id="checkAllSearch">
- <property name="label" translatable="yes">All</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="caseSensItem">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="use_action_appearance">False</property>
- <child>
- <object class="GtkCheckButton" id="caseSensButton">
- <property name="label" translatable="yes">Case</property>
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
<object class="GtkNotebook" id="notebook">
<property name="visible">True</property>
<property name="can_focus">True</property>
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,67 +29,37 @@
</packing>
</child>
<child>
- <object class="GtkToolbar" id="searchbar">
+ <object class="GtkToolbar" id="findbar">
<property name="can_focus">False</property>
<property name="toolbar_style">both</property>
<child>
- <object class="GtkToolButton" id="closeSearchButton">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">gtk-close</property>
- <property name="stock_id">gtk-close</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="searchLabelItem">
+ <object class="GtkToolItem">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkLabel" id="searchlabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xpad">4</property>
- <property name="label" translatable="yes">Match</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">False</property>
- </packing>
- </child>
- <child>
- <object class="GtkToolItem" id="toolSearch">
- <property name="use_action_appearance">False</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkEntry" id="searchEntry">
+ <object class="GtkEntry" id="Find">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <property name="placeholder_text" translatable="yes">gtkFindPlaceholder</property>
</object>
</child>
</object>
<packing>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
- <object class="GtkToolButton" id="searchBackButton">
+ <object class="GtkToolButton" id="FindBack">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Search _Back</property>
+ <property name="tooltip_text" translatable="yes">gtkFindBack</property>
+ <property name="label" translatable="yes">gtkFindBack</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-go-back</property>
+ <property name="stock_id">gtk-go-up</property>
</object>
<packing>
<property name="expand">False</property>
@@ -97,13 +67,14 @@
</packing>
</child>
<child>
- <object class="GtkToolButton" id="searchForwardButton">
+ <object class="GtkToolButton" id="FindForward">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Search _Forward</property>
+ <property name="tooltip_text" translatable="yes">gtkFindForward</property>
+ <property name="label" translatable="yes">gtkFindForward</property>
<property name="use_underline">True</property>
- <property name="stock_id">gtk-go-forward</property>
+ <property name="stock_id">gtk-go-down</property>
</object>
<packing>
<property name="expand">False</property>
@@ -111,13 +82,13 @@
</packing>
</child>
<child>
- <object class="GtkToolItem" id="checkAllSearchItem">
+ <object class="GtkToolItem">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="checkAllSearch">
- <property name="label" translatable="yes">All</property>
+ <object class="GtkCheckButton" id="FindHightlightAll">
+ <property name="label" translatable="yes">gtkFindHighlightAll</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -133,13 +104,13 @@
</packing>
</child>
<child>
- <object class="GtkToolItem" id="caseSensItem">
+ <object class="GtkToolItem">
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
- <object class="GtkCheckButton" id="caseSensButton">
- <property name="label" translatable="yes">Case</property>
+ <object class="GtkCheckButton" id="FindMatchCase">
+ <property name="label" translatable="yes">gtkFindMatchCase</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -154,6 +125,20 @@
<property name="homogeneous">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkToolButton" id="FindClose">
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">gtkFindClose</property>
+ <property name="label" translatable="yes">gtkFindClose</property>
+ <property name="stock_id">gtk-close</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">False</property>
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 <rjek@rjek.com>
- * Copyright 2009 Mark Benjamin <netsurf-browser.org.MarkBenjamin@dfgh.net>
+ * Copyright 2019 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -18,26 +17,25 @@
*/
#include <gtk/gtk.h>
+#include <stdbool.h>
#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 <netsurf-browser.org.MarkBenjamin@dfgh.net>
+ * Copyright 2019 Vincent Sanders <vince@netsurf-browser.org>
*
* 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 <stdint.h>
-#include <ctype.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
+#include <stdbool.h>
+#include <gtk/gtk.h>
-#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.