<commit_before>///* /home/eosten/Summa/Summa/WebKitView.cs
// *
// * Copyright (C) 2008  <NAME>
// *
// * This library is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Lesser General Public License as published by
// * the Free Software Foundation, either version 2.1 of the License, or
// * (at your option) any later version.
// *
// * This library 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 Lesser General Public License for more details.
// *
// * You should have received a copy of the GNU Lesser General Public License
// * along with this library.  If not, see <http://www.gnu.org/licenses/>.
// *
// * Author:
// *     <NAME> <<EMAIL>>
// */
//

using System;
using Gtk;
using NewsKit;
using WebKit;

namespace Summa {
    public class WebKitView : WebKit.WebView {
        private int start_size;            
        
        public WebKitView() {
            start_size = 10;
            
            string starting_content = "Welcome to <b>Summa</b>, a GNOME feed reader.</b><br /><br />This is a preview release, not intended to be used by anyone. Exercise caution.";            
            Render(starting_content);
        }
        
        public bool CanZoom() {
            return false;
        }
        
        public void ZoomIn() {
            WebSettings settings = new WebKit.WebSettings();
            
            if ( start_size > 4 ) {
                start_size++;
                /*settings.DefaultFontSize = start_size;*/
                
                Settings = settings;
            }
        }
        
        public void ZoomOut() {
            WebSettings settings = new WebKit.WebSettings();
            
            if ( start_size-1 > 4 ) {
                start_size--;
                /*settings.DefaultFontSize = start_size;*/
                
                Settings = settings;
            }
        }
        
        public bool CanPrint() {
            return false;
        }
        
        public void Print() {
        }
        
        public bool CanGoBackOrForward() {
            return false;
        }

        public bool CanCutClipboard() {
            return false;
        }

        public void Render(string data) {
            LoadString(data, "text/html", "utf-8", "http:///");

        //     NavigationRequested += OnLinkClicked();
        // }
        
        // private void OnLinkClicked(WebView view, WebFrame frame, NetworkRequest request) {
        //     // get uri
        //     // launch externally
        //     Console.WriteLine ("Not implemented");
        }

        public void Render(NewsKit.Item item) {
            string content = "<b>"+item.Title+"</b>";<commit_msg>Initial, and broken, support for not opening links in the WebView(). Currently causes crashers.<commit_after>///* /home/eosten/Summa/Summa/WebKitView.cs
// *
// * Copyright (C) 2008  <NAME>
// *
// * This library is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Lesser General Public License as published by
// * the Free Software Foundation, either version 2.1 of the License, or
// * (at your option) any later version.
// *
// * This library 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 Lesser General Public License for more details.
// *
// * You should have received a copy of the GNU Lesser General Public License
// * along with this library.  If not, see <http://www.gnu.org/licenses/>.
// *
// * Author:
// *     <NAME> <<EMAIL>>
// */
//

using System;
using Gtk;
using NewsKit;
using WebKit;

namespace Summa {
    public class WebKitView : WebKit.WebView {
        private int start_size;            
        
        public WebKitView() {
            start_size = 10;

            NavigationRequested += new NavigationRequestedHandler (OnLinkClicked);
            
            string starting_content = "Welcome to <b>Summa</b>, a GNOME feed reader.</b><br /><br />This is a preview release, not intended to be used by anyone. Exercise caution.";            
            Render(starting_content);
        }
        
        public bool CanZoom() {
            return false;
        }
        
        public void ZoomIn() {
            WebSettings settings = new WebKit.WebSettings();
            
            if ( start_size > 4 ) {
                start_size++;
                /*settings.DefaultFontSize = start_size;*/
                
                Settings = settings;
            }
        }
        
        public void ZoomOut() {
            WebSettings settings = new WebKit.WebSettings();
            
            if ( start_size-1 > 4 ) {
                start_size--;
                /*settings.DefaultFontSize = start_size;*/
                
                Settings = settings;
            }
        }
        
        public bool CanPrint() {
            return false;
        }
        
        public void Print() {
        }
        
        public bool CanGoBackOrForward() {
            return false;
        }

        public bool CanCutClipboard() {
            return false;
        }

        public void Render(string data) {
            LoadString(data, "text/html", "utf-8", "http:///");
        }
        
        private void OnLinkClicked(object o, NavigationRequestedArgs args) {
        //     // get uri
        //     // launch externally
            Console.WriteLine ("Not implemented!");
            return;
        }

        public void Render(NewsKit.Item item) {
            string content = "<b>"+item.Title+"</b>";
{'fraction_non_alphanumeric': 0.10243651338366506, 'fraction_numerical': 0.004118050789293068, 'mean_word_length': 1.5712395235994707, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1425072', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1474, 'n_words': 497}