move toolbar to be in tab contents

This commit is contained in:
Vincent Sanders 2019-08-18 23:45:19 +01:00 committed by Daniel Silverstone
parent 65d169da10
commit 89fb88f6de
4 changed files with 149 additions and 24 deletions

View File

@ -37,17 +37,6 @@
<property name="fill">False</property>
</packing>
</child>
<child>
<object class="GtkToolbar" id="toolbar">
<property name="visible">True</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</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="toolbar_style">GTK_TOOLBAR_BOTH</property>
@ -156,7 +145,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">1</property>
</packing>
</child>
<child>
@ -203,7 +192,7 @@
</child>
</object>
<packing>
<property name="position">3</property>
<property name="position">2</property>
</packing>
</child>
</object>

View File

@ -2,6 +2,131 @@
<interface>
<!-- interface-requires gtk+ 2.12 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkVBox" id="tabBox">
<property name="visible">True</property>
<child>
<object class="GtkToolbar" id="toolbar">
<property name="visible">True</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</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="toolbar_style">GTK_TOOLBAR_BOTH</property>
<child>
<object class="GtkToolButton" id="closeSearchButton">
<property name="visible">True</property>
<property name="stock_id">gtk-close</property>
</object>
<packing>
<property name="expand">False</property>
</packing>
</child>
<child>
<object class="GtkToolItem" id="searchLabelItem">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="searchlabel">
<property name="visible">True</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="visible">True</property>
<child>
<object class="GtkEntry" id="searchEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<object class="GtkToolButton" id="searchBackButton">
<property name="visible">True</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>
</packing>
</child>
<child>
<object class="GtkToolButton" id="searchForwardButton">
<property name="visible">True</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>
</packing>
</child>
<child>
<object class="GtkToolItem" id="checkAllSearchItem">
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="checkAllSearch">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip-text" translatable="yes">show all matches</property>
<property name="label" translatable="yes">All </property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">False</property>
</packing>
</child>
<child>
<object class="GtkToolItem" id="caseSensItem">
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="caseSensButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip-text" translatable="yes">Match case when searching</property>
<property name="label" translatable="yes">Case</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="homogeneous">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="GtkTable" id="tabContents">
<property name="visible">True</property>
<property name="n_rows">2</property>
@ -77,6 +202,11 @@
</packing>
</child>
</object>
<packing>
<property name="position">3</property>
</packing>
</child>
</object>
<object class="GtkAdjustment" id="layouthadjustment">
<property name="upper">100</property>
<property name="step_increment">30</property>

View File

@ -124,9 +124,6 @@ struct nsgtk_scaffolding {
/** In page text search context */
struct gtk_search *search;
/** controls toolbar context */
struct nsgtk_toolbar *toolbar;
/** menu bar hierarchy */
struct nsgtk_bar_submenu *menu_bar;
@ -2053,7 +2050,7 @@ nsgtk_search_create(GtkBuilder *builder, struct gtk_search **search_out)
/* exported interface documented in gtk/scaffolding.h */
void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g)
{
nsgtk_toolbar_update(g->toolbar);
// nsgtk_toolbar_update(g->toolbar);
nsgtk_search_update(g->search);
}
@ -2573,11 +2570,6 @@ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
gs->window = GTK_WINDOW(gtk_builder_get_object(gs->builder, "wndBrowser"));
gs->notebook = GTK_NOTEBOOK(gtk_builder_get_object(gs->builder, "notebook"));
res = nsgtk_toolbar_create(gs->builder, &gs->toolbar);
if (res != NSERROR_OK) {
free(gs);
return NULL;
}
res = nsgtk_search_create(gs->builder, &gs->search);
if (res != NSERROR_OK) {

View File

@ -95,7 +95,10 @@ struct gui_window {
/** previous event location */
int last_x, last_y;
/** The top level container (tabContents) */
/** controls toolbar context */
struct nsgtk_toolbar *toolbar;
/** The top level container (tabBox) */
GtkWidget *container;
/** display widget for this page or frame */
@ -767,12 +770,20 @@ gui_window_create(struct browser_window *bw,
}
/* Construct our primary elements */
g->container = GTK_WIDGET(gtk_builder_get_object(tab_builder, "tabContents"));
g->container = GTK_WIDGET(gtk_builder_get_object(tab_builder, "tabBox"));
g->layout = GTK_LAYOUT(gtk_builder_get_object(tab_builder, "layout"));
g->status_bar = GTK_LABEL(gtk_builder_get_object(tab_builder, "status_bar"));
g->paned = GTK_PANED(gtk_builder_get_object(tab_builder, "hpaned1"));
g->input_method = gtk_im_multicontext_new();
res = nsgtk_toolbar_create(tab_builder, &g->toolbar);
if (res != NSERROR_OK) {
free(g);
g_object_unref(tab_builder);
return NULL;
}
/* set a default favicon */
g_object_ref(favicon_pixbuf);
g->icon = favicon_pixbuf;
@ -863,6 +874,9 @@ 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")));
/* safe to drop the reference to the tab_builder as the container is
* referenced by the notebook now.
*/