Add closeview() for JavaScript window closing
Simply call gtk_widget_destroy() on the window. Then GtkWindow closing process will take care of the rest.
This commit is contained in:
parent
04d46d1791
commit
2e1fb87361
18
surf.c
18
surf.c
|
@ -120,6 +120,7 @@ static gboolean decidepolicy(WebKitWebView *v, WebKitPolicyDecision *d,
|
||||||
static void decidenavigation(WebKitPolicyDecision *d, Client *c);
|
static void decidenavigation(WebKitPolicyDecision *d, Client *c);
|
||||||
static void decidenewwindow(WebKitPolicyDecision *d, Client *c);
|
static void decidenewwindow(WebKitPolicyDecision *d, Client *c);
|
||||||
static void decideresource(WebKitPolicyDecision *d, Client *c);
|
static void decideresource(WebKitPolicyDecision *d, Client *c);
|
||||||
|
static void closeview(WebKitWebView *v, Client *c);
|
||||||
static void destroyclient(Client *c);
|
static void destroyclient(Client *c);
|
||||||
static void destroywin(GtkWidget* w, Client *c);
|
static void destroywin(GtkWidget* w, Client *c);
|
||||||
static void die(const char *errstr, ...);
|
static void die(const char *errstr, ...);
|
||||||
|
@ -551,10 +552,9 @@ destroyclient(Client *c)
|
||||||
Client *p;
|
Client *p;
|
||||||
|
|
||||||
webkit_web_view_stop_loading(c->view);
|
webkit_web_view_stop_loading(c->view);
|
||||||
gtk_widget_destroy(GTK_WIDGET(c->view));
|
/* Not needed, has already been called
|
||||||
gtk_widget_destroy(c->scroll);
|
|
||||||
gtk_widget_destroy(c->vbox);
|
|
||||||
gtk_widget_destroy(c->win);
|
gtk_widget_destroy(c->win);
|
||||||
|
*/
|
||||||
|
|
||||||
for (p = clients; p && p->next != c; p = p->next)
|
for (p = clients; p && p->next != c; p = p->next)
|
||||||
;
|
;
|
||||||
|
@ -563,14 +563,20 @@ destroyclient(Client *c)
|
||||||
else
|
else
|
||||||
clients = c->next;
|
clients = c->next;
|
||||||
free(c);
|
free(c);
|
||||||
if (clients == NULL)
|
}
|
||||||
gtk_main_quit();
|
|
||||||
|
void
|
||||||
|
closeview(WebKitWebView *v, Client *c)
|
||||||
|
{
|
||||||
|
gtk_widget_destroy(c->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
destroywin(GtkWidget* w, Client *c)
|
destroywin(GtkWidget* w, Client *c)
|
||||||
{
|
{
|
||||||
destroyclient(c);
|
destroyclient(c);
|
||||||
|
if (clients == NULL)
|
||||||
|
gtk_main_quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -998,6 +1004,8 @@ newview(Client *c, WebKitWebView *rv)
|
||||||
g_signal_connect(G_OBJECT(v),
|
g_signal_connect(G_OBJECT(v),
|
||||||
"button-release-event",
|
"button-release-event",
|
||||||
G_CALLBACK(buttonreleased), c);
|
G_CALLBACK(buttonreleased), c);
|
||||||
|
g_signal_connect(G_OBJECT(v), "close",
|
||||||
|
G_CALLBACK(closeview), c);
|
||||||
|
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user