From 608cc3cbbfae27498268442aa31ef791894e0789 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 7 Sep 2019 13:42:33 +0100 Subject: make handling of non browser window containing tabs reasonable --- frontends/gtk/scaffolding.c | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'frontends/gtk/scaffolding.c') diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c index 8712dcd10..6ace03263 100644 --- a/frontends/gtk/scaffolding.c +++ b/frontends/gtk/scaffolding.c @@ -1191,16 +1191,6 @@ static nserror nsgtk_search_connect_signals(struct nsgtk_scaffolding *gs) } -/* exported interface documented in gtk/scaffolding.h */ -struct nsgtk_scaffolding *nsgtk_current_scaffolding(void) -{ - if (scaf_current == NULL) { - scaf_current = scaf_list; - } - return scaf_current; -} - - /* exported function documented in gtk/scaffolding.h */ void nsgtk_scaffolding_set_title(struct gui_window *gw, const char *title) { @@ -1297,9 +1287,12 @@ struct gtk_search *nsgtk_scaffolding_search(struct nsgtk_scaffolding *g) } /* exported interface documented in gtk/scaffolding.h */ -GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *g) +GtkMenuBar *nsgtk_scaffolding_menu_bar(struct nsgtk_scaffolding *gs) { - return g->menu_bar->bar_menu; + if (gs == NULL) { + return NULL; + } + return gs->menu_bar->bar_menu; } /* exported interface documented in gtk/scaffolding.h */ @@ -1354,6 +1347,8 @@ void nsgtk_scaffolding_set_top_level(struct gui_window *gw) sc = nsgtk_get_scaffold(gw); assert(sc != NULL); + scaf_current = sc; + sc->top_level = gw; /* Synchronise the history (will also update the URL bar) */ @@ -1463,6 +1458,28 @@ nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g, nsgtk_menu_popup_at_pointer(gtkmenu, NULL); } +/* exported interface documented in gtk/scaffolding.h */ +struct nsgtk_scaffolding *nsgtk_current_scaffolding(void) +{ + if (scaf_current == NULL) { + scaf_current = scaf_list; + } + return scaf_current; +} + +/* exported interface documented in gtk/scaffolding.h */ +struct nsgtk_scaffolding *nsgtk_scaffolding_from_notebook(GtkNotebook *notebook) +{ + struct nsgtk_scaffolding *gs; + gs = scaf_list; + while (gs != NULL) { + if (gs->notebook == notebook) { + break; + } + gs = gs->next; + } + return gs; +} /* exported interface documented in gtk/scaffolding.h */ struct nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel) -- cgit v1.2.3