Replace loadstatuschanged() with loadchanged()

This commit is contained in:
Quentin Rameau 2015-11-18 18:39:45 +01:00
parent bce814b30a
commit e9ec482049

50
surf.c
View file

@ -153,8 +153,7 @@ static gboolean keypress(GtkAccelGroup *group, GObject *obj, guint key,
GdkModifierType mods, Client *c); GdkModifierType mods, Client *c);
static void mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h, static void mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h,
guint modifiers, Client *c); guint modifiers, Client *c);
static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec, static void loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c);
Client *c);
static void loaduri(Client *c, const Arg *arg); static void loaduri(Client *c, const Arg *arg);
static void navigate(Client *c, const Arg *arg); static void navigate(Client *c, const Arg *arg);
static Client *newclient(Client *c); static Client *newclient(Client *c);
@ -809,37 +808,34 @@ mousetargetchanged(WebKitWebView *v, WebKitHitTestResult *h, guint modifiers,
} }
void void
loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c) loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
{ {
WebKitWebFrame *frame; switch (e) {
WebKitWebDataSource *src; case WEBKIT_LOAD_STARTED:
WebKitNetworkRequest *request; c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
SoupMessage *msg; break;
char *uri; case WEBKIT_LOAD_REDIRECTED:
setatom(c, AtomUri, geturi(c));
switch (webkit_web_view_get_load_status (c->view)) { break;
case WEBKIT_LOAD_COMMITTED: case WEBKIT_LOAD_COMMITTED:
uri = geturi(c); if (!webkit_web_view_get_tls_info(c->view, NULL, &(c->tlsflags)))
if (strstr(uri, "https://") == uri) { c->tlsflags = G_TLS_CERTIFICATE_VALIDATE_ALL + 1;
frame = webkit_web_view_get_main_frame(c->view);
src = webkit_web_frame_get_data_source(frame); setatom(c, AtomUri, geturi(c));
request = webkit_web_data_source_get_request(src);
msg = webkit_network_request_get_message(request);
c->sslfailed = !(soup_message_get_flags(msg)
& SOUP_MESSAGE_CERTIFICATE_TRUSTED);
}
setatom(c, AtomUri, uri);
if (enablestyle) if (enablestyle)
setstyle(c, getstyle(uri)); setstyle(c, getstyle(geturi(c)));
break; break;
case WEBKIT_LOAD_FINISHED: case WEBKIT_LOAD_FINISHED:
c->progress = 100; /* Disabled until we write some WebKitWebExtension for
updatetitle(c); * manipulating the DOM directly.
break; evalscript(c, "document.documentElement.style.overflow = '%s'",
default: enablescrollbars ? "auto" : "hidden");
*/
runscript(c);
break; break;
} }
updatetitle(c);
} }
void void
@ -992,8 +988,8 @@ newview(Client *c, WebKitWebView *rv)
"window-object-cleared", "window-object-cleared",
G_CALLBACK(windowobjectcleared), c); G_CALLBACK(windowobjectcleared), c);
g_signal_connect(G_OBJECT(v), g_signal_connect(G_OBJECT(v),
"notify::load-status", "load-changed",
G_CALLBACK(loadstatuschange), c); G_CALLBACK(loadchanged), c);
g_signal_connect(G_OBJECT(v), g_signal_connect(G_OBJECT(v),
"notify::progress", "notify::progress",
G_CALLBACK(progresschange), c); G_CALLBACK(progresschange), c);