$OpenBSD: patch-plugins_common_RESTSupport_vala,v 1.1 2016/01/08 10:28:42 ajacoutot Exp $

From f045b7a13cc1efbfa3054338d0edf569df51f4e7 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 17:34:17 +0100
Subject: Have all soup sessions validate TLS certificates

From a2844fbfeb23a0bf6b2489761ab5f51e15dc4efe Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@igalia.com>
Date: Fri, 4 Dec 2015 17:33:43 +0100
Subject: Don't pack webview into a scrolled window

From 3ae27fc3f41ceb7820f365244e6ae6a4dc65fcaa Mon Sep 17 00:00:00 2001
From: Iain Lane <iain@orangesquash.org.uk>
Date: Tue, 30 Jun 2015 10:43:15 +0100
Subject: Port to webkit2gtk-4.0
https://bodhi.fedoraproject.org/updates/FEDORA-2016-902a2b18d8
https://bodhi.fedoraproject.org/updates/FEDORA-2016-191ff70357
https://bugzilla.gnome.org/show_bug.cgi?id=754488
https://bugzilla.gnome.org/show_bug.cgi?id=751709

--- plugins/common/RESTSupport.vala.orig	Fri Jan  8 11:11:42 2016
+++ plugins/common/RESTSupport.vala	Fri Jan  8 11:12:07 2016
@@ -20,6 +20,7 @@ public abstract class Session {
     public Session(string? endpoint_url = null) {
         this.endpoint_url = endpoint_url;
         soup_session = new Soup.SessionAsync();
+        this.soup_session.ssl_use_system_ca_file = true;
     }
     
     protected void notify_wire_message_unqueued(Soup.Message message) {
@@ -725,7 +726,6 @@ public abstract class GooglePublisher : Object, Spit.P
         
         private WebKit.WebView webview;
         private Gtk.Box pane_widget;
-        private Gtk.ScrolledWindow webview_frame;
         private string auth_sequence_start_url;
 
         public signal void authorized(string auth_code);
@@ -735,26 +735,20 @@ public abstract class GooglePublisher : Object, Spit.P
 
             pane_widget = new Gtk.Box(Gtk.Orientation.VERTICAL, 0);
 
-            webview_frame = new Gtk.ScrolledWindow(null, null);
-            webview_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN);
-            webview_frame.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-
             webview = new WebKit.WebView();
             webview.get_settings().enable_plugins = false;
-            webview.get_settings().enable_default_context_menu = false;
 
-            webview.load_finished.connect(on_page_load);
-            webview.load_started.connect(on_load_started);
+            webview.load_changed.connect(on_page_load_changed);
+            webview.context_menu.connect(() => { return false; });
 
-            webview_frame.add(webview);
-            pane_widget.pack_start(webview_frame, true, true, 0);
+            pane_widget.pack_start(webview, true, true, 0);
         }
         
         public static bool is_cache_dirty() {
             return cache_dirty;
         }
         
-        private void on_page_load(WebKit.WebFrame origin_frame) {
+        private void on_page_load() {
             pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.LEFT_PTR));
             
             string page_title = webview.get_title();
@@ -772,9 +766,22 @@ public abstract class GooglePublisher : Object, Spit.P
             }
         }
 
-        private void on_load_started(WebKit.WebFrame frame) {
+        private void on_load_started() {
             pane_widget.get_window().set_cursor(new Gdk.Cursor(Gdk.CursorType.WATCH));
         }
+
+        private void on_page_load_changed (WebKit.LoadEvent load_event) {
+            switch (load_event) {
+                case WebKit.LoadEvent.STARTED:
+                    on_load_started();
+                    break;
+                case WebKit.LoadEvent.FINISHED:
+                    on_page_load();
+                    break;
+            }
+
+            return;
+        }
         
         public Spit.Publishing.DialogPane.GeometryOptions get_preferred_geometry() {
             return Spit.Publishing.DialogPane.GeometryOptions.NONE;
@@ -785,7 +792,7 @@ public abstract class GooglePublisher : Object, Spit.P
         }
 
         public void on_pane_installed() {
-            webview.open(auth_sequence_start_url);
+            webview.load_uri(auth_sequence_start_url);
         }
 
         public void on_pane_uninstalled() {
