Started transitioning to Webkit 2.0

Unfortunately, webkit_web_view_load_string() is not implemented in the
2.0 API, so trying with load_html() for now. Seems not to work with SVG
images without tweaking.
This commit is contained in:
Gergely Polonkai 2014-07-08 21:04:45 +02:00
parent ee4faf34a6
commit 6724f68dcf
2 changed files with 7 additions and 6 deletions

View File

@ -32,7 +32,7 @@ PKG_CHECK_MODULES([GOBJECT], [gobject-2.0])
PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.8]) PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.8])
PKG_CHECK_MODULES([LIBXML], [libxml-2.0]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
PKG_CHECK_MODULES([LIBXSLT], [libexslt]) PKG_CHECK_MODULES([LIBXSLT], [libexslt])
PKG_CHECK_MODULES([WEBKIT], [webkitgtk-3.0]) PKG_CHECK_MODULES([WEBKIT], [webkit2gtk-3.0])
PKG_CHECK_MODULES([SWE_GLIB], [swe-glib >= 2.0.0]) PKG_CHECK_MODULES([SWE_GLIB], [swe-glib >= 2.0.0])
AC_CONFIG_FILES([ AC_CONFIG_FILES([

View File

@ -3,7 +3,7 @@
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/tree.h> #include <libxml/tree.h>
#include <webkit/webkit.h> #include <webkit2/webkit2.h>
#include <swe-glib.h> #include <swe-glib.h>
@ -511,9 +511,9 @@ ag_window_redraw_chart(AgWindow *window)
gtk_dialog_run(GTK_DIALOG(dialog)); gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog); gtk_widget_destroy(dialog);
} else { } else {
webkit_web_view_load_string( webkit_web_view_load_html(
WEBKIT_WEB_VIEW(priv->chart_web_view), WEBKIT_WEB_VIEW(priv->chart_web_view),
svg_content, "image/svg+xml", "UTF-8", "file://"); svg_content, NULL);
g_free(svg_content); g_free(svg_content);
} }
@ -682,7 +682,8 @@ ag_window_init(AgWindow *window)
g_signal_connect(G_OBJECT(main_settings), "changed::planets-char", G_CALLBACK(ag_window_display_changed), window); g_signal_connect(G_OBJECT(main_settings), "changed::planets-char", G_CALLBACK(ag_window_display_changed), window);
g_signal_connect(G_OBJECT(main_settings), "changed::aspects-char", G_CALLBACK(ag_window_display_changed), window); g_signal_connect(G_OBJECT(main_settings), "changed::aspects-char", G_CALLBACK(ag_window_display_changed), window);
webkit_web_view_load_string( // TODO: translate this error message!
webkit_web_view_load_html(
WEBKIT_WEB_VIEW(priv->chart_web_view), WEBKIT_WEB_VIEW(priv->chart_web_view),
"<html>" \ "<html>" \
"<head>" \ "<head>" \
@ -693,7 +694,7 @@ ag_window_init(AgWindow *window)
"<p>No chart is loaded. Create one on the edit view, or open one from the application menu!</p>" \ "<p>No chart is loaded. Create one on the edit view, or open one from the application menu!</p>" \
"</body>" \ "</body>" \
"</html>", "</html>",
"text/html", "UTF-8", NULL); NULL);
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "edit"); gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "edit");
priv->current_tab = priv->tab_edit; priv->current_tab = priv->tab_edit;