summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2019-09-03 18:48:42 +0100
committerVincent Sanders <vince@kyllikki.org>2019-09-03 18:48:42 +0100
commit47ea0989037f2d5eddf23230f154ed3399e48477 (patch)
tree9a7b8bde37a4816f11d57413d0986a63e61902a7
parent5701bae85911a3b1b003e1b717114388af151567 (diff)
downloadnetsurf-47ea0989037f2d5eddf23230f154ed3399e48477.tar.gz
netsurf-47ea0989037f2d5eddf23230f154ed3399e48477.tar.bz2
fix toolbar property update
-rw-r--r--frontends/gtk/preferences.c29
-rw-r--r--frontends/gtk/scaffolding.c15
-rw-r--r--frontends/gtk/scaffolding.h12
-rw-r--r--frontends/gtk/toolbar.c14
-rw-r--r--frontends/gtk/window.c12
-rw-r--r--frontends/gtk/window.h8
6 files changed, 32 insertions, 58 deletions
diff --git a/frontends/gtk/preferences.c b/frontends/gtk/preferences.c
index efef4a2ea..3aaaa9026 100644
--- a/frontends/gtk/preferences.c
+++ b/frontends/gtk/preferences.c
@@ -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
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 17cbb5a9c..3a097ccad 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -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)
{
@@ -1528,13 +1520,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)
{
return g->top_level;
diff --git a/frontends/gtk/scaffolding.h b/frontends/gtk/scaffolding.h
index 43ad1a998..16aaf0310 100644
--- a/frontends/gtk/scaffolding.h
+++ b/frontends/gtk/scaffolding.h
@@ -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 */
diff --git a/frontends/gtk/toolbar.c b/frontends/gtk/toolbar.c
index ad2990a5f..e27d6a89e 100644
--- a/frontends/gtk/toolbar.c
+++ b/frontends/gtk/toolbar.c
@@ -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 */
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index b43a0ec42..0daf0fefb 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -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);
}
}
diff --git a/frontends/gtk/window.h b/frontends/gtk/window.h
index dd49c719f..b6e00a604 100644
--- a/frontends/gtk/window.h
+++ b/frontends/gtk/window.h
@@ -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