[geany/geany-plugins] 630bba: markdown: Use load-changed signal instead of listening on is-loading

Chow Loong Jin git-noreply at xxxxx
Wed May 30 05:21:14 UTC 2018


Branch:      refs/heads/master
Author:      Chow Loong Jin <hyperair at debian.org>
Committer:   Chow Loong Jin <hyperair at debian.org>
Date:        Thu, 18 Jan 2018 16:44:23 UTC
Commit:      630bba7f905ee5c8f748ddc3a4b2d13e47f61b97
             https://github.com/geany/geany-plugins/commit/630bba7f905ee5c8f748ddc3a4b2d13e47f61b97

Log Message:
-----------
markdown: Use load-changed signal instead of listening on is-loading

We want to know when webkit finishes loading, so this simplifies matters.


Modified Paths:
--------------
    markdown/src/viewer.c

Modified: markdown/src/viewer.c
15 lines changed, 6 insertions(+), 9 deletions(-)
===================================================================
@@ -297,15 +297,12 @@ pop_scroll_pos(MarkdownViewer *self)
 }
 
 static void
-on_webview_is_loading_notify(WebKitWebView *view, GParamSpec *pspec,
-  MarkdownViewer *self)
+on_webview_load_changed(MarkdownViewer  *self,
+                        WebKitLoadEvent  load_event,
+                        WebKitWebView   *web_view)
 {
-  gboolean load_status;
-
-  g_object_get(view, "is-loading", &load_status, NULL);
-
   /* When the webkit is done loading, reset the scroll position. */
-  if (!load_status) {
+  if (load_event == WEBKIT_LOAD_FINISHED) {
     pop_scroll_pos(self);
   }
 }
@@ -389,8 +386,8 @@ markdown_viewer_update_view(MarkdownViewer *self)
      * position once the webview is reloaded. */
     if (self->priv->load_handle == 0) {
       self->priv->load_handle =
-        g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::is-loading",
-          G_CALLBACK(on_webview_is_loading_notify), self);
+        g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "load-changed",
+          G_CALLBACK(on_webview_load_changed), self);
     }
 
     webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list