mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 21:16:50 +03:00
fix resource release and stopping throbber on toolbar widget destruction
This commit is contained in:
parent
12cca32059
commit
2bed178a33
@ -1353,19 +1353,14 @@ customisation_reset_clicked_cb(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* customisation container delete handler
|
* customisation container destroy handler
|
||||||
*/
|
*/
|
||||||
static gboolean
|
static void customisation_container_destroy_cb(GtkWidget *widget, gpointer data)
|
||||||
customisation_container_delete_cb(GtkWidget *widget,
|
|
||||||
GdkEvent *event,
|
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
struct nsgtk_toolbar_customisation *tbc;
|
struct nsgtk_toolbar_customisation *tbc;
|
||||||
tbc = (struct nsgtk_toolbar_customisation *)data;
|
tbc = (struct nsgtk_toolbar_customisation *)data;
|
||||||
|
|
||||||
free(tbc);
|
free(tbc);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1487,8 +1482,8 @@ static gboolean cutomize_button_clicked_cb(GtkWidget *widget, gpointer data)
|
|||||||
|
|
||||||
/* close and cleanup on delete signal */
|
/* close and cleanup on delete signal */
|
||||||
g_signal_connect(tbc->container,
|
g_signal_connect(tbc->container,
|
||||||
"delete-event",
|
"destroy",
|
||||||
G_CALLBACK(customisation_container_delete_cb),
|
G_CALLBACK(customisation_container_destroy_cb),
|
||||||
tbc);
|
tbc);
|
||||||
|
|
||||||
|
|
||||||
@ -3175,6 +3170,22 @@ toolbar_popup_context_menu_cb(GtkToolbar *toolbar,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* toolbar delete signal handler
|
||||||
|
*/
|
||||||
|
static void toolbar_destroy_cb(GtkWidget *widget, gpointer data)
|
||||||
|
{
|
||||||
|
struct nsgtk_toolbar *tb;
|
||||||
|
tb = (struct nsgtk_toolbar *)data;
|
||||||
|
|
||||||
|
/* ensure any throbber scheduled is stopped */
|
||||||
|
nsgtk_schedule(-1, next_throbber_frame, tb);
|
||||||
|
|
||||||
|
free(tb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* exported interface documented in toolbar.h */
|
/* exported interface documented in toolbar.h */
|
||||||
nserror
|
nserror
|
||||||
nsgtk_toolbar_create(GtkBuilder *builder,
|
nsgtk_toolbar_create(GtkBuilder *builder,
|
||||||
@ -3204,18 +3215,22 @@ nsgtk_toolbar_create(GtkBuilder *builder,
|
|||||||
G_CALLBACK(toolbar_popup_context_menu_cb),
|
G_CALLBACK(toolbar_popup_context_menu_cb),
|
||||||
tb);
|
tb);
|
||||||
|
|
||||||
|
/* close and cleanup on delete signal */
|
||||||
|
g_signal_connect(tb->widget,
|
||||||
|
"destroy",
|
||||||
|
G_CALLBACK(toolbar_destroy_cb),
|
||||||
|
tb);
|
||||||
|
|
||||||
/* allocate button contexts */
|
/* allocate button contexts */
|
||||||
for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
|
for (bidx = BACK_BUTTON; bidx < PLACEHOLDER_BUTTON; bidx++) {
|
||||||
res = toolbar_item_create(bidx, &tb->items[bidx]);
|
res = toolbar_item_create(bidx, &tb->items[bidx]);
|
||||||
if (res != NSERROR_OK) {
|
if (res != NSERROR_OK) {
|
||||||
free(tb);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = nsgtk_toolbar_update(tb);
|
res = nsgtk_toolbar_update(tb);
|
||||||
if (res != NSERROR_OK) {
|
if (res != NSERROR_OK) {
|
||||||
free(tb);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3224,14 +3239,6 @@ nsgtk_toolbar_create(GtkBuilder *builder,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* exported interface documented in toolbar.h */
|
|
||||||
nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *tb)
|
|
||||||
{
|
|
||||||
/** \todo free buttons and destroy toolbar container (and widgets) */
|
|
||||||
free(tb);
|
|
||||||
return NSERROR_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* exported interface documented in toolbar.h */
|
/* exported interface documented in toolbar.h */
|
||||||
nserror nsgtk_toolbar_restyle(struct nsgtk_toolbar *tb)
|
nserror nsgtk_toolbar_restyle(struct nsgtk_toolbar *tb)
|
||||||
{
|
{
|
||||||
@ -3283,8 +3290,6 @@ nserror nsgtk_toolbar_throbber(struct nsgtk_toolbar *tb, bool active)
|
|||||||
nserror res;
|
nserror res;
|
||||||
struct browser_window *bw;
|
struct browser_window *bw;
|
||||||
|
|
||||||
bw = tb->get_bw(tb->get_ctx);
|
|
||||||
|
|
||||||
/* when activating the throbber simply schedule the next frame update */
|
/* when activating the throbber simply schedule the next frame update */
|
||||||
if (active) {
|
if (active) {
|
||||||
nsgtk_schedule(THROBBER_FRAME_TIME, next_throbber_frame, tb);
|
nsgtk_schedule(THROBBER_FRAME_TIME, next_throbber_frame, tb);
|
||||||
@ -3301,6 +3306,8 @@ nserror nsgtk_toolbar_throbber(struct nsgtk_toolbar *tb, bool active)
|
|||||||
res = set_throbber_frame(tb->items[THROBBER_ITEM].button,
|
res = set_throbber_frame(tb->items[THROBBER_ITEM].button,
|
||||||
tb->throb_frame);
|
tb->throb_frame);
|
||||||
|
|
||||||
|
bw = tb->get_bw(tb->get_ctx);
|
||||||
|
|
||||||
/* adjust sensitivity of other items */
|
/* adjust sensitivity of other items */
|
||||||
set_item_sensitivity(&tb->items[STOP_BUTTON], false);
|
set_item_sensitivity(&tb->items[STOP_BUTTON], false);
|
||||||
set_item_sensitivity(&tb->items[RELOAD_BUTTON], true);
|
set_item_sensitivity(&tb->items[RELOAD_BUTTON], true);
|
||||||
|
@ -35,15 +35,6 @@ struct nsgtk_scaffolding;
|
|||||||
nserror nsgtk_toolbar_create(GtkBuilder *builder, struct browser_window *(*get_bw)(void *ctx), void *get_bw_ctx,struct nsgtk_toolbar **toolbar);
|
nserror nsgtk_toolbar_create(GtkBuilder *builder, struct browser_window *(*get_bw)(void *ctx), void *get_bw_ctx,struct nsgtk_toolbar **toolbar);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Destroy toolbar previously created
|
|
||||||
*
|
|
||||||
* \param toolbar A toolbar returned from a creation
|
|
||||||
* \return NSERROR_OK on success
|
|
||||||
*/
|
|
||||||
nserror nsgtk_toolbar_destroy(struct nsgtk_toolbar *toolbar);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the toolbar items being shown based on current settings
|
* Update the toolbar items being shown based on current settings
|
||||||
*
|
*
|
||||||
|
@ -1479,13 +1479,6 @@ struct nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* exported interface documented in window.h */
|
|
||||||
struct gtk_search *nsgtk_window_get_search(struct gui_window *gw)
|
|
||||||
{
|
|
||||||
return gw->search;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* exported interface documented in window.h */
|
/* exported interface documented in window.h */
|
||||||
struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
|
struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
|
||||||
{
|
{
|
||||||
|
@ -101,11 +101,6 @@ nserror nsgtk_window_search_toggle(struct gui_window *gw);
|
|||||||
GtkLayout *nsgtk_window_get_layout(struct gui_window *gw);
|
GtkLayout *nsgtk_window_get_layout(struct gui_window *gw);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get search from window handle
|
|
||||||
*/
|
|
||||||
struct gtk_search *nsgtk_window_get_search(struct gui_window *gw);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* activate the handler for a item in a toolbar of a gui window
|
* activate the handler for a item in a toolbar of a gui window
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user