summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hofmann <scm@uninformativ.de>2014-06-14 16:21:22 +0200
committerPeter Hofmann <scm@uninformativ.de>2014-06-14 16:22:15 +0200
commit204beb9adcf6d899381af25c9b56197819bbc274 (patch)
treeed5f1009dd8d445a13446cddab057da2eff8a83c
parentf132a4c29e2619e473f275ad1ccc26d6e5ccaa23 (diff)
downloadlariza-204beb9adcf6d899381af25c9b56197819bbc274.tar.gz
Monitor load-status
-rw-r--r--zea.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/zea.c b/zea.c
index b4ed42b..96754cf 100644
--- a/zea.c
+++ b/zea.c
@@ -15,6 +15,8 @@ static gboolean zea_do_download(WebKitWebView *, WebKitDownload *, gpointer);
static gboolean zea_download_request(WebKitWebView *, WebKitWebFrame *,
WebKitNetworkRequest *, gchar *,
WebKitWebPolicyDecision *, gpointer);
+static void zea_load_status_changed(GObject *obj, GParamSpec *pspec,
+ gpointer data);
static gboolean zea_location_key(GtkWidget *, GdkEvent *, gpointer);
static void zea_new_client(const gchar *uri);
static gboolean zea_new_client_request(WebKitWebView *, WebKitWebFrame *,
@@ -177,6 +179,8 @@ zea_new_client(const gchar *uri)
G_CALLBACK(zea_title_changed), c);
g_signal_connect(G_OBJECT(c->web_view), "notify::uri",
G_CALLBACK(zea_uri_changed), c);
+ g_signal_connect(G_OBJECT(c->web_view), "notify::load-status",
+ G_CALLBACK(zea_load_status_changed), c);
g_signal_connect(G_OBJECT(c->web_view),
"new-window-policy-decision-requested",
G_CALLBACK(zea_new_client_request), NULL);
@@ -276,6 +280,27 @@ zea_uri_changed(GObject *obj, GParamSpec *pspec, gpointer data)
}
void
+zea_load_status_changed(GObject *obj, GParamSpec *pspec, gpointer data)
+{
+ struct Client *c = (struct Client *)data;
+
+ (void)obj;
+ (void)pspec;
+
+ if (webkit_web_view_get_load_status(WEBKIT_WEB_VIEW(c->web_view))
+ == WEBKIT_LOAD_FINISHED)
+ {
+ gtk_statusbar_pop(GTK_STATUSBAR(c->status), 1);
+ gtk_statusbar_push(GTK_STATUSBAR(c->status), 1, "Finished.");
+ }
+ else
+ {
+ gtk_statusbar_pop(GTK_STATUSBAR(c->status), 1);
+ gtk_statusbar_push(GTK_STATUSBAR(c->status), 1, "Loading...");
+ }
+}
+
+void
zea_web_view_hover(WebKitWebView *web_view, gchar *title, gchar *uri,
gpointer data)
{