fix toolbar property update

This commit is contained in:
Vincent Sanders 2019-09-03 18:48:42 +01:00 committed by Daniel Silverstone
parent f6a669464f
commit ec62f346e1
6 changed files with 32 additions and 58 deletions

View File

@ -512,7 +512,7 @@ SPINBUTTON_SIGNALS(spinDefaultSize, font_size, 10.0)
G_MODULE_EXPORT void
nsgtk_preferences_fontPreview_clicked(GtkButton *button, struct ppref *priv)
{
nsgtk_reflow_all_windows();
nsgtk_window_update_all();
}
@ -714,7 +714,7 @@ nsgtk_preferences_checkShowSingleTab_toggled(GtkToggleButton *togglebutton,
{
nsoption_set_bool(show_single_tab,
gtk_toggle_button_get_active(togglebutton));
nsgtk_reflow_all_windows();
nsgtk_window_update_all();
}
G_MODULE_EXPORT void
@ -736,20 +736,11 @@ G_MODULE_EXPORT void
nsgtk_preferences_comboTabPosition_changed(GtkComboBox *widget,
struct ppref *priv)
{
struct nsgtk_scaffolding *current;
/* set the option */
nsoption_set_int(position_tab, gtk_combo_box_get_active(widget));
/* update all notebooks in all scaffolds */
current = nsgtk_scaffolding_iterate(NULL);
while (current) {
nsgtk_scaffolding_reset_offset(current);
nsgtk_reflow_all_windows();
current = nsgtk_scaffolding_iterate(current);
}
/* update all windows */
nsgtk_window_update_all();
}
G_MODULE_EXPORT void
@ -792,18 +783,10 @@ G_MODULE_EXPORT void
nsgtk_preferences_comboButtonType_changed(GtkComboBox *widget,
struct ppref *priv)
{
struct nsgtk_scaffolding *current;
nsoption_set_int(button_type, gtk_combo_box_get_active(widget) + 1);
current = nsgtk_scaffolding_iterate(NULL);
while (current != NULL) {
nsgtk_scaffolding_reset_offset(current);
nsgtk_scaffolding_toolbars(current);
current = nsgtk_scaffolding_iterate(current);
}
/* update all windows to adopt change */
nsgtk_window_update_all();
}
G_MODULE_EXPORT void

View File

@ -1400,14 +1400,6 @@ struct nsgtk_scaffolding *nsgtk_current_scaffolding(void)
}
/* exported interface documented in gtk/scaffolding.h */
void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g)
{
// nsgtk_toolbar_update(g->toolbar);
nsgtk_search_update(g->search);
}
/* exported function documented in gtk/scaffolding.h */
void nsgtk_window_set_title(struct gui_window *gw, const char *title)
{
@ -1527,13 +1519,6 @@ struct nsgtk_scaffolding *nsgtk_scaffolding_iterate(struct nsgtk_scaffolding *g)
}
/* exported interface documented in gtk/scaffolding.h */
void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
{
//g->offset = 0;
}
/* exported interface documented in gtk/scaffolding.h */
struct gui_window *nsgtk_scaffolding_top_level(struct nsgtk_scaffolding *g)
{

View File

@ -115,14 +115,6 @@ struct gtk_history_window *nsgtk_scaffolding_history_window(struct nsgtk_scaffol
struct gui_window *nsgtk_scaffolding_top_level(struct nsgtk_scaffolding *g);
/**
* reset the scaffold offset value to 0.
*
* \todo The value is only ever altered in
* nsgtk_scaffolding_toolbar_size_allocate and is something to do with
* the history button either clarify or remove!
*/
void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g);
/**
* Iterate through available scaffolding.
@ -177,9 +169,5 @@ void nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g, gdouble x, gdou
*/
void nsgtk_window_set_title(struct gui_window *gw, const char *title);
/**
* toolbar style changed
*/
void nsgtk_scaffolding_toolbars(struct nsgtk_scaffolding *g);
#endif /* NETSURF_GTK_SCAFFOLDING_H */

View File

@ -812,6 +812,11 @@ make_toolbar_item(nsgtk_toolbar_button i, struct nsgtk_theme *theme)
return w;
}
/* exported interface documented in gtk/scaffolding.h */
static void nsgtk_scaffolding_reset_offset(struct nsgtk_scaffolding *g)
{
//g->offset = 0;
}
/**
* called when a widget is dropped onto the toolbar
@ -2928,10 +2933,9 @@ toggledebugging_button_clicked_cb(GtkWidget *widget, gpointer data)
browser_window_debug(bw, CONTENT_DEBUG_REDRAW);
nsgtk_reflow_all_windows();
nsgtk_window_update_all();
return TRUE;
}
@ -3564,6 +3568,12 @@ nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *tb)
/* exported interface documented in toolbar.h */
nserror nsgtk_toolbar_update(struct nsgtk_toolbar *tb)
{
/*
* reset toolbar size allocation so icon size change affects
* allocated widths.
*/
tb->offset = 0;
switch (nsoption_int(button_type)) {
case 1: /* Small icons */

View File

@ -904,11 +904,15 @@ nsgtk_window_item_activate(struct gui_window *gw, nsgtk_toolbar_button itemid)
return nsgtk_toolbar_item_activate(gw->toolbar, itemid);
}
void nsgtk_reflow_all_windows(void)
/* exported interface documented in window.h */
void nsgtk_window_update_all(void)
{
for (struct gui_window *g = window_list; g; g = g->next) {
nsgtk_tab_options_changed(nsgtk_scaffolding_notebook(g->scaffold));
browser_window_schedule_reformat(g->bw);
struct gui_window *gw;
for (gw = window_list; gw != NULL; gw = gw->next) {
nsgtk_tab_options_changed(nsgtk_scaffolding_notebook(gw->scaffold));
nsgtk_toolbar_update(gw->toolbar);
/** \todo update search bar */
browser_window_schedule_reformat(gw->bw);
}
}

View File

@ -46,9 +46,13 @@ struct browser_window *nsgtk_get_browser_window(struct gui_window *gw);
struct nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *gw);
/**
* cause all windows be be reflowed
* Every window will have its tab, toolbar and drawing area updated
*
* The update will ensure the correct tab options are used, the
* toolbar size and style is changed and the browser window contents
* redrawn.
*/
void nsgtk_reflow_all_windows(void);
void nsgtk_window_update_all(void);
/**
* update targets