Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: GitHub noreply@github.com Date: Thu, 25 Apr 2024 17:04:20 UTC Commit: 2b897dc56c097551d2214aef9bfe2c9341585e52 https://github.com/geany/geany-plugins/commit/2b897dc56c097551d2214aef9bfe2c...
Log Message: ----------- Merge pull request #1335 from xiota/pr-markdown-webkit2gtk-4.1
Markdown: Add support for webkit2gtk-4.1
Modified Paths: -------------- build/markdown.m4 markdown/README markdown/src/Makefile.am markdown/src/viewer.c markdown/src/viewer.h
Modified: build/markdown.m4 16 lines changed, 11 insertions(+), 5 deletions(-) =================================================================== @@ -46,16 +46,22 @@ AC_DEFUN([GP_CHECK_MARKDOWN], [markdown_library=libmarkdown]) GP_STATUS_FEATURE_ADD([Markdown library], [$markdown_library])
- GTK_VERSION=2.16 - WEBKIT_VERSION=1.1.13 + GTK_VERSION=3.0 + WEBKIT_VERSION=2.30 + + dnl Support both webkit2gtk 4.0 and 4.1, as the only difference is the + dnl libsoup version in the API, which we don't use. + dnl Prefer the 4.1 version, but use the 4.0 version as fallback if + dnl available -- yet still ask for the 4.1 if neither are available + webkit_package=webkit2gtk-4.1 + PKG_CHECK_EXISTS([${webkit_package} >= ${WEBKIT_VERSION}],, + [PKG_CHECK_EXISTS([webkit2gtk-4.0 >= ${WEBKIT_VERSION}], + [webkit_package=webkit2gtk-4.0])])
- GP_CHECK_GTK3([webkit_package=webkit2gtk-4.0], - [webkit_package=webkit-1.0]) GP_CHECK_PLUGIN_DEPS([markdown], [MARKDOWN], [$GP_GTK_PACKAGE >= ${GTK_VERSION} $webkit_package >= ${WEBKIT_VERSION} gthread-2.0]) - AM_CONDITIONAL([MARKDOWN_WEBKIT2], [test "$webkit_package" = webkit2gtk-4.0])
GP_COMMIT_PLUGIN_STATUS([Markdown])
Modified: markdown/README 4 lines changed, 2 insertions(+), 2 deletions(-) =================================================================== @@ -146,8 +146,8 @@ Requirements
The plugin depends on the following libraries:
-* `GTK+ http://www.gtk.org`_ 2.16 or greater -* `WebKitGTK+ http://webkitgtk.org`_ 1.1.18 or greater +* `GTK+ http://www.gtk.org`_ 3.0 or greater +* `WebKitGTK+ http://webkitgtk.org`_ API 4.0 or 4.1
License -------
Modified: markdown/src/Makefile.am 4 lines changed, 0 insertions(+), 4 deletions(-) =================================================================== @@ -35,8 +35,4 @@ markdown_la_CFLAGS += $(LIBMARKDOWN_CFLAGS) markdown_la_LIBADD += $(LIBMARKDOWN_LIBS) endif
-if MARKDOWN_WEBKIT2 -markdown_la_CFLAGS += -DMARKDOWN_WEBKIT2 -endif - include $(top_srcdir)/build/cppcheck.mk
Modified: markdown/src/viewer.c 33 lines changed, 1 insertions(+), 32 deletions(-) =================================================================== @@ -22,11 +22,7 @@ #include "config.h" #include <string.h> #include <gtk/gtk.h> -#ifdef MARKDOWN_WEBKIT2 -# include <webkit2/webkit2.h> -#else -# include <webkit/webkitwebview.h> -#endif +#include <webkit2/webkit2.h> #include <geanyplugin.h> #ifndef FULL_PRICE # include <mkdio.h> @@ -303,7 +299,6 @@ pop_scroll_pos(MarkdownViewer *self) return popped; }
-#ifdef MARKDOWN_WEBKIT2 static void on_webview_load_changed(MarkdownViewer *self, WebKitLoadEvent load_event, @@ -314,21 +309,6 @@ on_webview_load_changed(MarkdownViewer *self, pop_scroll_pos(self); } } -#else -static void -on_webview_load_status_notify(WebKitWebView *view, GParamSpec *pspec, - MarkdownViewer *self) -{ - WebKitLoadStatus load_status; - - g_object_get(view, "load-status", &load_status, NULL); - - /* When the webkit is done loading, reset the scroll position. */ - if (load_status == WEBKIT_LOAD_FINISHED) { - pop_scroll_pos(self); - } -} -#endif
gchar * markdown_viewer_get_html(MarkdownViewer *self) @@ -408,23 +388,12 @@ markdown_viewer_update_view(MarkdownViewer *self) /* Connect a signal handler (only needed once) to restore the scroll * position once the webview is reloaded. */ if (self->priv->load_handle == 0) { -#ifdef MARKDOWN_WEBKIT2 self->priv->load_handle = g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "load-changed", G_CALLBACK(on_webview_load_changed), self); -#else - self->priv->load_handle = - g_signal_connect_swapped(WEBKIT_WEB_VIEW(self), "notify::load-status", - G_CALLBACK(on_webview_load_status_notify), self); -#endif }
-#ifdef MARKDOWN_WEBKIT2 webkit_web_view_load_html(WEBKIT_WEB_VIEW(self), html, base_uri); -#else - webkit_web_view_load_string(WEBKIT_WEB_VIEW(self), html, "text/html", - self->priv->enc, base_uri); -#endif
g_free(base_uri); g_free(html);
Modified: markdown/src/viewer.h 6 lines changed, 1 insertions(+), 5 deletions(-) =================================================================== @@ -23,11 +23,7 @@ #define MARKDOWN_VIEWER_H 1
#include <gtk/gtk.h> -#ifdef MARKDOWN_WEBKIT2 -# include <webkit2/webkit2.h> -#else -# include <webkit/webkitwebview.h> -#endif +#include <webkit2/webkit2.h>
G_BEGIN_DECLS
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org