File birdie-webkit2gtk4-port.patch of Package birdie

--- a/birdie.spec
+++ b/birdie.spec
@@ -12,7 +12,7 @@ BuildRequires: intltool
 BuildRequires: vala-devel >= 0.22.1
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: libpurple-devel
-BuildRequires: pkgconfig(webkitgtk-3.0)
+BuildRequires: pkgconfig(webkit2gtk-4.0)
 BuildRequires: sqlite-devel
 BuildRequires: libXtst-devel
 BuildRequires: libgee06-devel
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,7 +111,7 @@ pkg_check_modules(DEPS REQUIRED
 	libnotify
 	libcanberra
 	gdk-x11-3.0
-	webkitgtk-3.0
+	webkit2gtk-4.0
 	sqlite3
 	xtst
     purple
@@ -142,7 +142,7 @@ set(CFLAGS
 )
 
 set(BIRDIE_PACKAGES
-    gtk+-3.0 gtksourceview-3.0 libsoup-2.4 gee-1.0 rest-0.7 json-glib-1.0 libnotify>=0.7.5 libcanberra>=0.28 gdk-x11-3.0 webkitgtk-3.0 sqlite3 xtst purple posix ${EXTRA_PACKAGES}
+    gtk+-3.0 gtksourceview-3.0 libsoup-2.4 gee-1.0 rest-0.7 json-glib-1.0 libnotify>=0.7.5 libcanberra>=0.28 gdk-x11-3.0 webkit2gtk-4.0 sqlite3 xtst purple posix ${EXTRA_PACKAGES}
 )
 
 set(VALAC_OPTIONS
--- a/INSTALL
+++ b/INSTALL
@@ -10,10 +10,10 @@
 # There's an official package on the AUR: https://aur.archlinux.org/packages/birdie-git/
 
 # UBUNTU
-# sudo apt-get install cmake valac libgtk-3-dev librest-dev libjson-glib-dev libnotify-dev libcanberra-dev libx11-dev libwebkitgtk-3.0-dev libsqlite3-dev libxtst-dev libpurple-dev libgee-dev libdbusmenu-gtk-dev libgtksourceview-3.0-dev
+# sudo apt-get install cmake valac libgtk-3-dev librest-dev libjson-glib-dev libnotify-dev libcanberra-dev libx11-dev libwebkit2gtk-4.0-dev libsqlite3-dev libxtst-dev libpurple-dev libgee-dev libdbusmenu-gtk-dev libgtksourceview-3.0-dev
 
 # FEDORA
-# yum install gcc gcc-c++ cmake vala libgee06-devel rest-devel libcanberra-devel libsqlite3x-devel libXtst-devel libpurple-devel libdbusmenu-devel json-glib-devel libnotify-devel webkitgtk3-devel libwnck3-devel
+# yum install gcc gcc-c++ cmake vala libgee06-devel rest-devel libcanberra-devel libsqlite3x-devel libXtst-devel libpurple-devel libdbusmenu-devel json-glib-devel libnotify-devel webkit2gtk4-devel libwnck3-devel
 
 # -----------------------------------------------------------------------------
 # BUILDING
--- a/src/Birdie.vala
+++ b/src/Birdie.vala
@@ -698,20 +698,30 @@ namespace Birdie {
 
                     var light_window = new Widgets.LightWindow (false);
                     var web_view = new WebKit.WebView ();
-                    web_view.document_load_finished.connect (() => {
-                        web_view.execute_script ("oldtitle=document.title;document.title=document.documentElement.innerHTML;");
-                        var html = web_view.get_main_frame ().get_title ();
-                        web_view.execute_script ("document.title=oldtitle;");
-
-                        if ("<code>" in html) {
-                            var pin = html.split ("<code>");
-                            pin = pin[1].split ("</code>");
+                    web_view.get_settings ().set_enable_javascript (true);
+                    web_view.load_changed.connect ((load_event) => {
+                        if (load_event != WebKit.LoadEvent.FINISHED) {
+                            return;
+                        }
+
+                        var loop = new GLib.MainLoop ();
+                        web_view.run_javascript.begin ("oldtitle=document.title;elems=document.body.getElementsByTagName('code');(elems.length>0)?document.title=elems[0].innerHTML:document.title='null';", null, (obj, res) => {
+                            loop.quit ();
+                        });
+                        loop.run ();
+                        var pin = web_view.get_title ();
+                        web_view.run_javascript.begin ("document.title=oldtitle;", null, (obj, res) => {
+                            loop.quit ();
+                        });
+                        loop.run ();
+
+                        if (pin != "null") {
                             light_window.destroy ();
 
                             new Thread<void*> (null, () => {
                                 this.switch_timeline ("loading");
 
-                                int code = this.new_api.get_tokens (pin[0]);
+                                int code = this.new_api.get_tokens (pin);
 
                                 if (code == 0) {
                                     Idle.add (() => {
@@ -737,10 +747,8 @@ namespace Birdie {
                         this.set_widgets_sensitive (window_active);
                     });
                     web_view.load_uri (this.new_api.get_request ());
-                    var scrolled_webview = new Gtk.ScrolledWindow (null, null);
-                    scrolled_webview.add_with_viewport (web_view);
                     light_window.set_title (_("Sign in"));
-                    light_window.add (scrolled_webview);
+                    light_window.add (web_view);
                     light_window.set_transient_for (this.m_window);
                     light_window.set_modal (true);
                     light_window.set_size_request (600, 600);
--- a/src/Media/ShowMedia.vala
+++ b/src/Media/ShowMedia.vala
@@ -50,7 +50,7 @@ namespace Birdie.Media {
     public void show_youtube_video (string youtube_video_id) {
         var light_window = new Widgets.LightWindow ();
         WebKit.WebView web_view = new WebKit.WebView ();
-        web_view.load_html_string ("<iframe width='640' height='390' style='margin-left: -10px; margin-top: -10px; margin-bottom: -10px;' src='http://www.youtube.com/embed/" +
+        web_view.load_html ("<iframe width='640' height='390' style='margin-left: -10px; margin-top: -10px; margin-bottom: -10px;' src='http://www.youtube.com/embed/" +
             youtube_video_id + "?version=3&autohide=1&controls=2&modestbranding=1&showinfo=0&showsearch=0&vq=hd720&autoplay=1' frameborder='0'</iframe>", "http://www.youtube.com/embed/");
         light_window.add (web_view);
         light_window.set_position (Gtk.WindowPosition.CENTER);
Only in a/vapi: webkitgtk-3.0.vapi
openSUSE Build Service is sponsored by