Hello community, here is the log from the commit of package quilter for openSUSE:Factory checked in at 2020-09-15 16:16:10 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/quilter (Old) and /work/SRC/openSUSE:Factory/.quilter.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "quilter" Tue Sep 15 16:16:10 2020 rev:30 rq:832403 version:2.5.1 Changes: -------- --- /work/SRC/openSUSE:Factory/quilter/quilter.changes 2020-08-29 20:40:36.993421694 +0200 +++ /work/SRC/openSUSE:Factory/.quilter.new.4249/quilter.changes 2020-09-15 16:16:20.893915493 +0200 @@ -1,0 +2,6 @@ +Fri Aug 28 23:10:53 UTC 2020 - Alexei Podvalsky <[email protected]> + +- Update to 2.5.1: + * Urgent Fix: Major error crashing the app while in Preview. + +------------------------------------------------------------------- Old: ---- quilter-2.5.0.tar.gz New: ---- quilter-2.5.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ quilter.spec ++++++ --- /var/tmp/diff_new_pack.7EBqBF/_old 2020-09-15 16:16:22.269916767 +0200 +++ /var/tmp/diff_new_pack.7EBqBF/_new 2020-09-15 16:16:22.269916767 +0200 @@ -17,7 +17,7 @@ Name: quilter -Version: 2.5.0 +Version: 2.5.1 Release: 0 Summary: Writing application License: GPL-3.0-only ++++++ quilter-2.5.0.tar.gz -> quilter-2.5.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/data/com.github.lainsce.quilter.appdata.xml.in new/quilter-2.5.1/data/com.github.lainsce.quilter.appdata.xml.in --- old/quilter-2.5.0/data/com.github.lainsce.quilter.appdata.xml.in 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/data/com.github.lainsce.quilter.appdata.xml.in 2020-08-25 23:17:16.000000000 +0200 @@ -55,6 +55,14 @@ <content_attribute id="money-gambling">none</content_attribute> </content_rating> <releases> + <release version="2.5.1" date="2020-08-28"> + <description> + <p>Release: Power Up Two</p> + <ul> + <li>Urgent Fix: Major error crashing the app while in Preview.</li> + </ul> + </description> + </release> <release version="2.5.0" date="2020-07-24"> <description> <p>Release: Power Up</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/data/com.github.lainsce.quilter.gschema.xml new/quilter-2.5.1/data/com.github.lainsce.quilter.gschema.xml --- old/quilter-2.5.0/data/com.github.lainsce.quilter.gschema.xml 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/data/com.github.lainsce.quilter.gschema.xml 2020-08-25 23:17:16.000000000 +0200 @@ -1,25 +1,15 @@ <schemalist> <schema id="com.github.lainsce.quilter" path="/com/github/lainsce/quilter/"> - <key name="window-x" type="i"> - <default>-1</default> - <summary>Window position</summary> - <description>The x axis of window position</description> - </key> - <key name="window-y" type="i"> - <default>-1</default> - <summary>Window position</summary> - <description>The y axis of window position</description> - </key> - <key name="window-height" type="i"> - <default>800</default> - <summary>Window position</summary> - <description>The height of the window</description> - </key> - <key name="window-width" type="i"> - <default>920</default> - <summary>Window position</summary> - <description>The width of the window</description> - </key> + <key name="window-position" type="(ii)"> + <default>(-1,-1)</default> + <summary>Window position</summary> + <description>The x axis of window position</description> + </key> + <key name="window-size" type="(ii)"> + <default>(870,690)</default> + <summary>Window position</summary> + <description>The height of the window</description> + </key> <key name="focus-mode" type="b"> <default>false</default> <summary>Focus Mode</summary> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/meson.build new/quilter-2.5.1/meson.build --- old/quilter-2.5.0/meson.build 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/meson.build 2020-08-25 23:17:16.000000000 +0200 @@ -1,4 +1,4 @@ -project('com.github.lainsce.quilter', 'vala', 'c', version: '2.2.4') +project('com.github.lainsce.quilter', 'vala', 'c', version: '2.5.1') gnome = import('gnome') i18n = import('i18n') @@ -65,4 +65,4 @@ meson.add_install_script('meson/post_install.py', join_paths(get_option('prefix'), get_option('datadir'))) subdir('data') -subdir('po') \ No newline at end of file +subdir('po') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/src/MainWindow.vala new/quilter-2.5.1/src/MainWindow.vala --- old/quilter-2.5.0/src/MainWindow.vala 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/src/MainWindow.vala 2020-08-25 23:17:16.000000000 +0200 @@ -22,6 +22,7 @@ namespace Quilter { public class MainWindow : Gtk.ApplicationWindow { + public Gtk.Adjustment eadj; public Widgets.StatusBar statusbar; public Widgets.SideBar sidebar; public Widgets.SearchBar searchbar; @@ -98,6 +99,11 @@ on_settings_changed (); + eadj = edit_view.get_vadjustment (); + eadj.notify["value"].connect (() => { + scroll_to (); + }); + Quilter.Application.gsettings.changed.connect (() => { on_settings_changed (); }); @@ -235,6 +241,14 @@ provider2.load_from_resource ("/com/github/lainsce/quilter/app-font-stylesheet.css"); Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), provider2, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION); + int window_x, window_y, width, height; + Quilter.Application.gsettings.get ("window-position", "(ii)", out window_x, out window_y); + Quilter.Application.gsettings.get ("window-size", "(ii)", out width, out height); + if (window_x != -1 || window_y != -1) { + this.move (window_x, window_y); + } + this.resize (width, height); + toolbar = new Widgets.Headerbar (this); toolbar.open.connect (on_open); toolbar.save.connect (on_save); @@ -295,9 +309,8 @@ edit_view.add (edit_view_content); preview_view = new Gtk.ScrolledWindow (null, null); - preview_view_content = new Widgets.Preview (this, edit_view_content.buffer); + preview_view_content = new Widgets.Preview (this, edit_view_content); preview_view.add (preview_view_content); - ((Gtk.Viewport) preview_view.get_child ()).set_vscroll_policy (Gtk.ScrollablePolicy.NATURAL); var preview_view_context = preview_view.get_style_context (); preview_view_context.add_class ("quilter-preview-view"); @@ -342,7 +355,6 @@ toolbar.pack_end (view_mode); paned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL); - paned.set_position (Quilter.Application.gsettings.get_int("window-width")/2); main_stack = new Gtk.Stack (); main_stack.hexpand = true; @@ -357,7 +369,7 @@ insert_action_group ("win", actions); statusbar = new Widgets.StatusBar (edit_view_content.buffer); - sidebar = new Widgets.SideBar (this); + sidebar = new Widgets.SideBar (this, edit_view_content); sidebar.save_as.connect (() => on_save_as ()); searchbar = new Widgets.SearchBar (this); @@ -399,36 +411,13 @@ add (overlay); - int x = Quilter.Application.gsettings.get_int("window-x"); - int y = Quilter.Application.gsettings.get_int("window-y"); - int w = Quilter.Application.gsettings.get_int("window-width"); - int h = Quilter.Application.gsettings.get_int("window-height"); - - if (x != -1 && y != -1) { - this.move (x, y); - } - if (w != 0 && h != 0) { - this.resize (w, h); - } - update_title (); - Gtk.Adjustment eadj = edit_view.get_vadjustment (); - Gtk.Adjustment padj = preview_view.get_vadjustment (); - eadj.value_changed.connect (() => { - scroll_to (); - }); - padj.value_changed.connect (() => { - scroll_to_fix (); - }); - padj.set_lower(1); - if (!Granite.Services.System.history_is_enabled ()) { edit_view_content.buffer.text = ""; Services.FileManager.file = null; toolbar.set_subtitle (_("No Documents Open")); sidebar.store.clear (); - sidebar.delete_row (); statusbar.readtimecount_label.set_text((_("Reading Time: ")) + "0m"); } @@ -460,14 +449,12 @@ } public override bool delete_event (Gdk.EventAny event) { - int x, y, w, h; - get_position (out x, out y); + int w, h; get_size (out w, out h); - - Quilter.Application.gsettings.set_int("window-x", x); - Quilter.Application.gsettings.set_int("window-y", y); - Quilter.Application.gsettings.set_int("window-width", w); - Quilter.Application.gsettings.set_int("window-height", h); + Quilter.Application.gsettings.set ("window-size", "(ii)", w, h); + int root_x, root_y; + this.get_position (out root_x, out root_y); + Quilter.Application.gsettings.set ("window-position", "(ii)", root_x, root_y); string[] files = {}; foreach (unowned Widgets.SideBarBox row in sidebar.get_rows ()) { @@ -489,33 +476,10 @@ } public void scroll_to () { - Gtk.Adjustment eadj = edit_view.get_vadjustment (); - Gtk.Adjustment padj = preview_view.get_vadjustment (); - var value = eadj.get_value(); - var psize_edit = eadj.get_page_size(); - var psize_prev = padj.get_page_size(); - var upper_edit = eadj.get_upper(); - var upper_prev = padj.get_upper(); - - if (value >= (upper_edit - psize_edit)) { - padj.set_value(upper_prev - psize_prev); - } else { - padj.set_value(value / upper_edit * upper_prev); - } - - padj.value_changed.connect (() => { - scroll_to_fix (); - }); - } - - public void scroll_to_fix () { - Gtk.Adjustment adj = preview_view.get_vadjustment (); - var value = adj.get_value(); - if (value == 0) { - scroll_to (); - } else { - // pass - } + Gtk.Adjustment vap = edit_view.get_vadjustment (); + var upper = vap.get_upper(); + var value = vap.get_value(); + preview_view_content.scroll_value = value/upper; } private static void widget_unparent (Gtk.Widget widget) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/src/Widgets/SideBar.vala new/quilter-2.5.1/src/Widgets/SideBar.vala --- old/quilter-2.5.0/src/Widgets/SideBar.vala 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/src/Widgets/SideBar.vala 2020-08-25 23:17:16.000000000 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2018 Lains +* Copyright (c) 2018-2020 Lains * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -28,36 +28,34 @@ public Gtk.Grid files_grid; public Gtk.Grid outline_grid; public Gtk.Stack stack; - private Gtk.StackSwitcher stackswitcher; public Gtk.TreeStore store; public Gtk.TreeView view; - public Gtk.TreeViewColumn tvc; + public Gtk.TreeSelection selection; public Gtk.CellRendererText crt; private Gtk.TreeIter root; private Gtk.TreeIter subheader; private Gtk.TreeIter section; - private Gtk.TreeIter subsection; - private Gtk.TreeIter subsubsection; - private Gtk.TreeIter paragraph; private Gtk.Label no_files; + public Gtk.StackSwitcher stackswitcher; private string[] files; public Gee.LinkedList<SideBarBox> s_files = null; public bool is_modified {get; set; default = false;} public signal void save_as (); - public signal void row_selected (Widgets.SideBarBox box); private static SideBar? instance = null; public static SideBar get_instance () { if (instance == null) { - instance = new Widgets.SideBar (Quilter.Application.win); + instance = new Widgets.SideBar (Quilter.Application.win, Quilter.Application.win.edit_view_content); } return instance; } - public SideBar (MainWindow win) { + public SideBar (MainWindow win, Widgets.EditView ev) { this.win = win; + this.ev = ev; + this.is_modified = false; var scrolled_box = new Gtk.ScrolledWindow (null, null); scrolled_box.hscrollbar_policy = Gtk.PolicyType.NEVER; @@ -67,59 +65,43 @@ no_files = new Gtk.Label (_("No files…")); no_files.halign = Gtk.Align.CENTER; var no_files_style_context = no_files.get_style_context (); - no_files_style_context.add_class ("h2"); + no_files_style_context.add_class (Granite.STYLE_CLASS_H2_LABEL); + no_files_style_context.add_class (Gtk.STYLE_CLASS_DIM_LABEL); no_files.sensitive = false; no_files.margin = 12; no_files.show_all (); stack = new Gtk.Stack (); + stack.add_titled (sidebar_files_list (), "files", _("Files").up()); + stack.add_titled (sidebar_outline (), "outline", _("Outline").up()); + + scrolled_box.add (stack); + stackswitcher = new Gtk.StackSwitcher (); - var s_context = stackswitcher.get_style_context (); - s_context.add_class ("linked"); - stackswitcher.halign = Gtk.Align.FILL; + stackswitcher.margin_start = stackswitcher.margin_end = 12; stackswitcher.homogeneous = true; - stackswitcher.margin = 0; + stackswitcher.margin_top = stackswitcher.margin_bottom = 1; + var sw_context = stackswitcher.get_style_context (); + sw_context.add_class ("quilter-sidebar-switcher"); stackswitcher.stack = stack; - stack.add_titled (sidebar_files_list (), "files", _("Files")); - stack.child_set_property (files_grid, "icon-name", "text-x-generic-symbolic"); - stack.add_titled (sidebar_outline (), "outline", _("Outline")); - stack.child_set_property (outline_grid, "icon-name", "outline-symbolic"); - - if (Quilter.Application.gsettings.get_string("visual-mode") == "dark") { - s_context.add_class ("dark-switcher"); - } else { - s_context.remove_class ("dark-switcher"); - } - Quilter.Application.gsettings.changed.connect (() => { - if (Quilter.Application.gsettings.get_string("visual-mode") == "dark") { - s_context.add_class ("dark-switcher"); - } else { - s_context.remove_class ("dark-switcher"); - } - }); - - scrolled_box.add (stack); + var main_grid = new Gtk.Grid (); + main_grid.orientation = Gtk.Orientation.VERTICAL; + main_grid.add (stackswitcher); + main_grid.add (scrolled_box); + main_grid.get_style_context ().add_class ("quilter-sidebar"); - var grid = new Gtk.Grid (); - var g_context = grid.get_style_context (); - g_context.add_class ("quilter-sidebar"); - g_context.add_class (Gtk.STYLE_CLASS_SIDEBAR); - grid.margin_top = 0; - grid.attach (stackswitcher, 0, 0, 1, 1); - grid.attach (scrolled_box, 0, 1, 1, 1); + add (main_grid); - this.add (grid); + var sb_context = this.get_style_context (); + sb_context.add_class ("quilter-sidebar"); this.transition_type = Gtk.RevealerTransitionType.SLIDE_LEFT; - this.reveal_child = Quilter.Application.gsettings.get_boolean("sidebar"); + this.reveal_child = Quilter.Application.gsettings.get_boolean ("sidebar"); } public Gtk.Widget sidebar_files_list () { - column = new Gtk.ListBox (); - column.hexpand = true; - column.vexpand = true; - column.set_size_request (280,-1); + column.expand = true; column.activate_on_single_click = true; column.selection_mode = Gtk.SelectionMode.SINGLE; column.set_sort_func (list_sort); @@ -153,58 +135,86 @@ files_grid = new Gtk.Grid (); files_grid.hexpand = false; - files_grid.set_size_request (280, -1); files_grid.attach (column, 0, 0, 1, 1); files_grid.show_all (); return files_grid; } public Gtk.Widget sidebar_outline () { - view = new Gtk.TreeView (); view.expand = true; - view.hexpand = true; view.headers_visible = false; - view.margin_top = 6; - view.set_activate_on_single_click (true); - - store = new Gtk.TreeStore (1, typeof (string)); - view.set_model (store); + view.show_expanders = false; + view.activate_on_single_click = true; crt = new Gtk.CellRendererText (); - crt.font = "Open Sans 11"; + crt.ellipsize = Pango.EllipsizeMode.END; + + view.insert_column_with_attributes (-1, "Outline", crt, "text", 0); - tvc = new Gtk.TreeViewColumn.with_attributes ("Outline", crt, "text", 0, null); - tvc.set_spacing (6); - tvc.set_sort_column_id (0); - tvc.set_sort_order (Gtk.SortType.DESCENDING); - view.append_column (tvc); + store = new Gtk.TreeStore (1, typeof (string)); + view.set_model (store); store.clear (); - view.expand_all (); outline_populate (); + view.expand_all (); + + selection = view.get_selection (); + selection.set_mode (Gtk.SelectionMode.SINGLE); + + view.button_press_event.connect ((widget, event) => { + //capture which mouse button + uint clicked_button; + event.get_button(out clicked_button); + //handle right button click for context menu + if (event.get_event_type () == Gdk.EventType.BUTTON_PRESS && clicked_button == 1){ + Gtk.TreePath path; Gtk.TreeViewColumn column; int cell_x; int cell_y; + view.get_path_at_pos ((int)event.x, (int)event.y, out path, out column, out cell_x, out cell_y); + view.grab_focus (); + view.set_cursor (path, column, false); + + selchanged (selection); + } + return false; + }); outline_grid = new Gtk.Grid (); outline_grid.hexpand = false; outline_grid.vexpand = false; - outline_grid.set_size_request (280, -1); outline_grid.attach (view, 0, 0, 1, 1); outline_grid.show_all (); return outline_grid; } + public void selchanged (Gtk.TreeSelection row) { + // Get string value from row clicked from TreeView and scroll to it in Editor + Gtk.TreeModel pathmodel; + Gtk.TreeIter pathiter; + if (row.count_selected_rows () == 1){ + row.get_selected (out pathmodel, out pathiter); + Value val; + pathmodel.get_value (pathiter, 0, out val); + + Gtk.TextIter start, end, match_start, match_end; + ev.buffer.get_bounds (out start, out end); + + bool found = start.forward_search (val.get_string (), 0, out match_start, out match_end, null); + if (found) { + ev.scroll_to_iter (match_start, 0.0, true, 0.5, 0.1); + } + } + } + public void outline_populate () { if (Quilter.Application.gsettings.get_string("current-file") != "" || Quilter.Application.gsettings.get_string("current-file") != _("No Documents Open")) { - var file = GLib.File.new_for_path (Quilter.Application.gsettings.get_string("current-file")); - - if (file != null && file.query_exists ()) { + var file = GLib.File.new_for_path (Quilter.Application.gsettings.get_string("current-file")); + if (file != null && file.query_exists ()) { try { - var reg = new Regex("(?m)^(?<header>\\#{1,6})\\s(?<text>.{0,26}\\$?)"); string buffer = ""; GLib.FileUtils.get_contents (file.get_path (), out buffer, null); GLib.MatchInfo match; - + var reg = new Regex("(?m)^(?<header>\\#{1,3})\\s(?<text>.*\\$?)"); if (reg.match (buffer, 0, out match)) { do { if (match.fetch_named ("header") == "#") { @@ -216,15 +226,6 @@ } else if (match.fetch_named ("header") == "###") { store.insert (out section, subheader, -1); store.set (section, 0, match.fetch_named ("header") + " " + match.fetch_named ("text"), -1); - } else if (match.fetch_named ("header") == "####") { - store.insert (out subsection, section, -1); - store.set (subsection, 0, match.fetch_named ("header") + " " + match.fetch_named ("text"), -1); - } else if (match.fetch_named ("header") == "#####") { - store.insert (out subsubsection, subsection, -1); - store.set (subsubsection, 0, match.fetch_named ("header") + " " + match.fetch_named ("text"), -1); - } else if (match.fetch_named ("header") == "######") { - store.insert (out paragraph, subsubsection, -1); - store.set (paragraph, 0, match.fetch_named ("header") + " " + match.fetch_named ("text"), -1); } } while (match.next ()); debug ("Outline populated"); @@ -233,13 +234,14 @@ warning ("ERR: %s", e.message); } } + } } public Gee.LinkedList<SideBarBox> get_files () { foreach (Gtk.Widget item in column.get_children ()) { if (files != null) - s_files.add ((SideBarBox)item); + s_files.add ((SideBarBox)item); } return s_files; } @@ -260,24 +262,12 @@ return filebox; } - public void delete_row () { + public void delete_rows () { foreach (Gtk.Widget item in column.get_children ()) { item.destroy (); } } - public void delete_row_with_name () { - if (get_selected_row ().path == Quilter.Application.gsettings.get_string("current-file")) { - get_selected_row ().destroy (); - } else { - foreach (Gtk.Widget item in column.get_children ()) { - if (item != get_selected_row ()) { - item.destroy (); - } - } - } - } - public int list_sort (Gtk.ListBoxRow first_row, Gtk.ListBoxRow second_row) { var row_1 = first_row; var row_2 = second_row; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/src/Widgets/SideBarBox.vala new/quilter-2.5.1/src/Widgets/SideBarBox.vala --- old/quilter-2.5.0/src/Widgets/SideBarBox.vala 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/src/Widgets/SideBarBox.vala 2020-08-25 23:17:16.000000000 +0200 @@ -92,7 +92,6 @@ file_remove_button.set_image (new Gtk.Image.from_icon_name ("close-symbolic", Gtk.IconSize.SMALL_TOOLBAR)); file_remove_button.clicked.connect (() => { - win.sidebar.delete_row_with_name (); win.edit_view_content.buffer.text = ""; win.edit_view_content.modified = false; win.toolbar.set_subtitle (_("No Documents Open")); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/quilter-2.5.0/src/Widgets/WebView.vala new/quilter-2.5.1/src/Widgets/WebView.vala --- old/quilter-2.5.0/src/Widgets/WebView.vala 2020-07-21 16:04:44.000000000 +0200 +++ new/quilter-2.5.1/src/Widgets/WebView.vala 2020-08-25 23:17:16.000000000 +0200 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017 Lains +* Copyright (c) 2017-2020 Lains * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public @@ -17,41 +17,56 @@ * Boston, MA 02110-1301 USA * */ -using WebKit; - -namespace Quilter.Widgets { - public class Preview : WebKit.WebView { +namespace Quilter { + public class Widgets.Preview : WebKit.WebView { private static Preview? instance = null; + public Widgets.EditView buf; public string html; - public Gtk.SourceBuffer buf; + public double scroll_value { + set { + run_javascript (""" + var b = document.body, + e = document.documentElement; + var height = Math.max( b.scrollHeight, + b.offsetHeight, + e.clientHeight, + e.scrollHeight, + e.offsetHeight + ); + e.scrollTop = (%.13f * e.offsetHeight); + e.scrollTop; + """.printf(value), null); + } + } public static Preview get_instance () { if (instance == null) { - instance = new Widgets.Preview (Application.win, Application.win.edit_view_content.buffer); + instance = new Widgets.Preview (Application.win, Application.win.edit_view_content); } return instance; } - public Preview (MainWindow window, Gtk.SourceBuffer buf) { - Object(user_content_manager: new UserContentManager()); - visible = true; - vexpand = true; - hexpand = true; - this.margin = 2; + public Preview (MainWindow window, Widgets.EditView buf) { + Object(user_content_manager: new WebKit.UserContentManager()); this.buf = buf; - var settingsweb = get_settings (); - settingsweb.enable_page_cache = false; - settingsweb.javascript_can_open_windows_automatically = false; + var webkit_settings = get_settings (); + webkit_settings.enable_page_cache = false; + webkit_settings.javascript_can_open_windows_automatically = false; + webkit_settings.enable_java = false; + webkit_settings.enable_mediasource = true; + webkit_settings.enable_plugins = false; + + this.scroll_value = -1; update_html_view (); connect_signals (); } protected override bool context_menu ( - ContextMenu context_menu, + WebKit.ContextMenu context_menu, Gdk.Event event, - HitTestResult hit_test_result + WebKit.HitTestResult hit_test_result ) { return true; } @@ -135,25 +150,21 @@ } private void connect_signals () { - create.connect ((navigation_action) => { - launch_browser (navigation_action.get_request().get_uri ()); - return (Gtk.Widget) null; - }); - decide_policy.connect ((decision, type) => { switch (type) { case WebKit.PolicyDecisionType.NEW_WINDOW_ACTION: if (decision is WebKit.ResponsePolicyDecision) { - launch_browser ((decision as WebKit.ResponsePolicyDecision).request.get_uri ()); + var policy = (WebKit.ResponsePolicyDecision) decision; + launch_browser (policy.request.get_uri ()); } - break; + break; case WebKit.PolicyDecisionType.RESPONSE: if (decision is WebKit.ResponsePolicyDecision) { var policy = (WebKit.ResponsePolicyDecision) decision; launch_browser (policy.request.get_uri ()); return false; } - break; + break; } return true; @@ -283,7 +294,9 @@ </head> <body> %s - %s + <div class="markdown-body"> + %s + </div> </body> </html>""".printf(style, highlight, latex, font, mermaid, md); this.load_html (html, "file:///");
