From: Teus Benschop <teusjannette@gmail.com>
Date: Fri, 9 Nov 2018 13:05:38 +0100
Subject: disable webkit editor

---
 src/editor/editor.c        | 1164 +---------------------------------
 src/editor/editor.h        |   60 +-
 src/editor/link_dialog.c   |  176 +-----
 src/editor/link_dialog.h   |   50 +-
 src/editor/slib-editor.c   | 1477 +-------------------------------------------
 src/editor/slib-editor.h   |   87 +--
 src/editor/template.h      |   73 +--
 src/editor/webkit_editor.c | 1433 +-----------------------------------------
 src/editor/webkit_editor.h |  208 +------
 9 files changed, 9 insertions(+), 4719 deletions(-)

diff --git a/src/editor/editor.c b/src/editor/editor.c
index ffcfff5..8b1a393 100644
--- a/src/editor/editor.c
+++ b/src/editor/editor.c
@@ -1,1163 +1 @@
-/*
- * Xiphos Bible Study Tool
- * editor.c - webkit stuff
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef USE_WEBKIT_EDITOR
-
-/* X keyboard #definitions, to handle shortcuts */
-/* we must define the categories of #definitions we need. */
-#define XK_MISCELLANY
-#define XK_LATIN1
-#include <X11/keysymdef.h>
-
-#include <gtk/gtk.h>
-#include <webkit/webkit.h>
-
-#include "editor/webkit_editor.h"
-#include "editor/editor.h"
-
-#include "main/sword.h"
-#include "main/settings.h"
-
-#include "gui/utilities.h"
-
-#define html_start "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\"><html><head>"
-
-BUTTONS_STATE buttons_state;
-
-glong mouse_x;
-glong mouse_y;
-
-//WebKitDOMElement * current_element;
-
-/******************************************************************************
- * Name
- *   editor_insert_new_outline_level
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gint editor_insert_new_outline_level (gint level, EDITOR * e)
- *
- * Description
- *  use to create an outline:
- * I. 
- *  	A.
- *  		1.
- *  			a.  
- *
- * Return value
- *   gint
- */
-
-gint editor_insert_new_outline_level(gint level, EDITOR *e)
-{
-	WebKitDOMDocument *doc;
-	WebKitDOMElement *element_anchor = NULL;
-	WebKitDOMElement *element = NULL;
-	WebKitDOMElement *parent_ol_element = NULL;
-	WebKitDOMDOMWindow *window;
-	WebKitDOMDOMSelection *selection = NULL;
-	GError *error = NULL;
-	gchar *name = NULL;
-	gchar *class = NULL;
-	gchar *level_str = NULL;
-
-	XI_message(("\n%s\n", "editor_insert_new_outline_level"));
-
-	doc = webkit_web_view_get_dom_document((WebKitWebView *)
-					       e->html_widget);
-
-	if (!doc)
-		return 0;
-
-	window = webkit_dom_document_get_default_view(doc);
-	selection = webkit_dom_dom_window_get_selection(window);
-	if (selection == NULL) {
-		XI_message(("\n%s\n", "failed to get selection"));
-		return 0;
-	}
-
-	element_anchor = (WebKitDOMElement *)
-	    webkit_dom_dom_selection_get_anchor_node(selection);
-	if (element_anchor == NULL) {
-		XI_message(("\n%s\n", "failed to get anchor"));
-		return 0;
-	}
-
-	name = webkit_dom_element_get_tag_name(element_anchor);
-	if (!g_strcmp0("LI", name) || !g_strcmp0("li", name)) {
-		XI_message(("current element: %s", name));
-		element =
-		    webkit_dom_node_get_parent_element((WebKitDOMNode *)
-						       element_anchor);
-	} else
-		return 1;
-
-	parent_ol_element =
-	    webkit_dom_node_get_parent_element((WebKitDOMNode *)element);
-	name = webkit_dom_element_get_tag_name(parent_ol_element);
-	class =
-	    webkit_dom_element_get_attribute(parent_ol_element, "class");
-	XI_message(("\nparent_ol_element: %s\nclass: %s\n", name, class));
-
-	if (class) {
-		if (!g_strcmp0("L1", class))
-			level_str = g_strdup("L2");
-		if (!g_strcmp0("L2", class))
-			level_str = g_strdup("L3");
-		if (!g_strcmp0("L3", class))
-			level_str = g_strdup("L4");
-		if (!g_strcmp0("L4", class))
-			level_str = g_strdup("L4");
-		if (!level_str) {
-			return 0;
-		}
-	}
-
-	webkit_dom_element_set_attribute(element, "class", level_str,
-					 &error);
-	if (error) {
-		fprintf(stderr, "Failed to create new attribute: %s\n",
-			error->message);
-		g_error_free(error);
-		error = NULL;
-		return 0;
-	}
-
-	return 1;
-}
-
-/******************************************************************************
- * Name
- *   editor_get_document_content
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void editor_get_document_content (GString * data, EDITOR * e)
- *
- * Description
- *   fills the GString with the contents of the html document.
- *
- * Return value
- *   void
- */
-
-void editor_get_document_content(GString *data, EDITOR *e)
-{
-	WebKitDOMHTMLElement *html;
-	WebKitDOMHTMLHeadElement *header;
-	WebKitDOMDocument *dom_document = NULL;
-	gchar *body = NULL;
-	gchar *head = NULL;
-
-	dom_document = webkit_web_view_get_dom_document((WebKitWebView *)
-							e->html_widget);
-	if (!dom_document)
-		return;
-
-	/* get document <head> info */
-	header = webkit_dom_document_get_head(dom_document);
-	head =
-	    webkit_dom_html_element_get_inner_html((WebKitDOMHTMLElement *)
-						   header);
-
-	/* get document <body> info */
-	html = webkit_dom_document_get_body(dom_document);
-	body = webkit_dom_html_element_get_inner_html(html);
-
-	g_string_printf(data, "%s%s</head><body>%s</body>\n</html>",
-			html_start, head, body);
-}
-
-/******************************************************************************
- * Name
- *   editor_get_selected_text
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gchar * editor_get_selected_text (EDITOR * e)
- *
- * Description
- *   returns the selected text and must be freed by calling function
- *
- * Return value
- *   gchar *
- */
-
-gchar *editor_get_selected_text(EDITOR *e)
-{
-	WebKitDOMDocument *dom_document;
-	WebKitDOMDOMWindow *window = NULL;
-	WebKitDOMDOMSelection *selection = NULL;
-	gchar *text = NULL;
-	GError *error = NULL;
-
-	dom_document = webkit_web_view_get_dom_document((WebKitWebView *)
-							e->html_widget);
-	if (!dom_document)
-		return NULL;
-	window = webkit_dom_document_get_default_view(dom_document);
-	selection = webkit_dom_dom_window_get_selection(window);
-	if (selection) {
-		WebKitDOMRange *range =
-		    webkit_dom_dom_selection_get_range_at(selection, 0,
-							  &error);
-		if (error) {
-			fprintf(stderr, "Failed to get range: %s\n",
-				error->message);
-			g_error_free(error);
-			error = NULL;
-			//return;
-		}
-		text = webkit_dom_range_to_string(range, &error);
-		if (error) {
-			fprintf(stderr, "Failed range text: %s\n",
-				error->message);
-			g_error_free(error);
-			error = NULL;
-			return NULL;
-		}
-	}
-	return g_strdup(text);
-}
-
-/******************************************************************************
- * Name
- *   editor_find_string
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void editor_find_string (gchar * needle, EDITOR * e)
- *
- * Description
- *   search document for needle
- *
- * Return value
- *   void
- */
-
-void editor_find_string(gchar *needle, EDITOR *e)
-{
-	webkit_web_view_search_text((WebKitWebView *)e->html_widget,
-				    needle, FALSE, TRUE, TRUE);
-}
-
-/******************************************************************************
- * Name
- *   editor_replace_string
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *  void editor_replace_string (gchar * old_string, gchar * new_string, EDITOR * e) 
- *
- * Description
- *   search document for old_string and replace with new_string
- *   **** needs work ****
- *
- * Return value
- *   void
- */
-
-void editor_replace_string(gchar *old_string, gchar *new_string,
-			   EDITOR *e)
-{
-	WebKitWebFrame *frame = NULL;
-
-	frame = webkit_web_view_get_main_frame((WebKitWebView *)
-					       e->html_widget);
-	webkit_web_view_search_text((WebKitWebView *)e->html_widget,
-				    old_string, FALSE, TRUE, FALSE);
-	webkit_web_frame_replace_selection(frame, new_string);
-}
-
-/******************************************************************************
- * Name
- *   editor_execute_script
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void editor_execute_script(gchar * script, EDITOR * e)
- *
- * Description
- *   executes scripts ie "document.execCommand('insertOrderedList', null, \"\");"
- *	 
- *
- * Return value
- *   void
- */
-
-void editor_execute_script(gchar *script, EDITOR *e)
-{
-	if (script) {
-		webkit_web_view_execute_script(WEBKIT_WEB_VIEW(e->html_widget), script);
-		XI_message(("script: %s", script));
-	}
-}
-
-/******************************************************************************
- * Name
- *   editor_insert_html
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void editor_insert_html(const gchar * html, EDITOR * e)
- *
- * Description
- *   
- *
- * Return value
- *   void
- */
-
-void editor_insert_html(const gchar *html, EDITOR *e)
-{
-	gchar *str = g_strdup_printf("document.execCommand('insertHTML', null, \'%s\');", html);
-	XI_message(("script: %s", str));
-	editor_execute_script(str, e);
-	g_free(str);
-}
-
-/*
-void editor_open_recent (const gchar * uri, EDITOR * e)
-{
-	webkit_web_view_load_uri (WEBKIT_WEB_VIEW(e->html_widget),uri); 
-
-}
-*/
-
-gboolean editor_cut(EDITOR *e)
-{
-	if (webkit_web_view_can_cut_clipboard(WEBKIT_WEB_VIEW(e->html_widget))) {
-		webkit_web_view_cut_clipboard(WEBKIT_WEB_VIEW(e->html_widget));
-		return 1;
-	} else
-		return 0;
-}
-
-gboolean editor_copy(EDITOR *e)
-{
-	if (webkit_web_view_can_copy_clipboard(WEBKIT_WEB_VIEW(e->html_widget))) {
-		webkit_web_view_copy_clipboard(WEBKIT_WEB_VIEW(e->html_widget));
-		return 1;
-	} else
-		return 0;
-}
-
-gboolean editor_paste(EDITOR *e)
-{
-	if (webkit_web_view_can_paste_clipboard(WEBKIT_WEB_VIEW(e->html_widget))) {
-		webkit_web_view_paste_clipboard(WEBKIT_WEB_VIEW(e->html_widget));
-		return 1;
-	} else
-		return 0;
-}
-
-/*
-GtkWidget * entry_module;
-GtkWidget * entry_verse;
-GtkWidget * entry_text;
-GtkWidget * linkage_verse_list;
-GtkWidget * hbox_sword_link;
-GtkWidget * hbox_rbuttons; 
-GtkWidget * uri_entry; 
-gboolean sword_link;
-
-void editor_insert_link_ok (void)
-{
-	const gchar *mod_str = NULL;
-	const gchar *verse_str = NULL;
-	const gchar *text_str = NULL;
-	const gchar *uri_str = NULL;
-	//const gchar *encoded_mod = NULL;
-	//const gchar *encoded_verse = NULL;
-	gchar *str = NULL;
-	//gint type = -1;
-	if(sword_link) {
-		//XI_message(("%s","sword_link"));
-		mod_str = gtk_entry_get_text (GTK_ENTRY (entry_module));
-		verse_str = gtk_entry_get_text (GTK_ENTRY (entry_verse));
-		text_str = gtk_entry_get_text (GTK_ENTRY (entry_text));
-		//type = main_get_mod_type((gchar*)mod_str);
-		str = g_strdup_printf(" <a href=\"sword://%s/%s\">%s</a>",
-				mod_str ,verse_str,text_str);
-	} else {
-				
-		uri_str = gtk_entry_get_text (GTK_ENTRY (uri_entry));		
-		str = g_strdup_printf(" <a href=\"%s\">%s</a>",
-				uri_str, uri_str);
-	}
-	 
-	 editor_insert_html(str, e);
-	if(str)
-		g_free(str);
-}
-
-gboolean editor_insert_sword_link(void)
-{
-    GtkBuilder * builder;
-	GtkWidget * window;        
-	GtkWidget * hbox_sword_link;
-	GtkWidget * hbox_rbuttons; 	
-	GError *error = NULL; 
-	sword_link = TRUE;
-    builder = gtk_builder_new ();
-    gtk_builder_add_from_file (builder, LINK_DIALOG_UI_FILE, &error);
-	if (error) {
-	      	fprintf(stderr, "Failed to load ui file: %s\n", error->message);
-	      	g_error_free(error);
-	      	error = NULL;
-	}	
-    
-    window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog1"));
-    gtk_builder_connect_signals (builder,window);      
-	
-	hbox_sword_link  = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_sword_link"));
-	hbox_rbuttons  = GTK_WIDGET (gtk_builder_get_object (builder, "hbox6"));
-	gtk_widget_show (hbox_sword_link);  
-	gtk_widget_show (hbox_rbuttons);
-
-	entry_module       = GTK_WIDGET (gtk_builder_get_object (builder, "entry2"));
-	entry_verse        = GTK_WIDGET (gtk_builder_get_object (builder, "entry1"));
-	entry_text         = GTK_WIDGET (gtk_builder_get_object (builder, "entry3"));
-	linkage_verse_list = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton2"));
-
-    g_object_unref (G_OBJECT (builder));
-    gtk_widget_show (window);
-	return 0;
-}
-   
-gboolean editor_insert_link(void)
-{
-     	GtkBuilder * builder;
-	//GtkWidget * entry_module;
-	//GtkWidget * entry_verse;
-	//GtkWidget * entry_text;
-	GtkWidget * window;
-	 GtkWidget * hbox_url_link;
-	sword_link = FALSE;
-	
-        builder = gtk_builder_new ();
-        gtk_builder_add_from_file (builder, LINK_DIALOG_UI_FILE, NULL);
-        
-        window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog1"));
-        gtk_builder_connect_signals (builder,window); 
-	 hbox_url_link = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_url_link"));
-	gtk_widget_show (hbox_url_link);  
-
-	uri_entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry4"));
-	//entry_verse        = GTK_WIDGET (gtk_builder_get_object (builder, "entry1"));
-	//entry_text         = GTK_WIDGET (gtk_builder_get_object (builder, "entry3"));
-	//linkage_verse_list = GTK_WIDGET (gtk_builder_get_object (builder, "radiobutton2"));
-
-        g_object_unref (G_OBJECT (builder));
-        gtk_widget_show (window);
-	return 0;
-}
-
-*/
-
-/******************************************************************************
- * Name
- *   user_changed_contents_cb
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void user_changed_contents_cb (WebKitWebView * web_view, EDITOR * e)
- *
- * Description
- *   callback - when user makes a change to a document
- *
- * Return value
- *   void
- */
-static void user_changed_contents_cb(WebKitWebView *web_view, EDITOR *e)
-{
-	XI_message(("%s", "user_changed_contents_cb"));
-	e->is_changed = TRUE;
-}
-
-/******************************************************************************
- * Name
- *   on_navigation_requested
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   WebKitNavigationResponse on_navigation_requested (WebKitWebView * web_view,
- *                                                     WebKitWebFrame * frame,
- *                                                     WebKitNetworkRequest * request,
- *                                             		   EDITOR * e)
- *
- * Description
- *   allows only a uri that contains 'file:'
- *
- * Return value
- *   WebKitNavigationResponse
- */
-static WebKitNavigationResponse on_navigation_requested(WebKitWebView *web_view,
-							WebKitWebFrame *frame,
-							WebKitNetworkRequest *
-							    request,
-							EDITOR *e)
-{
-	const gchar *uri = NULL;
-
-	if (e->is_changed) {
-		ask_about_saving(e);
-	}
-
-	uri = webkit_network_request_get_uri(request);
-	XI_message(("on_navigation_requested uri: %s", uri));
-	if (g_strstr_len(uri, 6, "file:"))
-		return FALSE;
-	else
-		return TRUE;
-}
-
-/******************************************************************************
- * Name
- *   link_handler
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void link_handler (GtkWidget *widget, 
- *			      gchar     *title,
- *			      gchar     *uri,
- *			      EDITOR * e)
- *
- * Description
- *   hovering over a link - does nothing at present
- *
- * Return value
- *   void
- */
-
-static void link_handler(GtkWidget *widget,
-			 gchar *title, gchar *uri, EDITOR *e)
-{
-	XI_message(("link_handler"));
-}
-
-/******************************************************************************
- * Name
- *   _has_element
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gint _has_element(gchar * name, gchar * class, EDITOR * e)
- *
- * Description
- *   checks for html element - for button status ie bold on or off
- *
- * Return value
- *   gint
- */
-
-static gint _has_element(gchar *name, gchar *class, EDITOR *e)
-{
-	if (!name)
-		return 0;
-	if (!g_strcmp0("BODY", name)) {
-		return 0;
-	}
-	if (!g_strcmp0("B", name)) {
-		buttons_state.bold = 1;
-		return 1;
-	} else if (!g_strcmp0("I", name)) {
-		buttons_state.italic = 1;
-		return 1;
-	} else if (!g_strcmp0("U", name)) {
-		buttons_state.underline = 1;
-		return 1;
-	} else if (!g_strcmp0("STRIKE", name)) {
-		buttons_state.strike = 1;
-		return 1;
-	} else if (!g_strcmp0("DIV", name)) {
-		buttons_state.style = 0;
-		return 1;
-	} else if (!g_strcmp0("H1", name)) {
-		buttons_state.style = 1;
-		return 1;
-	} else if (!g_strcmp0("H2", name)) {
-		buttons_state.style = 2;
-		return 1;
-	} else if (!g_strcmp0("H3", name)) {
-		buttons_state.style = 3;
-		return 1;
-	} else if (!g_strcmp0("H4", name)) {
-		buttons_state.style = 4;
-		return 1;
-	} else if (!g_strcmp0("H5", name)) {
-		buttons_state.style = 5;
-		return 1;
-	} else if (!g_strcmp0("H6", name)) {
-		buttons_state.style = 6;
-		return 1;
-	} else if (!g_strcmp0("ADDRESS", name)) {
-		buttons_state.style = 7;
-		return 1;
-	} else if (!g_strcmp0("PRE", name)) {
-		buttons_state.style = 8;
-		return 1;
-	} else if (!g_strcmp0("UL", name)) {
-		buttons_state.style = 9;
-		return 1;
-	} else if (!g_strcmp0("FONT", name)) {
-		//buttons_state.style = 9;
-		return 1;
-	}
-	if (!g_strcmp0("LI", name)) {
-		return 1;
-	} else if (!g_strcmp0("OL", name)) {
-		buttons_state.style = 10;
-		if (class) {
-			XI_message(("\nclass: %s\n", class));
-			if (!g_strcmp0("L1", class)) {
-				e->toolitems.outline_level = 1;
-				buttons_state.style = 10;
-			}
-			if (!g_strcmp0("L2", class)) {
-				e->toolitems.outline_level = 2;
-				buttons_state.style = 12;
-			}
-			if (!g_strcmp0("L3", class)) {
-				e->toolitems.outline_level = 3;
-				buttons_state.style = 11;
-			}
-			if (!g_strcmp0("L4", class)) {
-				e->toolitems.outline_level = 4;
-				buttons_state.style = 12;
-			}
-		}
-		return 0;
-	} else
-		return 0;
-	return 1;
-}
-
-/******************************************************************************
- * Name
- *   key_handler
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gboolean key_handler (GtkWidget *widget,
- *                         GdkEvent  *event,
- *                         EDITOR * e)
- *
- * Description
- *   key release handler - does nothing at present
- *
- * Return value
- *   gboolean
- */
-
-static gboolean key_handler(GtkWidget *widget, GdkEventKey *event, EDITOR *e)
-{
-	/* these are the mods we actually use for global keys, we always only check for these set */
-	guint state =
-	    event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK |
-			    GDK_MOD1_MASK | GDK_MOD4_MASK);
-
-	switch (event->keyval) {
-	case XK_s: // Ctrl-L  verse entry
-		if (state == GDK_CONTROL_MASK)
-			action_save_activate_cb(e->html_widget, e);
-		break;
-	}
-
-	return 0;
-}
-
-/******************************************************************************
- * Name
- *   menu_spell_item_activated
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void  menu_spell_item_activated (GtkWidget *menuitem, EDITOR * e)
- *
- * Description
- *   user clicked on spelling word guess - get word form menu item label
- *   and replace misspelled word
- *
- * Return value
- *   void
- */
-
-static void menu_spell_item_activated(GtkWidget *menuitem, EDITOR *e)
-{
-	WebKitWebFrame *frame;
-	const gchar *label;
-
-	label = gtk_menu_item_get_label(GTK_MENU_ITEM(menuitem));
-	frame = webkit_web_view_get_main_frame((WebKitWebView *)
-					       e->html_widget);
-
-	webkit_web_frame_replace_selection(frame, label);
-}
-
-/******************************************************************************
- * Name
- *   menu_spell_add_item_activated
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void  menu_spell_add_item_activated (GtkWidget *menuitem, gpointer user_data)
- *
- * Description
- *   add word to dictionary
- *
- * Return value
- *   void
- */
-
-static void menu_spell_add_item_activated(GtkWidget *menuitem,
-					  gpointer user_data)
-{
-	WebKitSpellChecker *checker = NULL;
-	checker = (WebKitSpellChecker *)webkit_get_text_checker();
-
-	webkit_spell_checker_learn_word(checker, (gchar *)user_data);
-	if ((gchar *)user_data)
-		g_free((gchar *)user_data);
-}
-
-/******************************************************************************
- * Name
- *  menu_spell_ignore_item_activated 
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void  menu_spell_ignore_item_activated (GtkWidget *menuitem, gpointer user_data)
- *
- * Description
- *   ignore word for this document
- *
- * Return value
- *   void
- */
-
-static void menu_spell_ignore_item_activated(GtkWidget *menuitem,
-					     gpointer user_data)
-{
-	WebKitSpellChecker *checker = NULL;
-	checker = (WebKitSpellChecker *)webkit_get_text_checker();
-
-	webkit_spell_checker_ignore_word(checker, (gchar *)user_data);
-	if ((gchar *)user_data)
-		g_free((gchar *)user_data);
-}
-
-/******************************************************************************
- * Name
- *   _fill_spell_menu
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gint _fill_spell_menu(GtkWidget * menu, gchar * word, EDITOR * e)
- *
- * Description
- *   add spelling guesses to context menu - word must be selected in
- *   for this to work - it's webkit thing
- *
- * Return value
- *   gint
- */
-
-static gint _fill_spell_menu(GtkWidget *menu, gchar *word, EDITOR *e)
-{
-	WebKitSpellChecker *checker = NULL;
-	int misspelling_location;
-	int misspelling_length;
-	GtkWidget *item;
-	char **word_list = NULL;
-
-	XI_message(("\nword: %s\n", word));
-	checker = (WebKitSpellChecker *)webkit_get_text_checker();
-
-	webkit_spell_checker_check_spelling_of_string(checker,
-						      word,
-						      &misspelling_location,
-						      &misspelling_length);
-	if (!misspelling_length)
-		return 0;
-
-	word_list = webkit_spell_checker_get_guesses_for_word(checker,
-							      word, NULL);
-	/* add guesses to menu */
-	if (word_list) {
-		int i = 0;
-		while (word_list[i]) {
-			item = gtk_menu_item_new_with_label(word_list[i]);
-			gtk_widget_show(item);
-			g_signal_connect(G_OBJECT(item), "activate",
-					 G_CALLBACK(menu_spell_item_activated), e);
-			gtk_menu_shell_append((GtkMenuShell *)menu,
-					      (GtkWidget *)item);
-			i++;
-		}
-	}
-
-	/* separator */
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* add word */
-	item = gtk_menu_item_new_with_label("Add word");
-	gtk_widget_show(item);
-	g_signal_connect(G_OBJECT(item), "activate",
-			 G_CALLBACK(menu_spell_add_item_activated),
-			 g_strdup((gchar *)word));
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* ignore word */
-	item = gtk_menu_item_new_with_label("Ignore word");
-	gtk_widget_show(item);
-	g_signal_connect(G_OBJECT(item), "activate",
-			 G_CALLBACK(menu_spell_ignore_item_activated),
-			 g_strdup((gchar *)word));
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* separator */
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	if (word_list)
-		g_strfreev(word_list);
-
-	return misspelling_length;
-}
-
-/******************************************************************************
- * Name
- *   _create_context_menu
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void _create_context_menu (WebKitDOMDocument * dom_document, guint32 time, EDITOR * e)
- *
- * Description
- *   called when right button is clicked - 
- *
- * Return value
- *   void
- */
-
-static void _create_context_menu(WebKitDOMDocument *dom_document, guint32 time,
-				 EDITOR *e)
-{
-	WebKitDOMDOMWindow *window = NULL;
-	WebKitDOMDOMSelection *selection = NULL;
-	GError *error = NULL;
-	GtkWidget *menu = NULL;
-	GtkWidget *item = NULL;
-	gboolean have_selection = FALSE;
-
-	menu = gtk_menu_new();
-	window = webkit_dom_document_get_default_view(dom_document);
-	selection = webkit_dom_dom_window_get_selection(window);
-	if (selection) {
-		WebKitDOMRange *range =
-		    webkit_dom_dom_selection_get_range_at(selection, 0,
-							  &error);
-		if (error) {
-			fprintf(stderr, "Failed to get range: %s\n",
-				error->message);
-			g_error_free(error);
-			error = NULL;
-		}
-		gchar *text = webkit_dom_range_to_string(range, &error);
-		if (error) {
-			fprintf(stderr, "Failed range text: %s\n",
-				error->message);
-			g_error_free(error);
-			error = NULL;
-			return;
-		}
-		if (text && (g_strcmp0(text, "") != 0)) {
-			_fill_spell_menu(menu, text, e);
-			have_selection = TRUE;
-		} else
-			have_selection = FALSE;
-	}
-
-	/* cut */
-	item =
-#if GTK_CHECK_VERSION(3, 10, 0)
-	    gtk_menu_item_new_with_label("_(Cut)");
-#else
-	    gtk_image_menu_item_new_from_stock(GTK_STOCK_CUT, NULL);
-#endif
-	gtk_widget_show(item);
-	g_signal_connect(G_OBJECT(item), "activate",
-			 G_CALLBACK(action_cut_activate_cb), e);
-	gtk_widget_set_sensitive(item, have_selection);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* copy */
-	item =
-#if GTK_CHECK_VERSION(3, 10, 0)
-	    gtk_menu_item_new_with_label("_(Copy)");
-#else
-	    gtk_image_menu_item_new_from_stock(GTK_STOCK_COPY, NULL);
-#endif
-	gtk_widget_show(item);
-	gtk_widget_set_sensitive(item, have_selection);
-	g_signal_connect(G_OBJECT(item), "activate",
-			 G_CALLBACK(action_copy_activate_cb), e);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* paste */
-	item =
-#if GTK_CHECK_VERSION(3, 10, 0)
-	    gtk_menu_item_new_with_label("_(Paste)");
-#else
-	    gtk_image_menu_item_new_from_stock(GTK_STOCK_PASTE, NULL);
-#endif
-	gtk_widget_show(item);
-	g_signal_connect(G_OBJECT(item), "activate",
-			 G_CALLBACK(action_paste_activate_cb), e);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* separator */
-	item = gtk_separator_menu_item_new();
-	gtk_widget_show(item);
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-	/* select all */
-	item =
-#if GTK_CHECK_VERSION(3, 10, 0)
-	    gtk_menu_item_new_with_label("_(Select All)");
-#else
-	    gtk_image_menu_item_new_from_stock(GTK_STOCK_SELECT_ALL, NULL);
-
-#endif
-	gtk_widget_show(item);
-	/*g_signal_connect (G_OBJECT (item), "activate",
-	   G_CALLBACK (action_paste_activate_cb),
-	   NULL); */
-	gtk_menu_shell_append((GtkMenuShell *)menu, (GtkWidget *)item);
-
-#if GTK_CHECK_VERSION(3, 22, 0)
-	gtk_menu_popup_at_pointer((GtkMenu *)menu, NULL);
-#else
-	gtk_menu_popup((GtkMenu *)menu, NULL, NULL, NULL, NULL, 3, time);
-#endif
-}
-
-/******************************************************************************
- * Name
- *   button_handler
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   gboolean button_handler (GtkWidget *widget,
- *                              GdkEvent  *event,
- *                              EDITOR * e)
- *
- * Description
- *   user pressed a button - set button status 
- *   if right button call _create_context_menu()
- *
- * Return value
- *   gboolean
- */
-
-static gboolean button_handler(GtkWidget *widget, GdkEvent *event, EDITOR *e)
-{
-	WebKitDOMDocument *dom_document;
-	WebKitDOMElement *element = NULL;
-	buttons_state.bold = 0;
-	buttons_state.italic = 0;
-	buttons_state.underline = 0;
-	buttons_state.strike = 0;
-	buttons_state.style = 0;
-	buttons_state.nochange = 1;
-	gchar *name = NULL;
-	gchar *class = NULL;
-	gchar *color = NULL;
-	gint i = 1;
-
-	//current_element = NULL;
-	e->toolitems.outline_level = 0;
-	mouse_x = event->button.x;
-	mouse_y = event->button.y;
-
-	dom_document = webkit_web_view_get_dom_document((WebKitWebView *)
-							e->html_widget);
-	if (!dom_document)
-		return 0;
-
-	if (event->button.button == 3) {
-		_create_context_menu(dom_document, event->button.time, e);
-		return 1; // return true so we don't get the webkit context menu
-	}
-
-	element =
-	    webkit_dom_document_element_from_point(dom_document, mouse_x,
-						   mouse_y);
-	if (!element)
-		return 0;
-
-	name = webkit_dom_element_get_tag_name(element);
-	if (!name)
-		return 0;
-
-	/* set buttons.color to font color element */
-	if (buttons_state.color)
-		g_free(buttons_state.color);
-	buttons_state.color = g_strdup("#000000"); /* start with black */
-
-	/* we have to set it here in case the color element is the only element */
-	color = webkit_dom_element_get_attribute(element, "color");
-	if (color[0] == '#') {
-		if (buttons_state.color)
-			g_free(buttons_state.color);
-		buttons_state.color = g_strdup(color);
-	}
-
-	/*      
-	   if(!g_strcmp0 ("LI",name)){
-	   current_element = element;
-	   }
-	 */
-	i = _has_element(name, class, e);
-	while (i) {
-		if (name) {
-			XI_message(("\nelement name:  %s\nclass:     %s\ncolor: %s\n", name, class, color));
-			element =
-			    webkit_dom_node_get_parent_element((WebKitDOMNode *)element);
-			if (element) {
-				class =
-				    webkit_dom_element_get_attribute(element, "class");
-				color =
-				    webkit_dom_element_get_attribute(element, "color");
-				name =
-				    webkit_dom_element_get_tag_name(element);
-
-				if (color[0] == '#') {
-					if (buttons_state.color)
-						g_free(buttons_state.color);
-					buttons_state.color =
-					    g_strdup(color);
-				}
-			}
-		}
-		i = _has_element(name, class, e);
-	}
-	set_button_state(buttons_state, e);
-	buttons_state.nochange = 0;
-	return 0;
-}
-
-/******************************************************************************
- * Name
- *   create_editor_window
- *
- * Synopsis
- *   #include "editor/editor.h"
- *
- *   void create_editor_window (GtkWidget * scrollwindow, EDITOR * e)
- *
- * Description
- *   create and setup webkit wigdet for editing
- *
- * Return value
- *   void
- */
-
-void create_editor_window(GtkWidget *scrollwindow, EDITOR *e)
-{
-	WebKitWebSettings *setting;
-	GtkWidget *webview;
-	gchar *text = NULL, *fname = NULL;
-
-	webview = webkit_web_view_new();
-	e->html_widget = webview;
-	gtk_widget_show(webview);
-
-	/* Turn on editing */
-	webkit_web_view_set_editable((WebKitWebView *)webview, TRUE);
-
-	/* Create a new websettings and enable spell checking */
-	setting = webkit_web_settings_new();
-	g_object_set(G_OBJECT(setting), "enable-spell_checking", TRUE,
-		     NULL);
-
-	/* Apply the result */
-	webkit_web_view_set_settings(WEBKIT_WEB_VIEW(webview), setting);
-
-	/* new empty document from template */
-	fname = g_build_filename(settings.gSwordDir, "studypad.spt", NULL);
-	XI_message(("action delete item [%s]", fname));
-	text = inhale_text_from_file(fname);
-	g_free(fname);
-
-	if (text && strlen(text)) {
-		webkit_web_view_load_string((WebKitWebView *)
-					    e->html_widget,
-					    text,
-					    "text/html", "utf_8",
-					    "file://");
-	}
-	if (text)
-		g_free(text);
-
-	e->is_changed = FALSE;
-
-	gtk_container_add(GTK_CONTAINER(scrollwindow), webview);
-
-	g_signal_connect(G_OBJECT(webview), "navigation-requested",
-			 G_CALLBACK(on_navigation_requested), e);
-	g_signal_connect(G_OBJECT(webview), "hovering-over-link",
-			 G_CALLBACK(link_handler), e);
-	g_signal_connect(G_OBJECT(webview), "user-changed-contents",
-			 G_CALLBACK(user_changed_contents_cb), e);
-	g_signal_connect(G_OBJECT(webview), "button-press-event",
-			 G_CALLBACK(button_handler), e);
-	g_signal_connect(G_OBJECT(webview), "key-press-event",
-			 G_CALLBACK(key_handler), e);
-}
-
-#endif /* USE_WEBKIT_EDITOR */
+// empty
diff --git a/src/editor/editor.h b/src/editor/editor.h
index aee91e4..8b1a393 100644
--- a/src/editor/editor.h
+++ b/src/editor/editor.h
@@ -1,59 +1 @@
-/*
- * Xiphos Bible Study Tool
- * editor.h - webkit stuff
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _EDITOR_H
-#define _EDITOR_H
-
-#include <config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <gtk/gtk.h>
-
-#ifdef USE_WEBKIT_EDITOR
-
-#include "editor/webkit_editor.h"
-
-gchar *editor_get_selected_text(EDITOR *e);
-void editor_find_string(gchar *needle, EDITOR *e);
-void editor_replace_string(gchar *old_string, gchar *new_string,
-			   EDITOR *e);
-gint editor_insert_new_outline_level(gint level, EDITOR *e);
-gboolean editor_cut(EDITOR *e);
-gboolean editor_copy(EDITOR *e);
-gboolean editor_paste(EDITOR *e);
-void editor_get_document_content(GString *data, EDITOR *e);
-//void editor_open_recent (const gchar * uri, EDITOR * e);
-gboolean editor_insert_link(void);
-gboolean editor_insert_sword_link(void);
-void editor_insert_link_ok(void);
-void editor_execute_script(gchar *script, EDITOR *e);
-void editor_insert_html(const gchar *html, EDITOR *e);
-void create_editor_window(GtkWidget *scrollwindow, EDITOR *e);
-
-#endif /* USE_WEBKIT_EDITOR */
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _EDITOR_H */
+// empty
diff --git a/src/editor/link_dialog.c b/src/editor/link_dialog.c
index c5042e5..8b1a393 100644
--- a/src/editor/link_dialog.c
+++ b/src/editor/link_dialog.c
@@ -1,175 +1 @@
-/*
- * Xiphos Bible Study Tool
- * link_dialog.c - dialog for inserting a link
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <config.h>
-
-#include <gtk/gtk.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#ifdef USE_WEBKIT_EDITOR
-#include "editor/webkit_editor.h"
-#include "editor/editor.h"
-#else
-#include <editor/gtkhtml-editor.h>
-#include <gtkhtml/gtkhtml-stream.h>
-#include "editor/slib-editor.h"
-#endif
-
-#include "editor/link_dialog.h"
-
-#include "main/url.hh"
-#include "main/sword.h"
-
-#include "gui/utilities.h"
-#include "gui/debug_glib_null.h"
-/************* begin link dialog ****************/
-static GtkWidget *window;
-static GtkWidget *entry_module;
-static GtkWidget *entry_verse;
-static GtkWidget *entry_text;
-static GtkWidget *linkage_verse_list;
-
-G_MODULE_EXPORT void entry_verse_changed_cb(GObject *object, EDITOR *e)
-{
-	const gchar *verse_str = NULL;
-
-	verse_str = gtk_entry_get_text(GTK_ENTRY(object));
-	gtk_entry_set_text(GTK_ENTRY(entry_text), verse_str);
-}
-
-G_MODULE_EXPORT void button_ok_clicked_cb(GObject *object, EDITOR *e)
-{
-	const gchar *mod_str = NULL;
-	const gchar *verse_str = NULL;
-	const gchar *text_str = NULL;
-	const gchar *encoded_mod = NULL;
-	const gchar *encoded_verse = NULL;
-	GString *str = g_string_new(NULL);
-	gint type = 0;
-
-	mod_str = gtk_entry_get_text(GTK_ENTRY(entry_module));
-	verse_str = gtk_entry_get_text(GTK_ENTRY(entry_verse));
-	text_str = gtk_entry_get_text(GTK_ENTRY(entry_text));
-
-	type = main_get_mod_type((gchar *)mod_str);
-
-	if (mod_str)
-		encoded_mod = main_url_encode(mod_str);
-	if (verse_str)
-		encoded_verse = main_url_encode(verse_str);
-
-	g_string_printf(str,
-			(((gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(linkage_verse_list))) && ((type == -1) || (type == TEXT_TYPE) || (type == COMMENTARY_TYPE)))
-			     ? "<a href=\"passagestudy.jsp?action=showRef&type=scripRef&module=%s&value=%s\">%s</a>"
-			     : "<a href=\"sword://%s/%s\">%s</a>"),
-			(encoded_mod ? encoded_mod : ""),
-			(encoded_verse ? encoded_verse : ""),
-			(text_str ? text_str : ""));
-
-	XI_message(("link: %s", str->str));
-
-#ifdef USE_WEBKIT_EDITOR
-	editor_insert_html(str->str, e);
-#else
-	gtkhtml_editor_insert_html(GTKHTML_EDITOR(e->window), str->str);
-#endif
-	g_string_free(str, TRUE);
-	g_free((gchar *)encoded_mod);
-	g_free((gchar *)encoded_verse);
-
-	gtk_widget_destroy(GTK_WIDGET(window));
-}
-
-G_MODULE_EXPORT
-void button_test_clicked_cb(GObject *object, gpointer user_data)
-{
-	const gchar *mod_str = NULL;
-	const gchar *verse_str = NULL;
-	const gchar *encoded_mod = NULL;
-	const gchar *encoded_verse = NULL;
-	GString *str = g_string_new(NULL);
-
-	mod_str = gtk_entry_get_text(GTK_ENTRY(entry_module));
-	verse_str = gtk_entry_get_text(GTK_ENTRY(entry_verse));
-
-	if (mod_str)
-		encoded_mod = main_url_encode(mod_str);
-	if (verse_str)
-		encoded_verse = main_url_encode(verse_str);
-
-	g_string_printf(str,
-			"passagestudy.jsp?action=showRef&type=scripRef&module=%s&value=%s",
-			(encoded_mod ? encoded_mod : ""),
-			(encoded_verse ? encoded_verse : ""));
-	XI_message(("link: %s", str->str));
-	main_url_handler(str->str, TRUE);
-	g_string_free(str, TRUE);
-	g_free((gchar *)encoded_mod);
-	g_free((gchar *)encoded_verse);
-}
-
-G_MODULE_EXPORT
-void button_cancel_clicked_cb(GObject *object, gpointer user_data)
-{
-	gtk_widget_destroy(GTK_WIDGET(window));
-}
-
-void editor_link_dialog(EDITOR *e)
-{
-	GtkBuilder *builder;
-	gchar *gbuilder_file;
-
-#ifndef USE_WEBKIT_EDITOR
-	GtkHTML *html = gtkhtml_editor_get_html(GTKHTML_EDITOR(e->window));
-	if (html->pointer_url) /* are we in a link */
-		return;	/* if so don't do anything */
-#endif
-
-	gbuilder_file =
-	    gui_general_user_file("editor_link_dialog" UI_SUFFIX, FALSE);
-
-#if GTK_CHECK_VERSION(3, 10, 0)
-	builder = gtk_builder_new_from_file(gbuilder_file);
-#else
-	builder = gtk_builder_new();
-	gtk_builder_add_from_file(builder, gbuilder_file, NULL);
-#endif
-
-	window = GTK_WIDGET(gtk_builder_get_object(builder, "dialog1"));
-	set_window_icon(GTK_WINDOW(window));
-	gtk_builder_connect_signals(builder, (EDITOR *)e);
-
-	entry_module =
-	    GTK_WIDGET(gtk_builder_get_object(builder, "entry_module"));
-	entry_verse =
-	    GTK_WIDGET(gtk_builder_get_object(builder, "entry_verse"));
-	entry_text =
-	    GTK_WIDGET(gtk_builder_get_object(builder, "entry_text"));
-	linkage_verse_list =
-	    GTK_WIDGET(gtk_builder_get_object(builder, "radio_verse_list"));
-
-	g_object_unref(G_OBJECT(builder));
-	gtk_widget_show(window);
-}
-
-/************* end link dialog ****************/
+// empty
diff --git a/src/editor/link_dialog.h b/src/editor/link_dialog.h
index 9a536f5..8b1a393 100644
--- a/src/editor/link_dialog.h
+++ b/src/editor/link_dialog.h
@@ -1,49 +1 @@
-/*
- * Xiphos Bible Study Tool
- * link_dialog.f - dialog for inserting a link
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _LINK_DIALOG_H
-#define _LINK_DIALOG_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <config.h>
-#include <glib.h>
-
-#ifdef USE_WEBKIT_EDITOR
-#include "editor/webkit_editor.h"
-#include "editor/editor.h"
-#else
-#include "editor/slib-editor.h"
-#endif
-
-void editor_link_dialog(EDITOR *e);
-void entry_verse_changed_cb(GObject *object, EDITOR *e);
-void button_ok_clicked_cb(GObject *object, EDITOR *e);
-void button_test_clicked_cb(GObject *object, gpointer user_data);
-void button_cancel_clicked_cb(GObject *object,
-			      gpointer user_data);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* _LINK_DIALOG_H */
+// empty
diff --git a/src/editor/slib-editor.c b/src/editor/slib-editor.c
index c940778..8b1a393 100644
--- a/src/editor/slib-editor.c
+++ b/src/editor/slib-editor.c
@@ -1,1476 +1 @@
-/*
- * Xiphos Bible Study Tool
- * html-editor.c - the html editor
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <config.h>
-
-#ifndef USE_WEBKIT_EDITOR
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <glib.h>
-
-#include <libintl.h>
-#include <locale.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-#include <editor/gtkhtml-editor.h>
-#include <gtkhtml/gtkhtml-stream.h>
-
-#include "editor/slib-editor.h"
-#include "editor/link_dialog.h"
-
-#include "main/settings.h"
-#include "main/sword_treekey.h"
-#include "main/sword.h"
-#include "main/url.hh"
-#include "main/xml.h"
-
-#include "gui/navbar_versekey_editor.h"
-#include "gui/dialog.h"
-#include "gui/widgets.h"
-#include "gui/xiphos.h"
-#include "gui/treekey-editor.h"
-#include "gui/utilities.h"
-
-#include "gui/debug_glib_null.h"
-
-extern gboolean do_display;
-
-static gboolean editor_is_dirty(EDITOR *e);
-
-static int app_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data);
-
-static void _load_file(EDITOR *e, const gchar *filename);
-
-static void _save_file(EDITOR *e);
-
-static void _save_note(EDITOR *e);
-
-static void _save_book(EDITOR *e);
-
-static gint ask_about_saving(EDITOR *e);
-
-static GList *editors_all = NULL;
-
-static void handle_error(GError **error)
-{
-	if (*error != NULL) {
-		g_warning("%s", (*error)->message);
-		g_clear_error(error);
-	}
-}
-
-static void do_exit(EDITOR *e)
-{
-	if (e->filename) {
-		g_free(e->filename);
-	}
-	if (e->module) {
-		g_free(e->module);
-	}
-	if (e->key) {
-		g_free(e->key);
-	}
-	if (e->window)
-		gtk_widget_destroy(e->window);
-	g_free(e);
-}
-
-static void change_window_title(GtkWidget *window, const gchar *window_title)
-{
-	gtk_window_set_title(GTK_WINDOW(window), window_title);
-}
-
-#if 0
-static gint
-_calc_header_height(GtkHTML * html, GtkPrintOperation * operation,
-		    GtkPrintContext * context)
-{
-	PangoContext *pango_context;
-	PangoFontDescription *desc;
-	PangoFontMetrics *metrics;
-	gint header_height;
-
-	pango_context = gtk_print_context_create_pango_context(context);
-	desc = pango_font_description_from_string("Sans Regular 10");
-
-	metrics =
-	    pango_context_get_metrics(pango_context, desc,
-				      pango_language_get_default());
-	header_height =
-	    pango_font_metrics_get_ascent(metrics) +
-	    pango_font_metrics_get_descent(metrics);
-	pango_font_metrics_unref(metrics);
-
-	pango_font_description_free(desc);
-	g_object_unref(pango_context);
-
-	return header_height;
-}
-
-static gint
-_calc_footer_height(GtkHTML * html, GtkPrintOperation * operation,
-		    GtkPrintContext * context)
-{
-	PangoContext *pango_context;
-	PangoFontDescription *desc;
-	PangoFontMetrics *metrics;
-	gint footer_height;
-
-	pango_context = gtk_print_context_create_pango_context(context);
-	desc = pango_font_description_from_string("Sans Regular 10");
-
-	metrics =
-	    pango_context_get_metrics(pango_context, desc,
-				      pango_language_get_default());
-	footer_height =
-	    pango_font_metrics_get_ascent(metrics) +
-	    pango_font_metrics_get_descent(metrics);
-	pango_font_metrics_unref(metrics);
-
-	pango_font_description_free(desc);
-	g_object_unref(pango_context);
-
-	return footer_height;
-}
-
-static void
-_draw_header(GtkHTML * html, GtkPrintOperation * operation,
-	     GtkPrintContext * context,
-	     gint page_nr, PangoRectangle * rec, EDITOR * e)
-{
-	PangoFontDescription *desc;
-	PangoLayout *layout;
-	gdouble x, y;
-	gchar *text;
-	cairo_t *cr;
-
-	text = g_strdup(e->filename);
-
-	desc = pango_font_description_from_string("Sans Regular 10");
-	layout = gtk_print_context_create_pango_layout(context);
-	pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
-	pango_layout_set_font_description(layout, desc);
-	pango_layout_set_text(layout, text, -1);
-	pango_layout_set_width(layout, rec->width);
-
-	x = pango_units_to_double(rec->x);
-	y = pango_units_to_double(rec->y);
-
-	cr = gtk_print_context_get_cairo_context(context);
-
-	cairo_save(cr);
-	cairo_set_source_rgb(cr, .0, .0, .0);
-	cairo_move_to(cr, x, y);
-	pango_cairo_show_layout(cr, layout);
-	cairo_restore(cr);
-
-	g_object_unref(layout);
-	pango_font_description_free(desc);
-
-	g_free(text);
-}
-
-
-static void
-_draw_footer(GtkHTML * html, GtkPrintOperation * operation,
-	     GtkPrintContext * context,
-	     gint page_nr, PangoRectangle * rec, EDITOR * e)
-{
-	PangoFontDescription *desc;
-	PangoLayout *layout;
-	gdouble x, y;
-	gint n_pages;
-	gchar *text;
-	cairo_t *cr;
-
-	g_object_get(operation, "n-pages", &n_pages, NULL);
-	text = g_strdup_printf(_("Page %d of %d"), page_nr + 1, n_pages);
-
-	desc = pango_font_description_from_string("Sans Regular 10");
-	layout = gtk_print_context_create_pango_layout(context);
-	pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
-	pango_layout_set_font_description(layout, desc);
-	pango_layout_set_text(layout, text, -1);
-	pango_layout_set_width(layout, rec->width);
-
-	x = pango_units_to_double(rec->x);
-	y = pango_units_to_double(rec->y);
-
-	cr = gtk_print_context_get_cairo_context(context);
-
-	cairo_save(cr);
-	cairo_set_source_rgb(cr, .0, .0, .0);
-	cairo_move_to(cr, x, y);
-	pango_cairo_show_layout(cr, layout);
-	cairo_restore(cr);
-
-	g_object_unref(layout);
-	pango_font_description_free(desc);
-
-	g_free(text);
-}
-
-static GtkPrintOperationResult
-_do_print(EDITOR * e, GtkPrintOperationAction action)
-{
-	GtkPrintOperation *operation;
-	GtkPrintSettings *psettings;
-	GtkPageSetup *setup;
-	GtkPrintOperationResult result;
-	GError *error = NULL;
-
-	operation = gtk_print_operation_new();
-	psettings = gtk_print_settings_new();
-
-	psettings = gtk_print_operation_get_print_settings(operation);
-
-	setup = gtk_page_setup_new();
-	gtk_page_setup_set_top_margin(setup, 30, GTK_UNIT_PIXEL);
-	gtk_page_setup_set_left_margin(setup, 50, GTK_UNIT_PIXEL);
-
-#ifdef WIN32
-	gtk_print_operation_set_unit(operation, GTK_UNIT_POINTS);
-#endif
-	gtk_print_operation_set_default_page_setup(operation, setup);
-
-	result = gtk_html_print_operation_run(GTK_HTML(e->html_widget), operation, action, GTK_WINDOW(e->window), (GtkHTMLPrintCalcHeight) _calc_header_height,	/* GtkHTMLPrintCalcHeight  calc_header_height */
-					      (GtkHTMLPrintCalcHeight) _calc_footer_height,	/* GtkHTMLPrintCalcHeight  calc_footer_height */
-					      (GtkHTMLPrintDrawFunc) _draw_header,	/* GtkHTMLPrintDrawFunc draw_header */
-					      (GtkHTMLPrintDrawFunc) _draw_footer,	/* GtkHTMLPrintDrawFunc draw_footer */
-					      e,	/* gpointer user_data */
-					      &error);
-
-	g_object_unref(operation);
-	handle_error(&error);
-
-	return result;
-}
-#endif /* 0 */
-
-static const gchar *file_ui =
-    "<ui>\n"
-    "  <menubar name='main-menu'>\n"
-    "    <menu action='file-menu'>\n"
-    "     <menuitem action='open'/>\n"
-    "     <menuitem action='save'/>\n"
-    "     <menuitem action='save-as'/>\n"
-    "     <menuitem action='new'/>\n"
-    "     <separator/>\n"
-    "     <menuitem action='print-preview'/>\n"
-    "     <menuitem action='print'/>\n"
-    "     <separator/>\n"
-    "     <menuitem action='quit'/>\n"
-    "    </menu>\n"
-    "  </menubar>\n"
-    "</ui>";
-
-static const gchar *note_file_ui =
-    "<ui>\n"
-    "  <menubar name='main-menu'>\n"
-    "    <menu action='file-menu'>\n"
-    "     <menuitem action='save'/>\n"
-    "     <menuitem action='save-as'/>\n"
-    "     <menuitem action='delete'/>\n"
-    "     <separator/>\n"
-    "     <menuitem action='print-preview'/>\n"
-    "     <menuitem action='print'/>\n"
-    "     <separator/>\n"
-    "     <menuitem action='quit'/>\n"
-    "    </menu>\n"
-    "  </menubar>\n"
-    "</ui>";
-
-static const gchar *view_ui =
-    "<ui>\n"
-    "  <menubar name='main-menu'>\n"
-    "    <menu action='view-menu'>\n"
-    "     <menuitem action='view-html-output'/>\n"
-    "     <menuitem action='view-html-source'/>\n"
-    "     <menuitem action='view-plain-source'/>\n"
-    "    </menu>\n"
-    "  </menubar>\n"
-    "</ui>";
-
-static const gchar *main_ui_note =
-    "<ui>\n"
-    "  <toolbar name='main-toolbar'> \n"
-    "    <placeholder name='pre-main-toolbar'> \n"
-    "      <toolitem action='save'/> \n"
-    "      <toolitem action='delete'/> \n"
-    "      <separator/> \n"
-    "    </placeholder> \n"
-    "  </toolbar> \n"
-    "</ui>";
-
-static const gchar *main_ui_studypad =
-    "<ui>\n"
-    "  <toolbar name='main-toolbar'> \n"
-    "    <placeholder name='pre-main-toolbar'> \n"
-    "      <toolitem action='save'/> \n"
-    "      <toolitem action='new'/> \n"
-    "      <separator/> \n"
-    "    </placeholder> \n"
-    "  </toolbar> \n"
-    "</ui>";
-
-static GtkPrintOperationResult
-print(GtkhtmlEditor *editor, GtkPrintOperationAction action)
-{
-	GtkPrintOperation *operation;
-	GtkPrintOperationResult result;
-	GError *error = NULL;
-
-	operation = gtk_print_operation_new();
-
-	result =
-	    gtk_html_print_operation_run(gtkhtml_editor_get_html(editor),
-					 operation, action,
-					 GTK_WINDOW(editor), NULL, NULL,
-					 NULL, NULL, NULL, &error);
-
-	g_object_unref(operation);
-	handle_error(&error);
-
-	return result;
-}
-
-static gint open_dialog(EDITOR *e)
-{
-	GtkWidget *dialog;
-	gint response;
-#if 0
-	const gchar *filename;
-#endif
-
-	dialog =
-	    gtk_file_chooser_dialog_new(_("Open"), GTK_WINDOW(e->window),
-					GTK_FILE_CHOOSER_ACTION_OPEN,
-#if GTK_CHECK_VERSION(3, 10, 0)
-					_("_Cancel"), GTK_RESPONSE_CANCEL,
-					_("_Open"), GTK_RESPONSE_ACCEPT,
-#else
-					GTK_STOCK_CANCEL,
-					GTK_RESPONSE_CANCEL,
-					GTK_STOCK_OPEN,
-					GTK_RESPONSE_ACCEPT,
-#endif
-					NULL);
-
-/*gtk_file_chooser_set_do_overwrite_confirmation (
-	   GTK_FILE_CHOOSER (dialog), TRUE); */
-
-#if 0
-	filename = gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window));
-#endif
-
-	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
-					    settings.studypaddir);
-
-	response = gtk_dialog_run(GTK_DIALOG(dialog));
-
-	if (response == GTK_RESPONSE_ACCEPT) {
-		gchar *new_filename;
-
-		new_filename =
-		    gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-		//gtkhtml_editor_set_filename (e->window, new_filename);
-		_load_file(e, new_filename);
-		g_free(new_filename);
-	}
-
-	gtk_widget_destroy(dialog);
-
-	return response;
-}
-
-static gint save_dialog(GtkhtmlEditor *editor, EDITOR *e)
-{
-	GtkWidget *dialog;
-	const gchar *filename;
-	gint response;
-
-	dialog =
-	    gtk_file_chooser_dialog_new(_("Save As"), GTK_WINDOW(editor),
-					GTK_FILE_CHOOSER_ACTION_SAVE,
-#if GTK_CHECK_VERSION(3, 10, 0)
-					_("_Cancel"), GTK_RESPONSE_CANCEL,
-					_("_Open"), GTK_RESPONSE_ACCEPT,
-#else
-					GTK_STOCK_CANCEL,
-					GTK_RESPONSE_CANCEL,
-					GTK_STOCK_SAVE,
-					GTK_RESPONSE_ACCEPT,
-#endif
-					NULL);
-
-	gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
-
-	filename = gtkhtml_editor_get_filename(editor);
-
-	if (filename != NULL)
-		gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dialog),
-					      filename);
-	else {
-		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
-						    settings.studypaddir);
-		gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog),
-						  _("Untitled document"));
-	}
-
-	response = gtk_dialog_run(GTK_DIALOG(dialog));
-
-	if (response == GTK_RESPONSE_ACCEPT) {
-		gchar *new_filename;
-
-		new_filename =
-		    gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-		gtkhtml_editor_set_filename(editor, new_filename);
-
-		if (e->filename)
-			g_free(e->filename);
-		e->filename = g_strdup(new_filename);
-
-		xml_set_value("Xiphos", "studypad", "lastfile",
-			      e->filename);
-		settings.studypadfilename =
-		    xml_get_value("studypad", "lastfile");
-
-		change_window_title(e->window, e->filename);
-
-		g_free(new_filename);
-	}
-
-	gtk_widget_destroy(dialog);
-
-	return response;
-}
-
-/* Helper for view_source_dialog() */
-static gboolean
-view_source_dialog_receiver(HTMLEngine *engine,
-			    const gchar *data,
-			    guint length, GString *string)
-{
-	g_string_append_len(string, data, length);
-
-	return TRUE;
-}
-
-static void
-view_source_dialog(GtkhtmlEditor *editor,
-		   const gchar *title,
-		   const gchar *content_type, gboolean show_output)
-{
-	GtkWidget *dialog;
-	GtkWidget *content;
-	GtkWidget *scrolled_window;
-	GString *string;
-
-	dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(editor),
-					     GTK_DIALOG_DESTROY_WITH_PARENT,
-#if GTK_CHECK_VERSION(3, 10, 0)
-					     _("_Close"), GTK_RESPONSE_CLOSE,
-#else
-					     GTK_STOCK_CLOSE,
-					     GTK_RESPONSE_CLOSE,
-#endif
-					     NULL);
-
-	scrolled_window = gtk_scrolled_window_new(NULL, NULL);
-	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window),
-				       GTK_POLICY_AUTOMATIC,
-				       GTK_POLICY_AUTOMATIC);
-	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled_window),
-					    GTK_SHADOW_IN);
-	gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), scrolled_window, TRUE,
-			   TRUE, 0);
-
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
-	gtk_container_set_border_width(GTK_CONTAINER(scrolled_window), 6);
-	gtk_window_set_default_size(GTK_WINDOW(dialog), 400, 300);
-
-	string = g_string_sized_new(4096);
-
-	gtk_html_export(gtkhtml_editor_get_html(editor),
-			content_type, (GtkHTMLSaveReceiverFn)
-			view_source_dialog_receiver,
-			string);
-
-	if (show_output) {
-		GtkHTMLStream *stream;
-
-		content = gtk_html_new();
-		stream = gtk_html_begin(GTK_HTML(content));
-		gtk_html_stream_write(stream, string->str, string->len);
-		gtk_html_stream_close(stream, GTK_HTML_STREAM_OK);
-	} else {
-		GtkTextBuffer *buffer;
-
-		content = gtk_text_view_new();
-		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(content));
-		gtk_text_buffer_set_text(buffer, string->str, string->len);
-		gtk_text_view_set_editable(GTK_TEXT_VIEW(content), FALSE);
-	}
-
-	g_string_free(string, TRUE);
-
-	gtk_container_add(GTK_CONTAINER(scrolled_window), content);
-	gtk_widget_show_all(scrolled_window);
-
-	gtk_dialog_run(GTK_DIALOG(dialog));
-	gtk_widget_destroy(dialog);
-}
-
-static void action_print_cb(GtkAction *action, EDITOR *e)
-{
-	print(GTKHTML_EDITOR(e->window),
-	      GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-static void action_print_preview_cb(GtkAction *action, EDITOR *e)
-{
-	print(GTKHTML_EDITOR(e->window),
-	      GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-static void action_quit_cb(GtkAction *action, EDITOR *e)
-{
-	app_delete_cb(NULL, NULL, e);
-}
-
-static void action_open_cb(GtkAction *action, EDITOR *e)
-{
-	open_dialog(e);
-}
-
-static void action_save_cb(GtkAction *action, EDITOR *e)
-{
-	switch (e->type) {
-	case STUDYPAD_EDITOR:
-		_save_file(e);
-		break;
-	case NOTE_EDITOR:
-		_save_note(e);
-		break;
-	case BOOK_EDITOR:
-		_save_book(e);
-		break;
-	default:
-		XI_message(("\naction_save_cb oops!\n"));
-		break;
-	}
-}
-
-static void action_new_cb(GtkAction *action, EDITOR *e)
-{ /* for studypad only */
-
-	if (editor_is_dirty(e))
-		_save_file(e);
-
-	_load_file(e,
-		   g_strdup_printf("%s/%s", settings.gSwordDir,
-				   "template.pad"));
-
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = g_strdup(_("Untitled document"));
-
-	xml_set_value("Xiphos", "studypad", "lastfile", e->filename);
-	settings.studypadfilename = xml_get_value("studypad", "lastfile");
-	change_window_title(e->window, e->filename);
-
-	gtkhtml_editor_set_filename(GTKHTML_EDITOR(e->window), NULL);
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), TRUE);
-}
-
-static void action_delete_cb(GtkAction *action, EDITOR *e)
-{ /* for note only */
-
-	gchar *buf;
-
-	if (e->studypad)
-		return;
-
-	buf = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s?</span>",
-			      _("Are you sure you want to delete the note for"), e->key);
-
-	if (gui_yes_no_dialog(buf,
-#if GTK_CHECK_VERSION(3, 10, 0)
-			      "dialog-warning"
-#else
-			      GTK_STOCK_DIALOG_WARNING
-#endif
-			      )) {
-		main_delete_note(e->module, e->key);
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     "", strlen(""));
-	}
-	g_free(buf);
-}
-
-static void action_insert_link_cb(GtkAction *action, EDITOR *e)
-{
-	editor_link_dialog(e);
-}
-
-static void action_save_as_cb(GtkAction *action, EDITOR *e)
-{
-	const gchar *filename;
-	gboolean as_html;
-	GError *error = NULL;
-
-	if (save_dialog(GTKHTML_EDITOR(e->window), e) ==
-	    GTK_RESPONSE_CANCEL)
-		return;
-
-	filename = gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window));
-	as_html = gtkhtml_editor_get_html_mode(GTKHTML_EDITOR(e->window));
-
-	gtkhtml_editor_save(GTKHTML_EDITOR(e->window), filename, as_html,
-			    &error);
-	handle_error(&error);
-}
-
-static void
-action_view_html_output(GtkAction *action, GtkhtmlEditor *editor)
-{
-	view_source_dialog(editor, _("HTML Output"), "text/html", TRUE);
-}
-
-static void
-action_view_html_source(GtkAction *action, GtkhtmlEditor *editor)
-{
-	view_source_dialog(editor, _("HTML Source"), "text/html", FALSE);
-}
-
-static void
-action_view_plain_source(GtkAction *action, GtkhtmlEditor *editor)
-{
-	view_source_dialog(editor, _("Plain Source"), "text/plain", FALSE);
-}
-
-static GtkActionEntry file_entries[] = {
-
-    {"print",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "_Print...",
-#else
-     GTK_STOCK_PRINT,
-#endif
-     N_("_Print..."),
-     NULL,
-     NULL,
-     G_CALLBACK(action_print_cb)},
-
-    {"print-preview",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "Print Pre_view...",
-#else
-     GTK_STOCK_PRINT_PREVIEW,
-#endif
-     N_("Print Pre_view"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_print_preview_cb)},
-
-    {"quit",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "_Quit...",
-#else
-     GTK_STOCK_QUIT,
-#endif
-     N_("_Quit"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_quit_cb)},
-
-    {"open",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "_Open",
-#else
-     GTK_STOCK_OPEN,
-#endif
-     N_("_Open"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_open_cb)},
-
-    {"save",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "_Save",
-#else
-     GTK_STOCK_SAVE,
-#endif
-     N_("_Save"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_save_cb)},
-
-    {"save-as",
-#if GTK_CHECK_VERSION(3, 10, 0)
-     "Save _As...",
-#else
-     GTK_STOCK_SAVE_AS,
-#endif
-     N_("Save _As..."),
-     NULL,
-     NULL,
-     G_CALLBACK(action_save_as_cb)},
-    {"new",
-     "gtk-new",
-     N_("New"),
-     NULL,
-     N_("Open new document"),
-     G_CALLBACK(action_new_cb)},
-    {"delete",
-     "gtk-delete",
-     N_("Delete"),
-     NULL,
-     N_("Delete current note"),
-     G_CALLBACK(action_delete_cb)},
-
-    {"file-menu",
-     NULL,
-     N_("_File"),
-     NULL,
-     NULL,
-     NULL}};
-
-/*
-static GtkActionEntry note_file_entries[] = {
-
-	{ "print",
-	  GTK_STOCK_PRINT,
-	  N_("_Print..."),
-	  NULL,
-	  NULL,
-	  G_CALLBACK (action_print_cb) },
-
-	{ "print-preview",
-	  GTK_STOCK_PRINT_PREVIEW,
-	  N_("Print Pre_view"),
-	  NULL,
-	  NULL,
-	  G_CALLBACK (action_print_preview_cb) },
-
-	{ "quit",
-	  GTK_STOCK_QUIT,
-	  N_("_Quit"),
-	  NULL,
-	  NULL,
-	  G_CALLBACK (action_quit_cb) },
-
-	{ "save",
-	  GTK_STOCK_SAVE,
-	  N_("_Save"),
-	  NULL,
-	  NULL,
-	  G_CALLBACK (action_save_cb) },
-
-	{ "save-as",
-	  GTK_STOCK_SAVE_AS,
-	  N_("Save _As..."),
-	  NULL,
-	  NULL,
-	  G_CALLBACK (action_save_as_cb) },
-
-	{ "file-menu",
-	  NULL,
-	  N_("_File"),
-	  NULL,
-	  NULL,
-	  NULL }
-};
-*/
-static GtkActionEntry view_entries[] = {
-
-    {"view-html-output",
-     NULL,
-     N_("HTML _Output"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_view_html_output)},
-
-    {"view-html-source",
-     NULL,
-     N_("_HTML Source"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_view_html_source)},
-
-    {"view-plain-source",
-     NULL,
-     N_("_Plain Source"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_view_plain_source)},
-
-    {"view-menu",
-     NULL,
-     N_("_View"),
-     NULL,
-     NULL,
-     NULL}};
-
-static GtkActionEntry main_entries[] = {
-
-    {"save",
-     "gtk-save",
-     N_("Save"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_save_cb)}};
-
-static GtkActionEntry test_entries[] = {
-
-    {"context-insert-link",
-     "insert-link",
-     N_("Insert Link"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_insert_link_cb)},
-
-    {"insert-link",
-     "insert-link",
-     N_("Insert Link"),
-     NULL,
-     NULL,
-     G_CALLBACK(action_insert_link_cb)}};
-
-GtkWidget *editor_new(const gchar *title, EDITOR *e)
-{
-	GtkActionGroup *action_group;
-	GtkUIManager *manager;
-	GtkWidget *editor;
-	GError *error = NULL;
-
-	editor = gtkhtml_editor_new();
-	e->window = editor;
-	e->html_widget =
-	    GTK_WIDGET(gtkhtml_editor_get_html(GTKHTML_EDITOR(editor)));
-	gtk_window_set_title(GTK_WINDOW(editor), title);
-
-	set_window_icon(GTK_WINDOW(editor));
-
-	manager = gtkhtml_editor_get_ui_manager(GTKHTML_EDITOR(editor));
-	if (e->type == STUDYPAD_EDITOR)
-		gtk_ui_manager_add_ui_from_string(manager, file_ui, -1,
-						  &error);
-	else
-		gtk_ui_manager_add_ui_from_string(manager, note_file_ui,
-						  -1, &error);
-
-	handle_error(&error);
-
-	gtk_ui_manager_add_ui_from_string(manager, view_ui, -1, &error);
-	handle_error(&error);
-
-	if (e->type == STUDYPAD_EDITOR)
-		gtk_ui_manager_add_ui_from_string(manager,
-						  main_ui_studypad, -1,
-						  &error);
-	else
-		gtk_ui_manager_add_ui_from_string(manager, main_ui_note,
-						  -1, &error);
-
-	handle_error(&error);
-
-	action_group = gtk_action_group_new("file");
-	gtk_action_group_set_translation_domain(action_group,
-						GETTEXT_PACKAGE);
-	gtk_action_group_add_actions(action_group, file_entries,
-				     G_N_ELEMENTS(file_entries), e);
-	gtk_ui_manager_insert_action_group(manager, action_group, 0);
-
-	action_group = gtk_action_group_new("view");
-	gtk_action_group_set_translation_domain(action_group,
-						GETTEXT_PACKAGE);
-	gtk_action_group_add_actions(action_group, view_entries,
-				     G_N_ELEMENTS(view_entries), editor);
-	gtk_ui_manager_insert_action_group(manager, action_group, 0);
-
-	action_group = gtk_action_group_new("main");
-	gtk_action_group_set_translation_domain(action_group,
-						GETTEXT_PACKAGE);
-	gtk_action_group_add_actions(action_group, main_entries,
-				     G_N_ELEMENTS(main_entries), e);
-	gtk_ui_manager_insert_action_group(manager, action_group, 0);
-
-	action_group = gtk_action_group_new("context-menu");
-	gtk_action_group_set_translation_domain(action_group,
-						GETTEXT_PACKAGE);
-	gtk_action_group_add_actions(action_group, test_entries,
-				     G_N_ELEMENTS(test_entries), e);
-	gtk_ui_manager_insert_action_group(manager, action_group, 0);
-
-	gtk_ui_manager_ensure_update(manager);
-	gtk_widget_show(editor);
-
-	gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), FALSE);
-
-	g_signal_connect(editor, "delete-event",
-			 G_CALLBACK(app_delete_cb), (EDITOR *)e);
-	return editor;
-}
-
-/* Helper for _save_note() and _save_book()*/
-static gboolean
-_save_receiver(HTMLEngine *engine,
-	       const gchar *data, guint length, GString *string)
-{
-	g_string_append_len(string, data, length);
-
-	return TRUE;
-}
-
-static void _save_note(EDITOR *e)
-{
-	GString *string;
-
-	string = g_string_sized_new(4096);
-
-	gtk_html_export(gtkhtml_editor_get_html(GTKHTML_EDITOR(e->window)),
-			"text/html",
-			(GtkHTMLSaveReceiverFn)_save_receiver, string);
-	XI_message(("\n_save_note: %s\n", string->str));
-	main_save_note(e->module, e->key, string->str);
-
-	g_string_free(string, TRUE);
-	gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), FALSE);
-}
-
-static void _save_book(EDITOR *e)
-{
-	GString *string;
-
-	string = g_string_sized_new(4096);
-
-	gtk_html_export(gtkhtml_editor_get_html(GTKHTML_EDITOR(e->window)),
-			"text/html",
-			(GtkHTMLSaveReceiverFn)_save_receiver, string);
-
-	main_treekey_save_book_text(e->module, e->key, string->str);
-	g_string_free(string, TRUE);
-	gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), FALSE);
-}
-
-static void _save_file(EDITOR *e)
-{
-	const gchar *filename;
-	gboolean as_html;
-	GError *error = NULL;
-
-	if (gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window)) == NULL)
-		if (save_dialog(GTKHTML_EDITOR(e->window), e) ==
-		    GTK_RESPONSE_CANCEL)
-			return;
-
-	filename = gtkhtml_editor_get_filename(GTKHTML_EDITOR(e->window));
-	as_html = gtkhtml_editor_get_html_mode(GTKHTML_EDITOR(e->window));
-
-	XI_message(("\n_save_file filename: %s\n", filename));
-
-	gtkhtml_editor_save(GTKHTML_EDITOR(e->window), filename, as_html,
-			    &error);
-	handle_error(&error);
-
-	gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), FALSE);
-}
-
-static void _load_file(EDITOR *e, const gchar *filename)
-{
-	//GtkWidget *choser;
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = g_strdup(filename);
-
-	XI_message(("_load_file filename: %s", filename));
-
-	xml_set_value("Xiphos", "studypad", "lastfile", e->filename);
-	settings.studypadfilename = xml_get_value("studypad", "lastfile");
-	change_window_title(e->window, e->filename);
-
-	char *contents;
-	char *etag_out;
-	gsize length;
-	GFile *file;
-	file = g_file_new_for_path(filename);
-	gtkhtml_editor_set_filename(GTKHTML_EDITOR(e->window),
-				    e->filename);
-	if (g_file_load_contents(file, NULL, &contents, &length, &etag_out, NULL))
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     contents, length);
-	gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-	gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window), FALSE);
-	return;
-}
-
-gboolean editor_is_dirty(EDITOR *e)
-{
-	return gtkhtml_editor_get_changed(GTKHTML_EDITOR(e->window));
-}
-
-void editor_save_book(EDITOR *e)
-{
-	if (editor_is_dirty(e)) {
-		_save_book(e);
-	}
-}
-
-/* save if needed is done in treeky-editor.c before calling editor_load_book() */
-void editor_load_book(EDITOR *e)
-{
-	gchar *title = NULL;
-	gchar *text = NULL;
-
-	if (!g_ascii_isdigit(e->key[0]))
-		return; /* make sure is a number (offset) */
-
-	title = g_strdup_printf("%s", e->module);
-	XI_message(("book: %s\noffset :%s", e->module, e->key));
-
-	if (atol(e->key) != 0)
-		text = main_get_book_raw_text(e->module, e->key);
-	else
-		text = g_strdup(e->module);
-
-	if (strlen(text)) {
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     text, strlen(text));
-		gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-		gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window),
-					   FALSE);
-	} else {
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     "", strlen(""));
-		gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-		gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window),
-					   FALSE);
-	}
-
-	change_window_title(e->window, title);
-
-	if (text)
-		g_free(text);
-	if (title)
-		g_free(title);
-}
-
-/******************************************************************************
- * Name
- *   sync_toggled
- *
- * Synopsis
- *   #include "/.h"
- *
- *   void sync_toggled(GtkToggleButton * button, DIALOG_DATA * vc)
- *
- * Description
- *
- *
- * Return value
- *   void
- */
-
-void editor_sync_with_main(void)
-{
-	GList *tmp = NULL;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		EDITOR *e = (EDITOR *)tmp->data;
-
-		switch (e->type) {
-		case STUDYPAD_EDITOR:
-		case BOOK_EDITOR:
-			break;
-		case NOTE_EDITOR:
-			if (e->sync)
-				editor_load_note(e, NULL,
-						 settings.currentverse);
-			break;
-		}
-		tmp = g_list_next(tmp);
-	}
-}
-
-void
-editor_load_note(EDITOR *e, const gchar *module_name, const gchar *key)
-{
-	gchar *title;
-	gchar *text;
-
-	if (editor_is_dirty(e))
-		_save_note(e);
-
-	if (module_name) {
-		if (e->module)
-			g_free(e->module);
-		e->module = g_strdup(module_name);
-	}
-	if (key) {
-		if (e->key)
-			g_free(e->key);
-		e->key = g_strdup(key);
-	}
-
-	title = g_strdup_printf("%s - %s", e->module, e->key);
-	text = main_get_raw_text((gchar *)e->module, (gchar *)e->key);
-	if (strlen(text)) {
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     text, strlen(text));
-		gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-		gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window),
-					   FALSE);
-
-	} else {
-		gtkhtml_editor_set_text_html(GTKHTML_EDITOR(e->window),
-					     "", strlen(""));
-		gtkhtml_editor_drop_undo(GTKHTML_EDITOR(e->window));
-		gtkhtml_editor_set_changed(GTKHTML_EDITOR(e->window),
-					   FALSE);
-	}
-
-	change_window_title(e->window, title);
-	if (e->type == NOTE_EDITOR)
-		main_navbar_versekey_set(e->navbar, e->key);
-
-	if (text)
-		g_free(text);
-	if (title)
-		g_free(title);
-}
-
-static int
-app_delete_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
-{
-	if (editor_is_dirty((EDITOR *)data)) {
-		switch (ask_about_saving((EDITOR *)data)) {
-		case GS_YES: /* exit saving */
-
-			break;
-		case GS_NO: /* exit without saving */
-
-			break;
-		case GS_CANCEL:
-			return TRUE;
-			break;
-		}
-	}
-	editors_all = g_list_remove(editors_all, (EDITOR *)data);
-	do_exit((EDITOR *)data);
-	return FALSE;
-}
-
-static gint ask_about_saving(EDITOR *e)
-{
-	gint test;
-	GS_DIALOG *info;
-	gchar *buf = NULL;
-	gchar *buf1 = NULL;
-	gchar *buf2 = NULL;
-	gchar *buf3 = NULL;
-	gint retval = FALSE;
-
-	switch (e->type) {
-	case BOOK_EDITOR:
-	case NOTE_EDITOR:
-		info = gui_new_dialog();
-		info->stock_icon = GTK_STOCK_DIALOG_WARNING;
-
-		buf = g_strdup_printf("%s: %s", e->module, e->key);
-		buf1 = _("Save the changes to document");
-		buf2 = _("before closing?");
-		buf3 =
-		    g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s %s</span>",
-				    buf1, buf, buf2);
-		info->label_top = buf3;
-		info->label2 = _("If you don't save, changes will be permanently lost.");
-		info->save = TRUE;
-		info->cancel = TRUE;
-		info->no_save = TRUE;
-
-		test = gui_alert_dialog(info);
-		retval = test;
-
-		if (test == GS_YES) {
-			if (e->type == NOTE_EDITOR) {
-				/* save notes and prayer lists */
-				_save_note(e);
-
-			} else {
-				/* save notes and prayer lists */
-				_save_book(e);
-			}
-		}
-		g_free(info);
-		g_free(buf);
-		g_free(buf3);
-		break;
-
-	case STUDYPAD_EDITOR:
-		info = gui_new_dialog();
-		info->stock_icon =
-#if GTK_CHECK_VERSION(3, 10, 0)
-		    "dialog-warning";
-#else
-		    GTK_STOCK_DIALOG_WARNING;
-#endif
-		if (settings.studypadfilename)
-			buf = settings.studypadfilename;
-		else
-			buf = N_("File");
-		buf1 = _("Save the changes to document");
-		buf2 = _("before closing?");
-		buf3 =
-		    g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s %s</span>",
-				    buf1, buf, buf2);
-		info->label_top = buf3;
-		info->label2 = _("If you don't save, changes will be permanently lost.");
-		info->save = TRUE;
-		info->cancel = TRUE;
-		info->no_save = TRUE;
-
-		test = gui_alert_dialog(info);
-		retval = test;
-		if (test == GS_YES) {
-			if (e->filename)
-				gtkhtml_editor_save(GTKHTML_EDITOR(e->window),
-						    e->filename, TRUE,
-						    NULL);
-			/*else
-			   open_or_save_as_dialog(e,
-			   OP_SAVE_THROUGH_PERSIST_FILE); */
-		}
-		g_free(info);
-		g_free(buf3);
-		break;
-	}
-	sync_windows();
-	return retval;
-}
-
-static gint _create_new(const gchar *filename, const gchar *key,
-			gint editor_type)
-{
-	EDITOR *editor;
-	GtkWidget *vbox = NULL;
-	GtkWidget *toolbar_nav = NULL;
-
-	editor = g_new(EDITOR, 1);
-	editor->html_widget = NULL;
-	editor->sync = FALSE;
-	editor->type = editor_type;
-
-	switch (editor_type) {
-	case STUDYPAD_EDITOR:
-		editor->studypad = TRUE;
-		editor->bookeditor = FALSE;
-		editor->noteeditor = FALSE;
-		editor->module = NULL;
-		editor->key = NULL;
-		editor->filename = NULL;
-		widgets.studypad_dialog =
-		    editor_new(_("StudyPad"), editor);
-
-		if (filename) {
-			editor->filename = g_strdup(filename);
-			_load_file(editor, g_strdup(filename));
-		}
-		break;
-	case NOTE_EDITOR:
-		editor->noteeditor = TRUE;
-		editor->bookeditor = FALSE;
-		editor->studypad = FALSE;
-		editor->filename = NULL;
-		editor->module = g_strdup(filename);
-		editor->key = g_strdup(key);
-		editor->navbar.key = NULL;
-		editor_new(_("Note Editor"), editor);
-		vbox = GTKHTML_EDITOR(editor->window)->vbox;
-		toolbar_nav = gui_navbar_versekey_editor_new(editor);
-		gtk_widget_show(toolbar_nav);
-		gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(toolbar_nav),
-				   FALSE, TRUE, 0);
-		gtk_box_reorder_child(GTK_BOX(vbox),
-				      GTK_WIDGET(toolbar_nav), 1);
-
-		editor_load_note(editor, NULL, NULL);
-		break;
-	case BOOK_EDITOR:
-		editor->bookeditor = TRUE;
-		editor->noteeditor = FALSE;
-		editor->studypad = FALSE;
-		editor->filename = NULL;
-		editor->module = g_strdup(filename);
-		editor->key = g_strdup(key);
-		editor_new(_("Prayer List/Journal Editor"), editor);
-
-		GtkWidget *box;
-		UI_VBOX(box, TRUE, 0);
-		gtk_widget_show(box);
-		GtkWidget *hpaned1 = UI_HPANE();
-		gtk_widget_show(hpaned1);
-		gtk_paned_pack2(GTK_PANED(hpaned1), box, TRUE, TRUE);
-
-		GtkWidget *scrollbar = gtk_scrolled_window_new(NULL, NULL);
-		gtk_widget_show(scrollbar);
-		gtk_paned_pack1(GTK_PANED(hpaned1), GTK_WIDGET(scrollbar),
-				TRUE, TRUE);
-		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbar),
-					       GTK_POLICY_AUTOMATIC,
-					       GTK_POLICY_AUTOMATIC);
-		gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)
-						    scrollbar,
-						    settings.shadow_type);
-
-		editor->treeview = gui_create_editor_tree(editor);
-		gtk_widget_show(editor->treeview);
-		gtk_container_add(GTK_CONTAINER(scrollbar),
-				  editor->treeview);
-		gtk_paned_set_position(GTK_PANED(hpaned1), 125);
-		gtk_tree_view_collapse_all((GtkTreeView *)
-					   editor->treeview);
-		// then we should expand on the item to which we've opened for edit.
-		vbox = GTKHTML_EDITOR(editor->window)->vbox;
-
-		gtk_widget_reparent(vbox, box);
-
-		gtk_container_add(GTK_CONTAINER(editor->window), hpaned1);
-
-		editor_load_book(editor);
-
-		break;
-	}
-	editor->is_changed = FALSE;
-	editors_all = g_list_append(editors_all, (EDITOR *)editor);
-	return 1;
-}
-
-/******************************************************************************
- * Name
- *   editor_create_new
- *
- * Synopsis
- *   #include "editor/html-editor.h"
- *
- *   gint editor_create_new(const gchar * filename, const gchar * key, gint note)
- *
- * Description
- *   limits editors to one note editor and one studypad open at a time
- *
- * Return value
- *   gint
- */
-
-gint editor_create_new(const gchar *filename, const gchar *key,
-		       gint editor_type)
-{
-	GList *tmp = NULL;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		EDITOR *e = (EDITOR *)tmp->data;
-		switch (editor_type) {
-		case STUDYPAD_EDITOR:
-			if (e->studypad) {
-				if (editor_is_dirty(e))
-					_save_file(e);
-				if (e->filename)
-					g_free(e->filename);
-				e->filename = g_strdup(filename);
-				gtk_widget_show(e->window);
-				gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-
-				_load_file(e, g_strdup(filename));
-				return 1;
-			}
-			break;
-		case NOTE_EDITOR:
-			if (!e->noteeditor)
-				break;
-			if (editor_is_dirty(e))
-				_save_note(e);
-			if (e->module)
-				g_free(e->module);
-			e->module = g_strdup(filename);
-			if (e->key)
-				g_free(e->key);
-			e->key = g_strdup(key);
-			gtk_widget_show(e->window);
-			gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-
-			editor_load_note(e, NULL, NULL);
-
-			return 1;
-			break;
-		case BOOK_EDITOR:
-			if (!e->bookeditor)
-				break;
-			if (editor_is_dirty(e))
-				_save_book(e);
-			if (e->module)
-				g_free(e->module);
-			e->module = g_strdup(filename);
-			if (e->key)
-				g_free(e->key);
-			e->key = g_strdup(key);
-			gtk_widget_show(e->window);
-			gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-			main_load_book_tree_in_editor(GTK_TREE_VIEW(e->treeview),
-						      e->module);
-			editor_load_book(e);
-
-			return 1;
-			break;
-		}
-		tmp = g_list_next(tmp);
-	}
-	XI_message(("filename %s, key %s",
-		    (filename ? filename : "-null-"),
-		    (key ? key : "-null-")));
-	return _create_new(filename, key, editor_type);
-}
-
-void editor_maybe_save_all(void)
-{
-	GList *tmp, *tmp2;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		/* 2ndary list chaser:
-		   elements will be removed by the saver. */
-		tmp2 = g_list_next(tmp);
-
-		app_delete_cb(NULL, NULL, (EDITOR *)tmp->data);
-		tmp = tmp2;
-	}
-}
-
-#endif /* !USE_WEBKIT_EDITOR */
+// empty
diff --git a/src/editor/slib-editor.h b/src/editor/slib-editor.h
index 4cc1615..8b1a393 100644
--- a/src/editor/slib-editor.h
+++ b/src/editor/slib-editor.h
@@ -1,86 +1 @@
-/*
- * Xiphos Bible Study Tool
- * slib-editor.h - the html editor using gtkhtml-editor (slib)
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _SLIB_EDITOR_H
-#define _SLIB_EDITOR_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <config.h>
-
-#ifndef USE_WEBKIT_EDITOR
-
-#include <gtk/gtk.h>
-
-#include "main/navbar_versekey.h"
-
-typedef struct _editor EDITOR;
-struct _editor
-{
-	GtkWidget *window;
-	GtkWidget *toolbar;
-	GtkWidget *treeview;
-	GtkWidget *sync_button;
-	GtkWidget *html_widget;
-	GtkWidget *statusbar;
-
-	NAVBAR_VERSEKEY navbar;
-
-	gint type;
-
-	gboolean studypad;
-	gboolean noteeditor;
-	gboolean bookeditor;
-	gboolean is_changed;
-	gboolean sync;
-
-	gchar *filename;
-	gchar *module;
-	gchar *key;
-};
-
-enum {
-	STUDYPAD_EDITOR,
-	NOTE_EDITOR,
-	BOOK_EDITOR
-};
-
-/*
-void button_test_clicked_cb(GtkObject *object, gpointer user_data);
-void button_ok_clicked_cb(GtkObject *object, gpointer user_data);
-void button_cancel_clicked_cb(GtkObject *object, gpointer user_data);*/
-void editor_sync_with_main(void);
-void editor_load_note(EDITOR *e, const gchar *module_name,
-		      const gchar *key);
-void editor_load_book(EDITOR *e);
-gint editor_create_new(const gchar *filename, const gchar *key,
-		       gint note);
-void editor_save_book(EDITOR *e);
-void editor_maybe_save_all(void);
-GtkWidget *editor_new(const gchar *title, EDITOR *e);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* !USE_WEBKIT_EDITOR */
-#endif /* _SLIB_EDITOR_H */
+// empty
diff --git a/src/editor/template.h b/src/editor/template.h
index 3afdf7d..8b1a393 100644
--- a/src/editor/template.h
+++ b/src/editor/template.h
@@ -1,72 +1 @@
-/*
- * Xiphos Bible Study Tool
- * template.h - data for studypad template (webkit editor)
- *
- *  ** this is used by settings only if studypad.spt does not exist **
- * 
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#define studypad_template \
-	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n\
-<html>\n\
-<head>\n\
-<title>studypad template</title>\n\
-<meta name=\"generator\" content=\"Studypad\">\n\
-<meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n\
-<meta http-equiv=\"content-type\" content=\"application/xhtml+xml; charset=UTF-8\">\n\
-<meta http-equiv=\"content-style-type\" content=\"text/css\">\n\
-<meta http-equiv=\"expires\" content=\"0\">\n\
-<style content=\"text/css\">\n\
- a { text-decoration:none; } \n\
- span.M1 { \n\
- 	font-family:Droid Sans,sans-serif; \n\
- 	font-size: 14px; \n\
- 	font-weight: normal; \n\
- } \n\
- span.acrostic             { text-align: center; } \n\
- span.divineName           { font-variant: small-caps; } \n\
- span.selah                { text-align: right; width: 50%; margin: 0; padding: 0; } \n\
- span.small-caps           { font-variant: small-caps; } \n\
- span.transChangeSupplied  { font-style: italic; } \n\
- span.wordsOfJesus         { color: red; } \n\
-ol.L1 { \n\
-	list-style-type: upper-roman; \n\
-	font-weight: normal; \n\
-	margin-left: -10px; \n\
-} \n\
-ol.L2 { \n\
-	list-style-type: upper-alpha; \n\
-	font-weight: normal; \n\
-	margin-left: -6px; \n\
-} \n\
-ol.L3 { \n\
-	list-style-type: decimal; \n\
-	font-weight: normal; \n\
-	margin-left: 5px; \n\
-} \n\
-ol.L4 { \n\
-	list-style-type: lower-alpha; \n\
-	font-weight: normal; \n\
-	margin-left: 10px; \n\
-} \n\
-</style>\n\
-</head>\n\
-<body>\n\
-\n\
-</body>\n\
-</html>\n"
+// empty
diff --git a/src/editor/webkit_editor.c b/src/editor/webkit_editor.c
index 576efee..8b1a393 100644
--- a/src/editor/webkit_editor.c
+++ b/src/editor/webkit_editor.c
@@ -1,1432 +1 @@
-/*
- * Xiphos Bible Study Tool
- * webkit_editor.c - html editor using webkit
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <config.h>
-
-#ifdef USE_WEBKIT_EDITOR
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <ctype.h>
-
-#include <glib.h>
-#include <webkit/webkit.h>
-
-#include <libintl.h>
-#include <locale.h>
-#include <stdlib.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
-#include "editor/webkit_editor.h"
-#include "editor/editor.h"
-#include "editor/link_dialog.h"
-
-#include "main/settings.h"
-#include "main/sword.h"
-#include "main/sword_treekey.h"
-#include "main/url.hh"
-#include "main/xml.h"
-
-#include "gui/navbar_versekey_editor.h"
-#include "gui/dialog.h"
-#include "gui/widgets.h"
-#include "gui/xiphos.h"
-#include "gui/treekey-editor.h"
-#include "gui/utilities.h"
-
-#include "gui/debug_glib_null.h"
-//TOOL_ITEMS toolitems;
-MENU popup;
-FIND_DIALOG find_dialog;
-
-extern gboolean do_display;
-extern BUTTONS_STATE buttons_state;
-
-static void change_window_title(GtkWidget *window, const gchar *window_title);
-
-static gboolean editor_is_dirty(EDITOR *e);
-
-static void _load_file(EDITOR *e, const gchar *filename);
-static void _save_file(EDITOR *e);
-static void _save_note(EDITOR *e);
-static void _save_book(EDITOR *e);
-
-static GList *editors_all = NULL;
-
-/******************************************************************************
- * Name
- *   on_about_dialog_response
- *
- * Synopsis
- *   #include "gui/.h"
- *
- *   void on_about_dialog_response(GtkDialog * dialog, gint response_id,
- *			           gpointer user_data)
- *
- * Description
- *
- * Return value
- *   void
- */
-
-static void
-on_about_dialog_response(GtkDialog *dialog,
-			 gint response_id, gpointer user_data)
-{
-	gtk_widget_destroy(GTK_WIDGET(dialog));
-}
-
-/******************************************************************************
- * Name
- *   action_about_activate_cb
- *
- * Synopsis
- *   #include "gui/about_sword.h"
- *
- *   void action_about_activate_cb(GtkWidget *widget, EDITOR *e);
- *
- * Description
- *   Create brief dialog for webkit editor.
- *
- * Return value
- *   void
- */
-
-G_MODULE_EXPORT void
-action_about_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	GtkWidget *about;
-	GdkPixbuf *about_logo;
-
-	about_logo = pixbuf_finder("xiphos-button-125.png", 0, NULL);
-	about = gtk_about_dialog_new();
-
-	g_signal_connect(about, "response",
-			 G_CALLBACK(on_about_dialog_response), NULL);
-	gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(about), "WebKit editor, Xiphos");
-	gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(about), (gchar *)VERSION);
-	gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(about), "Replacement for gtkhtml editor");
-	gtk_about_dialog_set_logo(GTK_ABOUT_DIALOG(about), about_logo);
-	set_window_icon(GTK_WINDOW(about));
-	gtk_widget_show(about);
-}
-
-G_MODULE_EXPORT void
-action_increase_indent_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('Indent', false, false);", e);
-	editor_insert_new_outline_level(e->toolitems.outline_level, e);
-}
-
-G_MODULE_EXPORT void
-action_decrease_indent_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('Outdent', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_insert_rule_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_insert_html("<hr>", e);
-}
-
-G_MODULE_EXPORT void
-action_insert_table_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-}
-
-G_MODULE_EXPORT void
-action_insert_emoticon_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	// This is stupid, if we don't have emoticons working, then we sould
-	// remove the button users see.
-
-	//script = g_strdup ("document.execCommand('', null, \"\");");
-}
-
-G_MODULE_EXPORT void
-action_insert_image_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	gchar *filename = NULL;
-
-	GtkWidget *dialog = gtk_file_chooser_dialog_new("Select an image file",
-							NULL,
-							GTK_FILE_CHOOSER_ACTION_OPEN,
-#if GTK_CHECK_VERSION(3, 10, 0)
-							"_Cancel", GTK_RESPONSE_CANCEL,
-							"_OK", GTK_RESPONSE_ACCEPT,
-#else
-							GTK_STOCK_CANCEL,
-							GTK_RESPONSE_CANCEL,
-							GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
-#endif
-							NULL);
-
-	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
-		filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-		gchar *script = g_strdup_printf("document.execCommand('insertImage', null, '%s');", filename);
-		editor_execute_script(script, e);
-		g_free(script);
-	}
-
-	if (filename)
-		g_free(filename);
-	gtk_widget_destroy(dialog);
-}
-
-G_MODULE_EXPORT void
-action_insert_outline_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('insertHTML', null, \"<OL CLASS=L1><LI> </LI></OL> \");", e);
-}
-
-G_MODULE_EXPORT void
-action_justify_right_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('justifyright', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_justify_left_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('justifyleft', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_justify_center_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('justifycenter', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_justify_full_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('justifyfull', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_bold_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	if (buttons_state.nochange)
-		return;
-
-	editor_execute_script("document.execCommand('bold',false,false);", e);
-}
-
-G_MODULE_EXPORT void
-action_italic_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	//extern BUTTONS_STATE buttons_state;
-	if (buttons_state.nochange)
-		return;
-
-	editor_execute_script("document.execCommand('italic',false,false);", e);
-}
-
-G_MODULE_EXPORT void
-action_undo_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('undo',false,false);", e);
-}
-
-G_MODULE_EXPORT void
-action_redo_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_execute_script("document.execCommand('redo',false,false);", e);
-}
-
-G_MODULE_EXPORT void
-action_underline_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	//extern BUTTONS_STATE buttons_state;
-	if (buttons_state.nochange)
-		return;
-
-	editor_execute_script("document.execCommand('underline', false, false);", e);
-}
-
-G_MODULE_EXPORT void
-action_strikethrough_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	//extern BUTTONS_STATE buttons_state;
-	if (buttons_state.nochange)
-		return;
-
-	editor_execute_script("document.execCommand('strikethrough', false, false);", e);
-}
-
-G_MODULE_EXPORT void action_cut_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_cut(e);
-}
-
-G_MODULE_EXPORT void
-action_copy_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	if (editor_copy(e))
-		XI_message(("%s", "copy success"));
-	else
-		XI_message(("%s", "copy failed"));
-}
-
-G_MODULE_EXPORT void
-action_paste_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_paste(e);
-}
-
-G_MODULE_EXPORT void
-action_delete_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-}
-
-G_MODULE_EXPORT void
-action_delete_item_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	if (e->studypad)
-		return;
-
-	gchar *buf = 
-		g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s?</span>",
-				_("Are you sure you want to delete the note for"), e->key);
-
-	if (gui_yes_no_dialog(buf,
-#if GTK_CHECK_VERSION(3, 10, 0)
-			      "dialog-warning"
-#else
-			      GTK_STOCK_DIALOG_WARNING
-#endif
-			      )) {
-
-		main_delete_note(e->module, e->key);
-
-		/* new empty document from template */
-		gchar *fname = g_build_filename(settings.gSwordDir, "studypad.spt", NULL);
-		XI_message(("action delete item [%s]", fname));
-		gchar *text = inhale_text_from_file(fname);
-		g_free(fname);
-
-		if (text && strlen(text)) {
-			webkit_web_view_load_string((WebKitWebView *)
-						    e->html_widget,
-						    text,
-						    "text/html", "utf_8",
-						    "file://");
-		}
-		if (text)
-			g_free(text);
-	}
-
-	g_free(buf);
-	e->is_changed = FALSE;
-}
-
-void set_button_state(BUTTONS_STATE state, EDITOR *e)
-{
-#if GTK_CHECK_VERSION(3, 4, 0)
-	GdkRGBA rgba;
-#else
-	GdkColor color;
-#endif
-	gtk_toggle_tool_button_set_active(e->toolitems.bold, state.bold);
-	gtk_toggle_tool_button_set_active(e->toolitems.italic, state.italic);
-	gtk_toggle_tool_button_set_active(e->toolitems.underline, state.underline);
-	gtk_toggle_tool_button_set_active(e->toolitems.strike, state.strike);
-	gtk_combo_box_set_active((GtkComboBox *)e->toolitems.cb, state.style);
-
-	if (state.color) {
-		XI_message(("state.color: %s", state.color));
-#if GTK_CHECK_VERSION(3, 4, 0)
-		if (gdk_rgba_parse(&rgba, state.color))
-			gtk_color_chooser_set_rgba((GtkColorChooser *)
-						   e->toolitems.color,
-						   &rgba);
-#else
-		if (gdk_color_parse(state.color, &color))
-			gtk_color_button_set_color((GtkColorButton *)
-						   e->toolitems.color,
-						   &color);
-#endif
-	}
-}
-
-G_MODULE_EXPORT void
-colorbutton1_color_set_cb(GtkColorButton *widget, EDITOR *e)
-{
-#if GTK_CHECK_VERSION(3, 4, 0)
-	GdkRGBA color;
-#else
-	GdkColor color;
-#endif
-	gchar *color_str;
-	gchar *forecolor = NULL;
-
-#if GTK_CHECK_VERSION(3, 4, 0)
-	gtk_color_chooser_get_rgba((GtkColorChooser *)widget, &color);
-	color_str = gdk_rgba_to_string(&color);
-#else
-	gtk_color_button_get_color((GtkColorButton *)widget, &color);
-	/* FIXME: ugly need something better */
-	color_str = g_strdup_printf("rgb(%u,%u,%u)", color.red >> 8, color.green >> 8, color.blue >> 8);
-#endif
-	forecolor = g_strdup_printf("document.execCommand('forecolor', null, '%s');", color_str);
-	editor_execute_script(forecolor, e);
-	g_free(forecolor);
-	g_free(color_str);
-}
-
-G_MODULE_EXPORT void
-colorbutton_highlight_color_set_cb(GtkColorButton *widget, EDITOR *e)
-{
-
-#if GTK_CHECK_VERSION(3, 4, 0)
-	GdkRGBA color;
-#else
-	GdkColor color;
-#endif
-	gchar *color_str;
-	gchar *highlightcolor = NULL;
-
-#if GTK_CHECK_VERSION(3, 4, 0)
-	gtk_color_chooser_get_rgba((GtkColorChooser *)widget, &color);
-	color_str = gdk_rgba_to_string(&color);
-#else
-	gtk_color_button_get_color((GtkColorButton *)widget, &color);
-	/* FIXME: ugly need something better */
-	color_str = g_strdup_printf("rgb(%u,%u,%u)", color.red >> 8, color.green >> 8, color.blue >> 8);
-#endif
-	highlightcolor = g_strdup_printf("document.execCommand('backColor', null, '%s');", color_str);
-	editor_execute_script(highlightcolor, e);
-	g_free(highlightcolor);
-	g_free(color_str);
-}
-
-static gchar *get_font_size_from_name(GString *fontname)
-{
-	gchar buf[80];
-	gint len, i = 0, j = 0;
-
-	len = fontname->len;
-	XI_message(("\nlength: %d\n", len));
-	for (i = 0; (i < 79 && i < len); i++) {
-		if (isdigit(fontname->str[i])) {
-			XI_message(("\n\nfontname->str[i]: %c",
-				    fontname->str[i]));
-			buf[j] = fontname->str[i];
-			buf[j + 1] = '\0';
-			j++;
-		}
-	}
-	return g_strdup(buf);
-}
-
-G_MODULE_EXPORT void
-action_font_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	GtkWidget *dialog;
-	gchar *selected_text = NULL;
-	gchar *size = NULL;
-#if GTK_CHECK_VERSION(3, 2, 0)
-	dialog = gtk_font_chooser_dialog_new("Select font", NULL);
-	gtk_font_chooser_set_font((GtkFontChooser *)dialog,
-#else
-	dialog = gtk_font_selection_dialog_new("Select font");
-	gtk_font_selection_dialog_set_font_name((GtkFontSelectionDialog *)
-						dialog,
-#endif
-				  "Droid Sans 14");
-
-	if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
-#if GTK_CHECK_VERSION(3, 2, 0)
-		const gchar *fontname = gtk_font_chooser_get_font((GtkFontChooser *)dialog);
-#else
-		const gchar *fontname = gtk_font_selection_dialog_get_font_name((GtkFontSelectionDialog *)dialog);
-#endif
-		GString *name = g_string_new(fontname);
-		size = get_font_size_from_name(name);
-		g_string_free(name, TRUE);
-
-		selected_text = editor_get_selected_text(e);
-#if GTK_CHECK_VERSION(3, 2, 0)
-		PangoFontDescription *font_description =
-			gtk_font_chooser_get_font_desc((GtkFontChooser *)
-						       dialog);
-		fontname = pango_font_description_get_family(font_description);
-#else
-		PangoFontDescription *font_description =
-			pango_font_description_from_string(fontname);
-		fontname = pango_font_description_get_family(font_description);
-#endif
-
-		gchar *script = g_strdup_printf("<SPAN STYLE=\"font-family:%s;font-size:%spx;\">%s</SPAN>",
-						fontname, size, selected_text);
-
-		editor_insert_html(script, e);
-		g_free(script);
-	}
-	if (size)
-		g_free(size);
-	if (selected_text)
-		g_free(selected_text);
-	gtk_widget_destroy(dialog);
-}
-
-G_MODULE_EXPORT void
-find_replace_response_cb(GtkDialog *dialog, gint response_id, EDITOR *e)
-{
-	switch (response_id) {
-	case GTK_RESPONSE_CANCEL:
-		gtk_widget_hide(find_dialog.window);
-		break;
-	case 1:
-		editor_find_string((gchar *)
-				   gtk_entry_get_text(GTK_ENTRY(find_dialog.find_entry)),
-				   e);
-		break;
-	case 2:
-		editor_replace_string((gchar *)
-				      gtk_entry_get_text(GTK_ENTRY(find_dialog.find_entry)),
-				      (gchar *)
-				      gtk_entry_get_text(GTK_ENTRY(find_dialog.replace_entry)),
-				      e);
-		break;
-	default:
-		gtk_widget_hide(find_dialog.window);
-		break;
-	}
-}
-
-G_MODULE_EXPORT void
-action_find_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	gtk_widget_show(find_dialog.window);
-	gtk_widget_hide(find_dialog.box_replace);
-	gtk_widget_hide(find_dialog.button_replace);
-}
-
-G_MODULE_EXPORT void
-action_replace_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	gtk_widget_show(find_dialog.window);
-	gtk_widget_show(find_dialog.box_replace);
-	gtk_widget_show(find_dialog.button_replace);
-}
-
-static void handle_error(GError **error)
-{
-	if (*error != NULL) {
-		g_warning("%s", (*error)->message);
-		g_clear_error(error);
-	}
-}
-
-static void do_exit(EDITOR *e)
-{
-	if (e->filename) {
-		g_free(e->filename);
-	}
-	if (e->module) {
-		g_free(e->module);
-	}
-	if (e->key) {
-		g_free(e->key);
-	}
-	if (e->window)
-		gtk_widget_destroy(e->window);
-	g_free(e);
-}
-
-static void recent_item_cb(GtkRecentChooser *chooser, EDITOR *e)
-{
-	gchar *file_uri = gtk_recent_chooser_get_current_uri(chooser);
-
-	XI_message(("file_uri: %s", file_uri));
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = g_strdup(file_uri);
-
-	//editor_open_recent (file_uri, e);
-	_load_file(e, file_uri);
-	xml_set_value("Xiphos", "studypad", "lastfile", e->filename);
-	settings.studypadfilename = xml_get_value("studypad", "lastfile");
-
-	change_window_title(e->window, e->filename);
-}
-
-static void change_window_title(GtkWidget *window, const gchar *window_title)
-{
-	gtk_window_set_title(GTK_WINDOW(window), window_title);
-}
-
-static GtkPrintOperationResult
-print(WebKitWebView *html, GtkPrintOperationAction action)
-{
-	GtkPrintOperation *operation;
-	GtkPrintOperationResult result;
-	GError *error = NULL;
-	WebKitWebFrame *frame;
-
-	frame = webkit_web_view_get_main_frame(html);
-	operation = gtk_print_operation_new();
-
-	result = webkit_web_frame_print_full(frame, operation, action, &error);
-
-	g_object_unref(operation);
-	handle_error(&error);
-
-	return result;
-}
-
-static gint open_dialog(EDITOR *e)
-{
-	GtkWidget *dialog;
-	gint response;
-
-	dialog = gtk_file_chooser_dialog_new(_("Open"), GTK_WINDOW(e->window),
-					     GTK_FILE_CHOOSER_ACTION_OPEN,
-#if GTK_CHECK_VERSION(3, 10, 0)
-					     "_Cancel", GTK_RESPONSE_CANCEL,
-					     "_Open", GTK_RESPONSE_ACCEPT,
-#else
-					     GTK_STOCK_CANCEL,
-					     GTK_RESPONSE_CANCEL,
-					     GTK_STOCK_OPEN,
-					     GTK_RESPONSE_ACCEPT,
-#endif
-					     NULL);
-
-	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), settings.studypaddir);
-
-	response = gtk_dialog_run(GTK_DIALOG(dialog));
-
-	if (response == GTK_RESPONSE_ACCEPT) {
-		gchar *new_filename;
-
-		new_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-		_load_file(e, new_filename);
-		g_free(new_filename);
-	}
-
-	gtk_widget_destroy(dialog);
-
-	return response;
-}
-
-G_MODULE_EXPORT void action_print_cb(GtkAction *action, EDITOR *e)
-{
-	print(WEBKIT_WEB_VIEW(e->html_widget),
-	      GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG);
-}
-
-G_MODULE_EXPORT void action_print_preview_cb(GtkAction *action, EDITOR *e)
-{
-	print(WEBKIT_WEB_VIEW(e->html_widget),
-	      GTK_PRINT_OPERATION_ACTION_PREVIEW);
-}
-
-G_MODULE_EXPORT void action_quit_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	delete_event(NULL, NULL, e);
-}
-
-G_MODULE_EXPORT void action_open_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	open_dialog(e);
-}
-
-G_MODULE_EXPORT void action_save_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	switch (e->type) {
-	case STUDYPAD_EDITOR:
-		_save_file(e);
-		break;
-	case NOTE_EDITOR:
-		_save_note(e);
-		break;
-	case BOOK_EDITOR:
-		_save_book(e);
-		break;
-	default:
-		XI_message(("\naction_save_cb oops!\n"));
-		break;
-	}
-}
-
-G_MODULE_EXPORT void action_new_activate_cb(GtkWidget *widget, EDITOR *e)
-{ /* for studypad only */
-	gchar *filename = NULL;
-
-	if (e->is_changed)
-		ask_about_saving(e);
-
-	filename = g_strdup_printf("%s/%s", settings.gSwordDir, "studypad.spt");
-
-	_load_file(e, filename);
-
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = g_strdup(_("Untitled document"));
-
-	xml_set_value("Xiphos", "studypad", "lastfile", e->filename);
-	settings.studypadfilename = xml_get_value("studypad", "lastfile");
-	change_window_title(e->window, e->filename);
-	e->is_changed = TRUE;
-}
-
-G_MODULE_EXPORT void
-action_insert_sword_link_activate_cb(GtkWidget *widget, gpointer data)
-{
-	editor_link_dialog(data); //editor_insert_sword_link();
-}
-
-G_MODULE_EXPORT void
-action_insert_link_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	editor_link_dialog(e);
-}
-
-G_MODULE_EXPORT void
-action_save_as_activate_cb(GtkWidget *widget, EDITOR *e)
-{
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = NULL;
-	_save_file(e);
-}
-
-G_MODULE_EXPORT void combo_box_changed_cb(GtkComboBox *widget, EDITOR *e)
-{
-	gchar *script = NULL;
-	gint choice = gtk_combo_box_get_active(widget);
-	/* we need the line of text where the cursor is */
-	//extern BUTTONS_STATE buttons_state;
-
-	if (buttons_state.nochange)
-		return;
-
-	switch (choice) {
-	case 0: /* Normal  */
-		script = "document.execCommand('formatBlock', false, \"div\");";
-		break;
-
-	case 1: /* H1  */
-		script = "document.execCommand('formatBlock', null, \"H1\");";
-		break;
-
-	case 2: /* H2 */
-		script = "document.execCommand('formatBlock', null, \"H2\");";
-		break;
-
-	case 3: /* H3  */
-		script = "document.execCommand('formatBlock', null, \"H3\");";
-		break;
-
-	case 4: /* H4  */
-		script = "document.execCommand('formatBlock', null, \"H4\");";
-		break;
-
-	case 5: /* H5 */
-		script = "document.execCommand('formatBlock', null, \"H5\");";
-		break;
-
-	case 6: /* H6  */
-		script = "document.execCommand('formatBlock', null, \"H6\");";
-		break;
-
-	case 7: /* Address  */
-		script = "document.execCommand('formatBlock', null, \"ADDRESS\");";
-		break;
-
-	case 8: /* Preformatted  */
-		script = "document.execCommand('formatBlock', null, \"PRE\");";
-		break;
-
-	case 9: /* Bulleted List  insertUnorderedList */
-		script = "document.execCommand('insertUnorderedList', null, \"\");";
-		break;
-
-	case 10: /* Roman Numeral List  */
-		script = "document.execCommand('insertHTML', null, \"<OL type=I><LI> </LI></OL> \");";
-		break;
-
-	case 11: /* Numbered List  insertOrderedList */
-		script = "document.execCommand('insertOrderedList', null, \"\");";
-		break;
-
-	case 12: /* Alphabetical List  */
-		script = "document.execCommand('insertHTML', null, \"<OL type=A><LI> </LI></OL> \");";
-		break;
-
-	default:
-		break;
-	}
-
-	if (script) {
-		XI_message(("%s", script));
-		editor_execute_script(script, e);
-	}
-}
-
-/* need note toolbars when type is note */
-static GtkWidget *editor_new(const gchar *title, EDITOR *e)
-{
-	GtkWidget *window;
-	GtkWidget *scrollwindow;
-	GtkWidget *statusbar;
-	GtkBuilder *builder;
-	gchar *gbuilder_file;
-	GError *error = NULL;
-	GtkMenuItem *item;
-	GtkWidget *recent_item;
-
-	buttons_state.nochange = 1;
-
-	gbuilder_file = gui_general_user_file(
-#ifdef USE_GTK_3
-	    "gtk_webedit.ui"
-#else
-	    "gtk2_webedit.ui"
-#endif
-	    ,
-	    FALSE);
-	builder = gtk_builder_new();
-
-	if (!gtk_builder_add_from_file(builder, gbuilder_file, &error)) {
-		g_warning("Couldn't load builder file: %s",
-			  error->message);
-		g_error_free(error);
-	}
-
-	window = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
-	e->window = window;
-	gtk_window_set_title(GTK_WINDOW(window), title);
-
-	statusbar = GTK_WIDGET(gtk_builder_get_object(builder, "statusbar1"));
-	gtk_widget_hide(statusbar);
-
-	e->toolitems.outline_level = 0;
-	e->toolitems.bold = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_bold"));
-	e->toolitems.italic = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_italic"));
-	e->toolitems.underline = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbuttonunderline"));
-	e->toolitems.strike = GTK_TOGGLE_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_strikethrough"));
-	e->toolitems.open = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_open"));
-	e->toolitems.newdoc = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_new"));
-	e->toolitems.deletedoc = GTK_TOOL_BUTTON(gtk_builder_get_object(builder, "toolbutton_delete"));
-	e->toolitems.color = GTK_COLOR_BUTTON(gtk_builder_get_object(builder, "colorbutton1"));
-	e->toolitems.cb = GTK_COMBO_BOX_TEXT(gtk_builder_get_object(builder, "comboboxtext1"));
-
-	gtk_combo_box_set_active((GtkComboBox *)e->toolitems.cb, 0);
-
-	item = GTK_MENU_ITEM(gtk_builder_get_object(builder, "menuitem_recent"));
-
-	switch (e->type) {
-	case STUDYPAD_EDITOR:
-		gtk_widget_hide(GTK_WIDGET(e->toolitems.deletedoc));
-
-		recent_item = gtk_recent_chooser_menu_new();
-		g_signal_connect(G_OBJECT(recent_item), "item-activated",
-				 G_CALLBACK(recent_item_cb), e);
-		gtk_menu_item_set_submenu(item, recent_item);
-		break;
-	case NOTE_EDITOR:
-		gtk_widget_hide(GTK_WIDGET(e->toolitems.open));
-		gtk_widget_hide(GTK_WIDGET(e->toolitems.newdoc));
-		gtk_widget_hide(GTK_WIDGET(item));
-		break;
-	case BOOK_EDITOR:
-		gtk_widget_hide(GTK_WIDGET(e->toolitems.open));
-		gtk_widget_hide(GTK_WIDGET(e->toolitems.newdoc));
-		gtk_widget_hide(GTK_WIDGET(item));
-		break;
-	}
-
-	e->navbar_box = GTK_WIDGET(gtk_builder_get_object(builder, "box_navbar"));
-	e->box = GTK_WIDGET(gtk_builder_get_object(builder, "vbox1"));
-
-	scrollwindow = GTK_WIDGET(gtk_builder_get_object(builder, "scrolledwindow1"));
-	create_editor_window(scrollwindow, e);
-	e->is_changed = FALSE;
-
-	/* This is important */
-	gtk_builder_connect_signals(builder, (EDITOR *)e);
-
-	find_dialog.window = GTK_WIDGET(gtk_builder_get_object(builder, "dialog_find_replace"));
-	find_dialog.find_entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry1"));
-	find_dialog.replace_entry = GTK_WIDGET(gtk_builder_get_object(builder, "entry2"));
-	find_dialog.box_replace = GTK_WIDGET(gtk_builder_get_object(builder, "box4"));
-	find_dialog.button_replace = GTK_WIDGET(gtk_builder_get_object(builder, "button_replace"));
-
-	g_object_unref(builder);
-
-	return window;
-}
-
-static void _save_note(EDITOR *e)
-{
-	GString *data = g_string_new("");
-
-	editor_get_document_content(data, e);
-	main_save_note(e->module, e->key, data->str);
-	e->is_changed = FALSE;
-	g_string_free(data, TRUE);
-}
-
-static void _save_book(EDITOR *e)
-{
-	GString *data = g_string_new("");
-
-	editor_get_document_content(data, e);
-	main_treekey_save_book_text(e->module, e->key, data->str);
-	e->is_changed = FALSE;
-	g_string_free(data, TRUE);
-}
-
-static void _save_file(EDITOR *e)
-{
-	GtkRecentManager *rm = NULL;
-	GString *data = g_string_new("");
-
-	editor_get_document_content(data, e);
-	XI_message(("%s", data->str));
-
-	if (!e->filename || (0 == g_strcmp0("Untitled document", e->filename)) || g_strrstr(e->filename, ".spt")) {
-		GtkWidget *dialog = gtk_file_chooser_dialog_new("Save as",		      //const gchar *title,
-								NULL,			      //GtkWindow *parent,
-								GTK_FILE_CHOOSER_ACTION_SAVE, //GtkFileChooserAction action,
-#if GTK_CHECK_VERSION(3, 10, 0)
-								"_OK",
-								GTK_RESPONSE_OK,
-								"_Cancel",
-								GTK_RESPONSE_CANCEL,
-#else
-								GTK_STOCK_OK,
-								GTK_RESPONSE_OK,
-								GTK_STOCK_CANCEL,
-								GTK_RESPONSE_CANCEL,
-#endif
-								NULL);
-		gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
-
-		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog),
-						    settings.studypaddir);
-		if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) {
-			gchar *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-			e->filename = g_strdup(filename);
-			GFile *gfile = g_file_parse_name(filename);
-			g_file_replace_contents(gfile, data->str, data->len, NULL, TRUE, G_FILE_CREATE_NONE, NULL, NULL, NULL); //GError **error
-		}
-		change_window_title(e->window, e->filename);
-		gtk_widget_destroy(dialog);
-
-	} else {
-
-		GFile *gfile = g_file_parse_name(e->filename);
-		g_file_replace_contents(gfile, data->str, data->len, NULL, TRUE, G_FILE_CREATE_NONE, NULL, NULL, NULL); //GError **error
-	}
-
-	rm = gtk_recent_manager_get_default();
-	gtk_recent_manager_add_item(rm, e->filename);
-
-	e->is_changed = FALSE;
-	g_string_free(data, TRUE);
-}
-
-static void _load_file(EDITOR *e, const gchar *filename)
-{
-	char *text = NULL;
-	GtkRecentManager *rm = NULL;
-
-	rm = gtk_recent_manager_get_default();
-	gtk_recent_manager_add_item(rm, filename);
-
-	if (e->filename)
-		g_free(e->filename);
-	e->filename = g_strdup(filename);
-
-	XI_message(("_load_file filename: %s", filename));
-
-	xml_set_value("Xiphos", "studypad", "lastfile", e->filename);
-	settings.studypadfilename = xml_get_value("studypad", "lastfile");
-
-	change_window_title(e->window, e->filename);
-	text = inhale_text_from_file(!strncmp(filename, "file:", 5)
-					 ? filename + 5
-					 : filename);
-
-	XI_message(("web view load string [%s]", text));
-	webkit_web_view_load_string(WEBKIT_WEB_VIEW(e->html_widget),
-				    text, "text/html", "utf_8", "file://");
-
-	g_free(text);
-	e->is_changed = FALSE;
-}
-
-gboolean editor_is_dirty(EDITOR *e)
-{
-	return e->is_changed;
-}
-
-void editor_save_book(EDITOR *e)
-{
-	if (editor_is_dirty(e))
-		_save_book(e);
-}
-
-/* save if needed is done in treeky-editor.c before calling editor_load_book() */
-void editor_load_book(EDITOR *e)
-{
-	gchar *title = NULL, *text = NULL;
-
-	if (!g_ascii_isdigit(e->key[0]))
-		return; /* make sure is a number (offset) */
-
-	XI_message(("book: %s\noffset :%s", e->module, e->key));
-
-	if (atol(e->key) != 0)
-		text = main_get_book_raw_text(e->module, e->key);
-	else
-		text = g_strdup(e->module);
-
-	if ((text == NULL) || strlen(text) == 0) {
-		if (text)
-			g_free(text);
-
-		/* new empty document from template */
-		gchar *fname = g_build_filename(settings.gSwordDir, "studypad.spt", NULL);
-		XI_message(("editor load BOOK [%s]", fname));
-		text = inhale_text_from_file(fname);
-		g_free(fname);
-	}
-
-	if (text && strlen(text)) {
-		webkit_web_view_load_string((WebKitWebView *)
-					    e->html_widget,
-					    text,
-					    "text/html", "utf_8",
-					    "file://");
-	}
-
-	if (text)
-		g_free(text);
-
-	title = g_strdup_printf("%s", e->module);
-	change_window_title(e->window, title);
-	g_free(title);
-
-	e->is_changed = FALSE;
-}
-
-/******************************************************************************
- * Name
- *   editor_sync_with_main
- *
- * Synopsis
- *   #include "editor/webkit_editor.h"
- *
- *   void editor_sync_with_main(void)
- *
- * Description
- *
- *
- * Return value
- *   void
- */
-
-void editor_sync_with_main(void)
-{
-	GList *tmp = NULL;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		EDITOR *e = (EDITOR *)tmp->data;
-
-		switch (e->type) {
-		case STUDYPAD_EDITOR:
-		case BOOK_EDITOR:
-			break;
-		case NOTE_EDITOR:
-			if (e->sync)
-				editor_load_note(e, NULL,
-						 settings.currentverse);
-			break;
-		}
-		tmp = g_list_next(tmp);
-	}
-}
-
-void
-editor_load_note(EDITOR *e, const gchar *module_name, const gchar *key)
-{
-	gchar *title = NULL, *text = NULL;
-
-	if (e->is_changed)
-		_save_note(e);
-
-	if (module_name) {
-		if (e->module)
-			g_free(e->module);
-		e->module = g_strdup(module_name);
-	}
-	if (key) {
-		if (e->key)
-			g_free(e->key);
-		e->key = g_strdup(key);
-	}
-
-	text = main_get_raw_text((gchar *)e->module, (gchar *)e->key);
-
-	if ((text == NULL) || strlen(text) == 0) {
-		if (text)
-			g_free(text);
-
-		/* new empty document from template */
-		gchar *fname = g_build_filename(settings.gSwordDir, "studypad.spt", NULL);
-		XI_message(("editor load NOTE [%s]", fname));
-		text = inhale_text_from_file(fname);
-		g_free(fname);
-	}
-
-	if (text && strlen(text)) {
-		webkit_web_view_load_string((WebKitWebView *)
-					    e->html_widget,
-					    text,
-					    "text/html", "utf_8",
-					    "file://");
-	}
-
-	e->is_changed = FALSE;
-	if (e->type == NOTE_EDITOR) {
-		e->navbar.valid_key = TRUE;
-		main_navbar_versekey_set(e->navbar, e->key);
-	}
-
-	if (text)
-		g_free(text);
-
-	title = g_strdup_printf("%s - %s", e->module, e->key);
-	change_window_title(e->window, title);
-	g_free(title);
-}
-
-G_MODULE_EXPORT int
-delete_event(GtkWidget *widget, GdkEvent *event, EDITOR *e)
-{
-	if (e->is_changed) {
-		switch (ask_about_saving(e)) {
-		case GS_YES: /* exit saving */
-			break;
-
-		case GS_NO: /* exit without saving */
-			break;
-
-		case GS_CANCEL:
-			return TRUE;
-		}
-	}
-	editors_all = g_list_remove(editors_all, e);
-	do_exit(e);
-	return FALSE;
-}
-
-gint ask_about_saving(EDITOR *e)
-{
-	gint test;
-	GS_DIALOG *info;
-	gchar *buf = NULL;
-	gchar *buf1 = NULL;
-	gchar *buf2 = NULL;
-	gchar *buf3 = NULL;
-	gint retval = FALSE;
-
-	switch (e->type) {
-	case BOOK_EDITOR:
-	case NOTE_EDITOR:
-		info = gui_new_dialog();
-		info->stock_icon =
-#if GTK_CHECK_VERSION(3, 10, 0)
-		    "dialog-warning";
-#else
-		    GTK_STOCK_DIALOG_WARNING;
-#endif
-
-		buf = g_strdup_printf("%s: %s", e->module, e->key);
-		buf1 = _("Save the changes to document");
-		buf2 = _("before closing?");
-		buf3 = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s %s</span>",
-				       buf1, buf, buf2);
-		info->label_top = buf3;
-		info->label2 = _("If you don't save, changes will be permanently lost.");
-		info->save = TRUE;
-		info->cancel = TRUE;
-		info->no_save = TRUE;
-
-		test = gui_alert_dialog(info);
-		retval = test;
-
-		if (test == GS_YES) {
-			if (e->type == NOTE_EDITOR) {
-				/* save notes and prayer lists */
-				_save_note(e);
-
-			} else {
-				/* save notes and prayer lists */
-				_save_book(e);
-			}
-		}
-		g_free(info);
-		g_free(buf);
-		g_free(buf3);
-		break;
-
-	case STUDYPAD_EDITOR:
-		info = gui_new_dialog();
-		info->stock_icon =
-#if GTK_CHECK_VERSION(3, 10, 0)
-		    "dialog-warning";
-#else
-		    GTK_STOCK_DIALOG_WARNING;
-#endif
-		if (settings.studypadfilename)
-			buf = settings.studypadfilename;
-		else
-			buf = N_("File");
-		buf1 = _("Save the changes to document");
-		buf2 = _("before closing?");
-		buf3 = g_strdup_printf("<span weight=\"bold\" size=\"larger\">%s %s %s</span>",
-				       buf1, buf, buf2);
-		info->label_top = buf3;
-		info->label2 = _("If you don't save, changes will be permanently lost.");
-		info->save = TRUE;
-		info->cancel = TRUE;
-		info->no_save = TRUE;
-
-		test = gui_alert_dialog(info);
-		retval = test;
-		if (test == GS_YES) {
-			_save_file(e);
-		}
-		g_free(info);
-		g_free(buf3);
-		break;
-	}
-	sync_windows();
-	return retval;
-}
-
-static gint _create_new(const gchar *filename, const gchar *key,
-			gint editor_type)
-{
-	EDITOR *editor;
-	GtkWidget *toolbar_nav = NULL;
-
-	editor = g_new(EDITOR, 1);
-	editor->html_widget = NULL;
-	editor->sync = FALSE;
-	editor->type = editor_type;
-
-	switch (editor_type) {
-	case STUDYPAD_EDITOR:
-		editor->studypad = TRUE;
-		editor->bookeditor = FALSE;
-		editor->noteeditor = FALSE;
-		editor->module = NULL;
-		editor->key = NULL;
-		editor->filename = NULL;
-		widgets.studypad_dialog = editor_new(_("StudyPad"), editor);
-
-		if (filename) {
-			editor->filename = g_strdup(filename);
-			_load_file(editor, g_strdup(filename));
-		}
-		break;
-	case NOTE_EDITOR:
-		editor->noteeditor = TRUE;
-		editor->bookeditor = FALSE;
-		editor->studypad = FALSE;
-		editor->filename = NULL;
-		editor->module = g_strdup(filename);
-		editor->key = g_strdup(key);
-		editor->navbar.key = NULL;
-		editor_new(_("Note Editor"), editor);
-
-		toolbar_nav = gui_navbar_versekey_editor_new(editor);
-		gtk_widget_show(toolbar_nav);
-		gtk_box_pack_start(GTK_BOX(editor->navbar_box),
-				   GTK_WIDGET(toolbar_nav), FALSE, TRUE,
-				   0);
-
-		editor_load_note(editor, NULL, NULL);
-		break;
-	case BOOK_EDITOR:
-		editor->bookeditor = TRUE;
-		editor->noteeditor = FALSE;
-		editor->studypad = FALSE;
-		editor->filename = NULL;
-		editor->module = g_strdup(filename);
-		editor->key = g_strdup(key);
-		editor_new(_("Prayer List/Journal Editor"), editor);
-
-		GtkWidget *box;
-		UI_VBOX(box, FALSE, 0);
-		gtk_widget_show(box);
-		GtkWidget *hpaned1 = UI_HPANE();
-		gtk_widget_show(hpaned1);
-		gtk_paned_pack2(GTK_PANED(hpaned1), box, TRUE, TRUE);
-
-		GtkWidget *scrollbar = gtk_scrolled_window_new(NULL, NULL);
-		gtk_widget_show(scrollbar);
-		gtk_paned_pack1(GTK_PANED(hpaned1), GTK_WIDGET(scrollbar),
-				TRUE, TRUE);
-		gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollbar),
-					       GTK_POLICY_AUTOMATIC,
-					       GTK_POLICY_AUTOMATIC);
-		gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)
-						    scrollbar,
-						    settings.shadow_type);
-
-		editor->treeview = gui_create_editor_tree(editor);
-		gtk_widget_show(editor->treeview);
-		gtk_container_add(GTK_CONTAINER(scrollbar),
-				  editor->treeview);
-		gtk_paned_set_position(GTK_PANED(hpaned1), 125);
-		gtk_tree_view_expand_all((GtkTreeView *)editor->treeview);
-// then we should expand on the item to which we've opened for edit.
-
-#if GTK_CHECK_VERSION(3, 10, 0)
-		gtk_container_add(GTK_CONTAINER(box), editor->box);
-#else
-		gtk_widget_reparent(editor->box, box);
-#endif
-
-		gtk_container_add(GTK_CONTAINER(editor->window), hpaned1);
-
-		editor_load_book(editor);
-
-		break;
-	}
-	editor->is_changed = FALSE;
-	editors_all = g_list_append(editors_all, (EDITOR *)editor);
-	return 1;
-}
-
-/******************************************************************************
- * Name
- *   editor_create_new
- *
- * Synopsis
- *   #include "editor/html-editor.h"
- *
- *   gint editor_create_new(const gchar * filename, const gchar * key, gint note)
- *
- * Description
- *   limits editors to one note editor and one studypad open at a time
- *
- * Return value
- *   gint
- */
-
-gint editor_create_new(const gchar *filename, const gchar *key,
-		       gint editor_type)
-{
-	GList *tmp = NULL;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		EDITOR *e = (EDITOR *)tmp->data;
-		switch (editor_type) {
-		case STUDYPAD_EDITOR:
-			if (e->studypad) {
-				if (editor_is_dirty(e))
-					_save_file(e);
-				if (e->filename)
-					g_free(e->filename);
-				e->filename = g_strdup(filename);
-				gtk_widget_show(e->window);
-				gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-
-				_load_file(e, g_strdup(filename));
-				return 1;
-			}
-			break;
-		case NOTE_EDITOR:
-			if (!e->noteeditor)
-				break;
-			if (editor_is_dirty(e))
-				_save_note(e);
-			if (e->module)
-				g_free(e->module);
-			e->module = g_strdup(filename);
-			if (e->key)
-				g_free(e->key);
-			e->key = g_strdup(key);
-			gtk_widget_show(e->window);
-			gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-
-			editor_load_note(e, NULL, NULL);
-
-			return 1;
-			break;
-		case BOOK_EDITOR:
-			if (!e->bookeditor)
-				break;
-			if (editor_is_dirty(e))
-				_save_book(e);
-			if (e->module)
-				g_free(e->module);
-			e->module = g_strdup(filename);
-			if (e->key)
-				g_free(e->key);
-			e->key = g_strdup(key);
-			gtk_widget_show(e->window);
-			gdk_window_raise(gtk_widget_get_parent_window(GTK_WIDGET(e->window)));
-			main_load_book_tree_in_editor(GTK_TREE_VIEW(e->treeview),
-						      e->module);
-			editor_load_book(e);
-
-			return 1;
-			break;
-		}
-		tmp = g_list_next(tmp);
-	}
-	XI_message(("filename %s, key %s",
-		    (filename ? filename : "-null-"),
-		    (key ? key : "-null-")));
-	return _create_new(filename, key, editor_type);
-}
-
-void editor_maybe_save_all(void)
-{
-	GList *tmp, *tmp2;
-
-	tmp = g_list_first(editors_all);
-	while (tmp != NULL) {
-		/* 2ndary list chaser:
-		   elements will be removed by the saver. */
-		tmp2 = g_list_next(tmp);
-
-		delete_event(NULL, NULL, (EDITOR *)tmp->data);
-		tmp = tmp2;
-	}
-}
-
-#endif /* USE_WEBKIT_EDITOR */
+// empty
diff --git a/src/editor/webkit_editor.h b/src/editor/webkit_editor.h
index 5980c91..8b1a393 100644
--- a/src/editor/webkit_editor.h
+++ b/src/editor/webkit_editor.h
@@ -1,207 +1 @@
-/*
- * Xiphos Bible Study Tool
- * webkit_editor.h - html editor using webkit 
- *
- * Copyright (C) 2005-2017 Xiphos Developer Team
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Library General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef _WEBKIT_EDITOR_H
-#define _WEBKIT_EDITOR_H
-
-#include <config.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef USE_WEBKIT_EDITOR
-
-#include <gtk/gtk.h>
-
-#include "main/navbar_versekey.h"
-
-struct _tool_items
-{
-	GtkToggleToolButton *bold;
-	GtkToggleToolButton *italic;
-	GtkToggleToolButton *underline;
-	GtkToggleToolButton *strike;
-	GtkColorButton *color;
-	GtkToolButton *newdoc;
-	GtkToolButton *open;
-	GtkToolButton *deletedoc;
-	GtkComboBoxText *cb;
-	gint outline_level;
-};
-typedef struct _tool_items TOOL_ITEMS;
-
-typedef struct _editor EDITOR;
-struct _editor
-{
-	GtkWidget *window;
-	GtkWidget *box;
-	GtkWidget *scrollwindow;
-	GtkWidget *toolbar;
-	GtkWidget *treeview;
-	GtkWidget *sync_button;
-	GtkWidget *html_widget;
-	GtkWidget *statusbar;
-	GtkWidget *navbar_box;
-	NAVBAR_VERSEKEY navbar;
-	TOOL_ITEMS toolitems;
-
-	gint type;
-
-	gboolean studypad;
-	gboolean noteeditor;
-	gboolean bookeditor;
-	gboolean is_changed;
-	gboolean sync;
-
-	gchar *filename;
-	gchar *module;
-	gchar *key;
-};
-
-enum {
-	STUDYPAD_EDITOR,
-	NOTE_EDITOR,
-	BOOK_EDITOR
-};
-
-struct _menu
-{
-	GtkWidget *menu;
-	GtkWidget *cut;
-	GtkWidget *copy;
-	GtkWidget *paste;
-	//GtkWidget *;
-};
-typedef struct _menu MENU;
-
-extern MENU popup;
-
-struct _find_dialog
-{
-	GtkWidget *window;
-	GtkWidget *find_entry;
-	GtkWidget *replace_entry;
-	GtkWidget *box_replace;
-	GtkWidget *button_replace;
-	//GtkWidget *;
-	//GtkWidget *;
-};
-typedef struct _find_dialog FIND_DIALOG;
-
-extern FIND_DIALOG find_dialog;
-
-struct _buttons_state
-{
-	gint bold;
-	gint italic;
-	gint underline;
-	gint strike;
-	gint style;
-	gint nochange;
-	gchar *color;
-};
-typedef struct _buttons_state BUTTONS_STATE;
-
-void action_about_activate_cb(GtkWidget *widget, EDITOR *e);
-
-void action_increase_indent_activate_cb(GtkWidget *widget,
-					EDITOR *e);
-void action_decrease_indent_activate_cb(GtkWidget *widget,
-					EDITOR *e);
-
-void action_insert_image_activate_cb(GtkWidget *widget,
-				     EDITOR *e);
-void action_insert_rule_activate_cb(GtkWidget *widget,
-				    EDITOR *e);
-void action_insert_table_activate_cb(GtkWidget *widget,
-				     EDITOR *e);
-void action_insert_emoticon_activate_cb(GtkWidget *widget,
-					EDITOR *e);
-void action_insert_sword_link_activate_cb(GtkWidget *widget,
-					  gpointer data);
-void action_insert_link_activate_cb(GtkWidget *widget,
-				    EDITOR *e);
-
-void action_insert_outline_activate_cb(GtkWidget *widget,
-				       EDITOR *e);
-
-void action_justify_right_activate_cb(GtkWidget *widget,
-				      EDITOR *e);
-void action_justify_left_activate_cb(GtkWidget *widget,
-				     EDITOR *e);
-void action_justify_center_activate_cb(GtkWidget *widget,
-				       EDITOR *e);
-void action_justify_full_activate_cb(GtkWidget *widget,
-				     EDITOR *e);
-
-void action_bold_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_italic_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_underline_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_strikethrough_activate_cb(GtkWidget *widget,
-				      EDITOR *e);
-
-void action_undo_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_redo_activate_cb(GtkWidget *widget, EDITOR *e);
-
-void action_cut_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_copy_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_paste_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_delete_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_delete_item_activate_cb(GtkWidget *widget,
-				    EDITOR *e);
-
-void set_button_state(BUTTONS_STATE state, EDITOR *e);
-void action_fontcolor_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_font_activate_cb(GtkWidget *widget, EDITOR *e);
-void find_replace_response_cb(GtkDialog *dialog, gint response_id,
-			      EDITOR *e);
-void action_replace_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_find_activate_cb(GtkWidget *widget, EDITOR *e);
-int delete_event(GtkWidget *widget, GdkEvent *event, EDITOR *e);
-void action_quit_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_new_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_open_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_print_cb(GtkAction *action, EDITOR *e);
-void action_print_preview_cb(GtkAction *action, EDITOR *e);
-void action_save_activate_cb(GtkWidget *widget, EDITOR *e);
-void action_save_as_activate_cb(GtkWidget *widget, EDITOR *e);
-
-void editor_sync_with_main(void);
-void editor_load_note(EDITOR *e, const gchar *module_name,
-		      const gchar *key);
-void editor_load_book(EDITOR *e);
-gint editor_create_new(const gchar *filename, const gchar *key,
-		       gint note);
-void editor_save_book(EDITOR *e);
-void editor_maybe_save_all(void);
-gint ask_about_saving(EDITOR *e);
-void colorbutton1_color_set_cb(GtkColorButton *widget,
-			       EDITOR *e);
-void colorbutton_highlight_color_set_cb(GtkColorButton *widget,
-					EDITOR *e);
-void combo_box_changed_cb(GtkComboBox *widget, EDITOR *e);
-
-#ifdef __cplusplus
-}
-#endif /* USE_WEBKIT_EDITOR */
-#endif
-#endif /* _WEBKIT_EDITOR_H */
+// empty
