[yelp/wip/amigadave/webkit2-port: 52/53] yelp-window: Fix loading cursor inconsistencies
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp/wip/amigadave/webkit2-port: 52/53] yelp-window: Fix loading cursor inconsistencies
- Date: Mon, 22 Jun 2015 14:01:39 +0000 (UTC)
commit db4c52887b1cd6645ddb9ae7a9b8ab2d84141d8a
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jun 16 12:19:05 2015 +0200
yelp-window: Fix loading cursor inconsistencies
Connect to WebKitWebView notify::is-loading to change the cursor only
when the view is loading.
src/yelp-window.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
---
diff --git a/src/yelp-window.c b/src/yelp-window.c
index 8890aeb..1ab1464 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -122,6 +122,9 @@ static void view_new_window (YelpView *view,
YelpWindow *window);
static void view_loaded (YelpView *view,
YelpWindow *window);
+static void view_is_loading_changed (YelpView *view,
+ GParamSpec *pspec,
+ YelpWindow *window);
static void view_uri_selected (YelpView *view,
GParamSpec *pspec,
YelpWindow *window);
@@ -504,6 +507,7 @@ window_construct (YelpWindow *window)
g_signal_connect (priv->view, "new-view-requested", G_CALLBACK (view_new_window), window);
g_signal_connect (priv->view, "loaded", G_CALLBACK (view_loaded), window);
+ g_signal_connect (priv->view, "notify::is-loading", G_CALLBACK (view_is_loading_changed), window);
g_signal_connect (priv->view, "notify::yelp-uri", G_CALLBACK (view_uri_selected), window);
g_signal_connect_swapped (priv->view, "notify::page-id",
G_CALLBACK (window_set_bookmark_buttons), window);
@@ -1066,7 +1070,6 @@ view_loaded (YelpView *view,
YelpUri *uri;
gchar *doc_uri;
YelpViewState state;
- GdkWindow *gdkwin;
YelpWindowPrivate *priv = GET_PRIV (window);
g_object_get (view,
@@ -1075,10 +1078,6 @@ view_loaded (YelpView *view,
NULL);
doc_uri = yelp_uri_get_document_uri (uri);
- gdkwin = gtk_widget_get_window (GTK_WIDGET (window));
- if (gdkwin != NULL)
- gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
-
if (state != YELP_VIEW_STATE_ERROR) {
gchar *page_id, *icon, *title;
g_object_get (view,
@@ -1104,25 +1103,38 @@ view_loaded (YelpView *view,
}
static void
+view_is_loading_changed (YelpView *view,
+ GParamSpec *pspec,
+ YelpWindow *window)
+{
+ GdkWindow *gdkwin;
+
+ gdkwin = gtk_widget_get_window (GTK_WIDGET (window));
+ if (!gdkwin)
+ return;
+
+ if (webkit_web_view_is_loading (WEBKIT_WEB_VIEW (view))) {
+ gdk_window_set_cursor (gdkwin,
+ gdk_cursor_new_for_display (gdk_window_get_display (gdkwin),
+ GDK_WATCH));
+ } else {
+ gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (window)), NULL);
+ }
+}
+
+static void
view_uri_selected (YelpView *view,
GParamSpec *pspec,
YelpWindow *window)
{
YelpUri *uri;
gchar *doc_uri;
- GdkWindow *gdkwin;
YelpWindowPrivate *priv = GET_PRIV (window);
g_object_get (G_OBJECT (view), "yelp-uri", &uri, NULL);
if (uri == NULL)
return;
- gdkwin = gtk_widget_get_window (GTK_WIDGET (window));
- if (gdkwin != NULL)
- gdk_window_set_cursor (gdkwin,
- gdk_cursor_new_for_display (gdk_window_get_display (gdkwin),
- GDK_WATCH));
-
doc_uri = yelp_uri_get_document_uri (uri);
if (priv->doc_uri == NULL || !g_str_equal (priv->doc_uri, doc_uri)) {
window_set_bookmarks (window, doc_uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]