make toolbar and menubar hiding work appropriately

This commit is contained in:
Vincent Sanders 2019-09-04 19:23:06 +01:00 committed by Daniel Silverstone
parent bcb2b7a2c4
commit 635be1dfb8
7 changed files with 253 additions and 145 deletions

View File

@ -85,15 +85,17 @@ nsgtk_menu_add_image_item(GtkMenu *menu,
#define IMAGE_ITEM(p, q, r, s, t)\
nsgtk_menu_add_image_item(s->p##_menu, &(s->q##_menuitem), #r, t)
#define CHECK_ITEM(p, q, r, s)\
s->q##_menuitem = GTK_CHECK_MENU_ITEM(\
#define CHECK_ITEM(p, q, r, s) \
do { \
s->q##_menuitem = GTK_CHECK_MENU_ITEM( \
gtk_check_menu_item_new_with_mnemonic(\
messages_get(#r)));\
if ((s->q##_menuitem != NULL) && (s->p##_menu != NULL)) {\
gtk_menu_shell_append(GTK_MENU_SHELL(s->p##_menu),\
GTK_WIDGET(s->q##_menuitem));\
gtk_widget_show(GTK_WIDGET(s->q##_menuitem));\
}
if ((s->q##_menuitem != NULL) && (s->p##_menu != NULL)) { \
gtk_menu_shell_append(GTK_MENU_SHELL(s->p##_menu), \
GTK_WIDGET(s->q##_menuitem)); \
gtk_widget_show(GTK_WIDGET(s->q##_menuitem)); \
} \
} while(0)
#define SET_SUBMENU(q, r) \
do { \
@ -224,28 +226,36 @@ static struct nsgtk_tabs_submenu *nsgtk_menu_tabs_submenu(GtkAccelGroup *group)
static struct nsgtk_toolbars_submenu *
nsgtk_menu_toolbars_submenu(GtkAccelGroup *group)
{
struct nsgtk_toolbars_submenu *ret =
malloc(sizeof(struct nsgtk_toolbars_submenu));
if (ret == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
return NULL;
}
ret->toolbars_menu = GTK_MENU(gtk_menu_new());
if (ret->toolbars_menu == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
free(ret);
return NULL;
}
CHECK_ITEM(toolbars, menubar, gtkMenuBar, ret)
if (ret->menubar_menuitem != NULL)
gtk_check_menu_item_set_active(ret->menubar_menuitem, TRUE);
CHECK_ITEM(toolbars, toolbar, gtkToolBar, ret)
if (ret->toolbar_menuitem != NULL)
gtk_check_menu_item_set_active(ret->toolbar_menuitem, TRUE);
ADD_SEP(toolbars, ret);
IMAGE_ITEM(toolbars, customize, gtkCustomize, ret, group);
struct nsgtk_toolbars_submenu *tmenu;
return ret;
tmenu = malloc(sizeof(struct nsgtk_toolbars_submenu));
if (tmenu == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
return NULL;
}
tmenu->toolbars_menu = GTK_MENU(gtk_menu_new());
if (tmenu->toolbars_menu == NULL) {
nsgtk_warning(messages_get("NoMemory"), 0);
free(tmenu);
return NULL;
}
CHECK_ITEM(toolbars, menubar, gtkMenuBar, tmenu);
if (tmenu->menubar_menuitem != NULL) {
gtk_check_menu_item_set_active(tmenu->menubar_menuitem, TRUE);
}
CHECK_ITEM(toolbars, toolbar, gtkToolBar, tmenu);
if (tmenu->toolbar_menuitem != NULL) {
gtk_check_menu_item_set_active(tmenu->toolbar_menuitem, TRUE);
}
ADD_SEP(toolbars, tmenu);
IMAGE_ITEM(toolbars, customize, gtkCustomize, tmenu, group);
return tmenu;
}
/**
@ -558,9 +568,11 @@ struct nsgtk_popup_menu *nsgtk_popup_menu_create(GtkAccelGroup *group)
ADD_NAMED_SEP(popup, second, nmenu);
IMAGE_ITEM(popup, toolbars, gtkToolbars, nmenu, group);
SET_SUBMENU(toolbars, nmenu);
IMAGE_ITEM(popup, tools, gtkTools, nmenu, group);
SET_SUBMENU(tools, nmenu);
IMAGE_ITEM(popup, customize, gtkCustomize, nmenu, group);
return nmenu;
}

View File

@ -193,11 +193,10 @@ struct nsgtk_popup_menu {
GtkWidget *second_separator;
GtkWidget *toolbars_menuitem;
struct nsgtk_toolbars_submenu *toolbars_submenu;
GtkWidget *tools_menuitem;
struct nsgtk_tools_menu *tools_submenu;
GtkWidget *customize_menuitem;
};
struct nsgtk_link_menu {

View File

@ -120,7 +120,7 @@ static struct browser_window_features current_menu_features;
* \param custom flag to indicate if menu customisation is hidden.
*/
static void
popup_menu_hide(struct nsgtk_popup_menu *menu, bool nav, bool cnp, bool custom)
popup_menu_hide(struct nsgtk_popup_menu *menu, bool nav, bool cnp)
{
if (nav) {
gtk_widget_hide(GTK_WIDGET(menu->back_menuitem));
@ -139,9 +139,6 @@ popup_menu_hide(struct nsgtk_popup_menu *menu, bool nav, bool cnp, bool custom)
gtk_widget_hide(menu->second_separator);
}
if (custom) {
gtk_widget_hide(GTK_WIDGET(menu->customize_menuitem));
}
}
@ -155,7 +152,7 @@ popup_menu_hide(struct nsgtk_popup_menu *menu, bool nav, bool cnp, bool custom)
* \param custom flag to indicate if menu customisation is visible.
*/
static void
popup_menu_show(struct nsgtk_popup_menu *menu, bool nav, bool cnp, bool custom)
popup_menu_show(struct nsgtk_popup_menu *menu, bool nav, bool cnp)
{
if (nav) {
gtk_widget_show(GTK_WIDGET(menu->back_menuitem));
@ -174,9 +171,6 @@ popup_menu_show(struct nsgtk_popup_menu *menu, bool nav, bool cnp, bool custom)
gtk_widget_show(menu->second_separator);
}
if (custom) {
gtk_widget_show(GTK_WIDGET(menu->customize_menuitem));
}
}
@ -322,7 +316,7 @@ nsgtk_scaffolding_enable_edit_actions_sensitivity(struct nsgtk_scaffolding *g)
g->menus[CUT_BUTTON].sensitivity = true;
nsgtk_scaffolding_set_sensitivity(g);
popup_menu_show(g->popup_menu, false, true, false);
popup_menu_show(g->popup_menu, false, true);
}
/* signal handling functions for the toolbar, URL bar, and menu bar */
@ -615,10 +609,12 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, gpointer data)
{
struct nsgtk_scaffolding *gs = (struct nsgtk_scaffolding *)data;
GtkCheckMenuItem *bmcmi; /* burger menu check */
GtkCheckMenuItem *mbcmi; /* menu bar check*/
GtkCheckMenuItem *mbcmi; /* menu bar check */
GtkCheckMenuItem *tbcmi; /* popup menu check */
bmcmi = GTK_CHECK_MENU_ITEM(gs->burger_menu->view_submenu->toolbars_submenu->menubar_menuitem);
mbcmi = GTK_CHECK_MENU_ITEM(gs->menu_bar->view_submenu->toolbars_submenu->menubar_menuitem);
tbcmi = GTK_CHECK_MENU_ITEM(gs->popup_menu->toolbars_submenu->menubar_menuitem);
/* ensure menubar and burger menu checkboxes are both updated */
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
@ -630,10 +626,12 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, gpointer data)
gtk_check_menu_item_set_active(mbcmi, TRUE);
}
if (gtk_check_menu_item_get_active(tbcmi) == FALSE) {
gtk_check_menu_item_set_active(tbcmi, TRUE);
}
gtk_widget_show(GTK_WIDGET(gs->menu_bar->bar_menu));
popup_menu_show(gs->popup_menu, true, true, true);
popup_menu_hide(gs->popup_menu, false, false, false);
} else {
if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
gtk_check_menu_item_set_active(bmcmi, FALSE);
@ -643,10 +641,11 @@ nsgtk_on_menubar_activate_menu(GtkMenuItem *widget, gpointer data)
gtk_check_menu_item_set_active(mbcmi, FALSE);
}
if (gtk_check_menu_item_get_active(tbcmi) == TRUE) {
gtk_check_menu_item_set_active(tbcmi, FALSE);
}
gtk_widget_hide(GTK_WIDGET(gs->menu_bar->bar_menu));
popup_menu_show(gs->popup_menu, true, true, true);
}
return TRUE;
}
@ -658,9 +657,11 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, gpointer data)
struct nsgtk_scaffolding *gs = (struct nsgtk_scaffolding *)data;
GtkCheckMenuItem *bmcmi; /* burger menu check */
GtkCheckMenuItem *mbcmi; /* menu bar check */
GtkCheckMenuItem *tbcmi; /* popup menu check */
bmcmi = GTK_CHECK_MENU_ITEM(gs->burger_menu->view_submenu->toolbars_submenu->toolbar_menuitem);
mbcmi = GTK_CHECK_MENU_ITEM(gs->menu_bar->view_submenu->toolbars_submenu->toolbar_menuitem);
tbcmi = GTK_CHECK_MENU_ITEM(gs->popup_menu->toolbars_submenu->toolbar_menuitem);
/* ensure menubar and burger menu checkboxes are both updated */
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
@ -672,7 +673,11 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, gpointer data)
gtk_check_menu_item_set_active(mbcmi, TRUE);
}
//gtk_widget_show(GTK_WIDGET(g->tool_bar));
if (gtk_check_menu_item_get_active(tbcmi) == FALSE) {
gtk_check_menu_item_set_active(tbcmi, TRUE);
}
nsgtk_window_toolbar_show(gs, true);
} else {
if (gtk_check_menu_item_get_active(bmcmi) == TRUE) {
gtk_check_menu_item_set_active(bmcmi, FALSE);
@ -682,7 +687,11 @@ nsgtk_on_toolbar_activate_menu(GtkMenuItem *widget, gpointer data)
gtk_check_menu_item_set_active(mbcmi, FALSE);
}
//gtk_widget_hide(GTK_WIDGET(g->tool_bar));
if (gtk_check_menu_item_get_active(tbcmi) == TRUE) {
gtk_check_menu_item_set_active(tbcmi, FALSE);
}
nsgtk_window_toolbar_show(gs, false);
}
return TRUE;
}
@ -828,13 +837,21 @@ create_scaffolding_popup_menu(struct nsgtk_scaffolding *gs, GtkAccelGroup *group
G_CALLBACK(nsgtk_window_popup_menu_hidden),
gs);
g_signal_connect(nmenu->customize_menuitem,
g_signal_connect(nmenu->toolbars_submenu->menubar_menuitem,
"toggled",
G_CALLBACK(nsgtk_on_menubar_activate_menu),
gs);
g_signal_connect(nmenu->toolbars_submenu->toolbar_menuitem,
"toggled",
G_CALLBACK(nsgtk_on_toolbar_activate_menu),
gs);
g_signal_connect(nmenu->toolbars_submenu->customize_menuitem,
"activate",
G_CALLBACK(nsgtk_on_customize_activate_menu),
gs);
/* set initial popup menu visibility */
popup_menu_hide(nmenu, false, false, true);
popup_menu_hide(nmenu, false, false);
return nmenu;
}
@ -1411,8 +1428,7 @@ void nsgtk_scaffolding_set_sensitivity(struct nsgtk_scaffolding *g)
nserror nsgtk_scaffolding_toolbar_context_menu(struct nsgtk_scaffolding *gs)
{
/* set visibility for right-click popup menu */
popup_menu_hide(gs->popup_menu, false, true, false);
popup_menu_show(gs->popup_menu, false, false, true);
popup_menu_hide(gs->popup_menu, false, true);
nsgtk_menu_popup_at_pointer(gs->popup_menu->popup_menu, NULL);
@ -1445,11 +1461,6 @@ nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g,
if (current_menu_features.link != NULL) {
/* menu is opening over a link */
gtkmenu = g->link_menu->link_menu;
} else if (gtk_widget_get_visible(GTK_WIDGET(g->menu_bar->bar_menu)) == FALSE) {
gtkmenu = g->burger_menu->burger_menu;
nsgtk_scaffolding_update_edit_actions_sensitivity(g);
} else {
gtkmenu = g->popup_menu->popup_menu;
@ -1473,8 +1484,6 @@ nsgtk_scaffolding_context_menu(struct nsgtk_scaffolding *g,
gtk_widget_show(GTK_WIDGET(g->popup_menu->paste_menuitem));
}
/* hide customise */
popup_menu_hide(g->popup_menu, false, false, true);
}
nsgtk_menu_popup_at_pointer(gtkmenu, NULL);

View File

@ -3758,3 +3758,16 @@ nsgtk_toolbar_item_activate(struct nsgtk_toolbar *tb,
return NSERROR_OK;
}
/* exported interface documented in toolbar.h */
nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool show)
{
if (show) {
gtk_widget_show(GTK_WIDGET(tb->widget));
} else {
gtk_widget_hide(GTK_WIDGET(tb->widget));
}
return NSERROR_OK;
}

View File

@ -95,6 +95,14 @@ nserror nsgtk_toolbar_set_websearch_image(struct nsgtk_toolbar *tb, GdkPixbuf *p
*/
nserror nsgtk_toolbar_item_activate(struct nsgtk_toolbar *tb, nsgtk_toolbar_button itemid);
/**
* set the toolbar to be shown or hidden
*
* \param toolbar A toolbar returned from a creation
* \param show true to show the toolbar and false to hide it.
* \return NSERROR_OK on success
*/
nserror nsgtk_toolbar_show(struct nsgtk_toolbar *tb, bool show);
/**
* sets up the images for scaffolding.

View File

@ -66,9 +66,6 @@
static GtkWidget *select_menu;
static struct form_control *select_menu_control;
static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
gpointer user_data);
struct gui_window {
/**
* The gtk scaffold object containing menu, buttons, url bar, [tabs],
@ -138,42 +135,12 @@ struct gui_window *window_list = NULL;
/** flag controlling opening of tabs in the background */
int temp_open_background = -1;
struct nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
{
return g->scaffold;
}
struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
{
return g->bw;
}
unsigned long nsgtk_window_get_signalhandler(struct gui_window *g, int i)
{
return g->signalhandler[i];
}
GtkLayout *nsgtk_window_get_layout(struct gui_window *g)
{
return g->layout;
}
GtkWidget *nsgtk_window_get_tab(struct gui_window *g)
{
return g->tab;
}
void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w)
{
g->tab = w;
}
static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
gpointer user_data)
static void
nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
gpointer user_data)
{
form_select_process_selection(select_menu_control,
(intptr_t)user_data);
(intptr_t)user_data);
}
#if GTK_CHECK_VERSION(3,0,0)
@ -270,8 +237,10 @@ nsgtk_window_draw_event(GtkWidget *widget, GdkEventExpose *event, gpointer data)
#endif
static gboolean nsgtk_window_motion_notify_event(GtkWidget *widget,
GdkEventMotion *event, gpointer data)
static gboolean
nsgtk_window_motion_notify_event(GtkWidget *widget,
GdkEventMotion *event,
gpointer data)
{
struct gui_window *g = data;
bool shift = event->state & GDK_SHIFT_MASK;
@ -385,8 +354,11 @@ nsgtk_window_button_press_event(GtkWidget *widget,
return TRUE;
}
static gboolean nsgtk_window_button_release_event(GtkWidget *widget,
GdkEventButton *event, gpointer data)
static gboolean
nsgtk_window_button_release_event(GtkWidget *widget,
GdkEventButton *event,
gpointer data)
{
struct gui_window *g = data;
bool shift = event->state & GDK_SHIFT_MASK;
@ -415,6 +387,7 @@ static gboolean nsgtk_window_button_release_event(GtkWidget *widget,
return TRUE;
}
static gboolean
nsgtk_window_scroll_event(GtkWidget *widget,
GdkEventScroll *event,
@ -502,8 +475,11 @@ nsgtk_window_scroll_event(GtkWidget *widget,
return TRUE;
}
static gboolean nsgtk_window_keypress_event(GtkWidget *widget,
GdkEventKey *event, gpointer data)
static gboolean
nsgtk_window_keypress_event(GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
struct gui_window *g = data;
uint32_t nskey;
@ -619,8 +595,11 @@ static gboolean nsgtk_window_keypress_event(GtkWidget *widget,
return TRUE;
}
static gboolean nsgtk_window_keyrelease_event(GtkWidget *widget,
GdkEventKey *event, gpointer data)
static gboolean
nsgtk_window_keyrelease_event(GtkWidget *widget,
GdkEventKey *event,
gpointer data)
{
struct gui_window *g = data;
@ -628,8 +607,10 @@ static gboolean nsgtk_window_keyrelease_event(GtkWidget *widget,
}
static void nsgtk_window_input_method_commit(GtkIMContext *ctx,
const gchar *str, gpointer data)
static void
nsgtk_window_input_method_commit(GtkIMContext *ctx,
const gchar *str,
gpointer data)
{
struct gui_window *g = data;
size_t len = strlen(str), offset = 0;
@ -644,8 +625,10 @@ static void nsgtk_window_input_method_commit(GtkIMContext *ctx,
}
static gboolean nsgtk_window_size_allocate_event(GtkWidget *widget,
GtkAllocation *allocation, gpointer data)
static gboolean
nsgtk_window_size_allocate_event(GtkWidget *widget,
GtkAllocation *allocation,
gpointer data)
{
struct gui_window *g = data;
@ -685,11 +668,15 @@ nsgtk_paned_notify__position(GObject *gobject, GParamSpec *pspec, gpointer data)
((gtk_paned_get_position(g->paned) * 10000) / (pane_alloc.width - 1)));
}
/** Set status bar / scroll bar proportion according to user option
* when pane is resized.
/**
* Set status bar / scroll bar proportion according to user option
* when pane is resized.
*/
static gboolean nsgtk_paned_size_allocate_event(GtkWidget *widget,
GtkAllocation *allocation, gpointer data)
static gboolean
nsgtk_paned_size_allocate_event(GtkWidget *widget,
GtkAllocation *allocation,
gpointer data)
{
gtk_paned_set_position(GTK_PANED(widget),
(nsoption_int(toolbar_status_size) * allocation->width) / 10000);
@ -697,7 +684,10 @@ static gboolean nsgtk_paned_size_allocate_event(GtkWidget *widget,
return TRUE;
}
/* destroy the browsing context as there is nothing to display it now */
/**
* destroy the browsing context as there is nothing to display it now
*/
static void window_destroy(GtkWidget *widget, gpointer data)
{
struct gui_window *gw = data;
@ -708,13 +698,13 @@ static void window_destroy(GtkWidget *widget, gpointer data)
}
static struct browser_window *bw_from_gw(void *data)
{
struct gui_window *gw = data;
return gw->bw;
}
/**
* Create and open a gtk container (window or tab) for a browsing context.
*
@ -897,31 +887,6 @@ gui_window_create(struct browser_window *bw,
return g;
}
/* exported interface documented in window.h */
nserror
nsgtk_window_item_activate(struct gui_window *gw, nsgtk_toolbar_button itemid)
{
return nsgtk_toolbar_item_activate(gw->toolbar, itemid);
}
/* exported interface documented in window.h */
void nsgtk_window_update_all(void)
{
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);
}
}
void nsgtk_window_destroy_browser(struct gui_window *gw)
{
/* remove tab */
gtk_widget_destroy(gw->container);
}
static void gui_window_destroy(struct gui_window *g)
{
@ -943,6 +908,7 @@ static void gui_window_destroy(struct gui_window *g)
NSLOG(netsurf, INFO, "window list head: %p", window_list);
}
/**
* favicon setting for gtk gui window.
*
@ -977,6 +943,7 @@ gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *icon)
nsgtk_tab_set_icon(gw, gw->icon);
}
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout);
@ -991,6 +958,7 @@ static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
return true;
}
static void nsgtk_redraw_caret(struct gui_window *g)
{
int sx, sy;
@ -1005,6 +973,7 @@ static void nsgtk_redraw_caret(struct gui_window *g)
}
static void gui_window_remove_caret(struct gui_window *g)
{
int sx, sy;
@ -1022,6 +991,7 @@ static void gui_window_remove_caret(struct gui_window *g)
}
/**
* Invalidates an area of a GTK browser window
*
@ -1054,6 +1024,7 @@ nsgtk_window_invalidate_area(struct gui_window *g, const struct rect *rect)
return NSERROR_OK;
}
static void gui_window_set_status(struct gui_window *g, const char *text)
{
assert(g);
@ -1107,6 +1078,7 @@ gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
return NSERROR_OK;
}
static void gui_window_update_extent(struct gui_window *g)
{
int w, h;
@ -1116,8 +1088,9 @@ static void gui_window_update_extent(struct gui_window *g)
}
}
static void gui_window_set_pointer(struct gui_window *g,
gui_pointer_shape shape)
static void
gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
GdkCursor *cursor = NULL;
GdkCursorType cursortype;
@ -1254,13 +1227,16 @@ gui_window_get_dimensions(struct gui_window *gw, int *width, int *height)
return NSERROR_OK;
}
static void gui_window_start_selection(struct gui_window *g)
{
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
}
static void gui_window_create_form_select_menu(struct gui_window *g,
struct form_control *control)
static void
gui_window_create_form_select_menu(struct gui_window *g,
struct form_control *control)
{
intptr_t item;
struct form_option *option;
@ -1425,6 +1401,7 @@ gui_search_web_provider_update(const char *name, struct bitmap *bitmap)
return NSERROR_OK;
}
/**
* GTK frontend web search operation table
*/
@ -1460,3 +1437,88 @@ static struct gui_window_table window_table = {
};
struct gui_window_table *nsgtk_window_table = &window_table;
/* exported interface documented in window.h */
struct nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
{
return g->scaffold;
}
/* exported interface documented in window.h */
struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
{
return g->bw;
}
/* exported interface documented in window.h */
unsigned long nsgtk_window_get_signalhandler(struct gui_window *g, int i)
{
return g->signalhandler[i];
}
/* exported interface documented in window.h */
GtkLayout *nsgtk_window_get_layout(struct gui_window *g)
{
return g->layout;
}
/* exported interface documented in window.h */
GtkWidget *nsgtk_window_get_tab(struct gui_window *g)
{
return g->tab;
}
/* exported interface documented in window.h */
void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w)
{
g->tab = w;
}
/* exported interface documented in window.h */
nserror
nsgtk_window_item_activate(struct gui_window *gw, nsgtk_toolbar_button itemid)
{
return nsgtk_toolbar_item_activate(gw->toolbar, itemid);
}
/* exported interface documented in window.h */
void nsgtk_window_destroy_browser(struct gui_window *gw)
{
/* remove tab */
gtk_widget_destroy(gw->container);
}
/* exported interface documented in window.h */
nserror nsgtk_window_update_all(void)
{
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);
}
return NSERROR_OK;
}
/* exported interface documented in window.h */
nserror nsgtk_window_toolbar_show(struct nsgtk_scaffolding *gs, bool show)
{
struct gui_window *gw;
for (gw = window_list; gw != NULL; gw = gw->next) {
if (gw->scaffold == gs) {
nsgtk_toolbar_show(gw->toolbar, show);
}
}
return NSERROR_OK;
}

View File

@ -52,7 +52,12 @@ struct nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *gw);
* toolbar size and style is changed and the browser window contents
* redrawn.
*/
void nsgtk_window_update_all(void);
nserror nsgtk_window_update_all(void);
/**
* Windows associated with a scaffold will have their toolbar show state set
*/
nserror nsgtk_window_toolbar_show(struct nsgtk_scaffolding *gs, bool show);
/**
* update targets