[gitg/remove-webkit] First step in replacing webkit with standard gtk+



commit fbc656699c193501772aaf1e5e0bb465081a14ae
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Tue Aug 25 18:32:27 2015 +0200

    First step in replacing webkit with standard gtk+

 Makefile.am                                        |   24 +-
 configure.ac                                       |   22 +-
 gitg/Makefile.am                                   |    4 +-
 gitg/commit/gitg-commit-dialog.vala                |    6 +-
 gitg/commit/gitg-commit.vala                       |    2 +-
 gitg/gitg-application.vala                         |    4 +-
 gitg/{gitg-resource.vala => gitg-builder.vala}     |   39 +-
 gitg/gitg-window.vala                              |    4 +-
 libgitg-ext/Makefile.am                            |    1 -
 libgitg/Makefile.am                                |   34 +-
 libgitg/gitg-avatar-cache.vala                     |   17 +-
 libgitg/gitg-diff-stat.vala                        |   83 --
 libgitg/gitg-diff-view-commit-details.vala         |  270 ++++++
 libgitg/gitg-diff-view-file.vala                   |  118 +++
 libgitg/gitg-diff-view-hunk.vala                   |  133 +++
 libgitg/gitg-diff-view-lines-renderer.vala         |  192 ++++
 libgitg/gitg-diff-view-options.vala                |   20 +-
 libgitg/gitg-diff-view-request-icon.vala           |  118 ---
 libgitg/gitg-diff-view-request-resource.vala       |  107 ---
 libgitg/gitg-diff-view-request.vala                |  215 -----
 libgitg/gitg-diff-view.vala                        |  835 +++++------------
 libgitg/gitg-init.vala                             |   11 +
 {gitg => libgitg}/gitg-resource.vala               |   39 +-
 libgitg/resources/resources.xml                    |   14 +-
 .../ui/diff-view/diff-view-html-builder.js         |  703 --------------
 libgitg/resources/ui/diff-view/diff-view.css       |  359 -------
 libgitg/resources/ui/diff-view/diff-view.html      |   63 --
 libgitg/resources/ui/diff-view/diff-view.js        |  778 ---------------
 libgitg/resources/ui/diff-view/jquery-2.0.3.min.js |    6 -
 .../resources/ui/gitg-diff-view-commit-details.ui  |  208 ++++
 libgitg/resources/ui/gitg-diff-view-file.ui        |   55 ++
 libgitg/resources/ui/gitg-diff-view-hunk.ui        |   59 ++
 ...f-view-options.ui => gitg-diff-view-options.ui} |   25 -
 libgitg/resources/ui/gitg-diff-view.ui             |   38 +
 libgitg/resources/ui/libgitg-style.css             |   76 ++
 plugins/diff/gitg-diff.vala                        |   16 -
 plugins/files/gitg-files.vala                      |   12 +-
 tests/diff-view.vala                               |   26 +-
 tests/gitg/Makefile.am                             |    1 -
 tests/libgitg/Makefile.am                          |    1 -
 vapi/gtksourceview-3.0.vapi                        |  558 ++++++++----
 vapi/webkit2gtk-3.0.deps                           |    8 -
 vapi/webkit2gtk-3.0.vapi                           |  734 --------------
 vapi/webkit2gtk-4.0.deps                           |    8 -
 vapi/webkit2gtk-4.0.vapi                           |  998 --------------------
 45 files changed, 1862 insertions(+), 5182 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index f7fb841..112df98 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -106,20 +106,16 @@ include icons.mk
 
 GITIGNOREFILES += $(gsettings_SCHEMAS)
 
-EXTRA_DIST +=                          \
-       vapi/config.vapi                \
-       vapi/gdesktop-enums-3.0.vapi    \
-       vapi/gitg-js-utils.vapi         \
-       vapi/gobject-introspection-1.0.vapi \
-       vapi/gtksourceview-3.0.deps     \
-       vapi/gtksourceview-3.0.vapi     \
-       vapi/libpeas-1.0.vapi           \
-       vapi/libsoup-2.4.deps           \
-       vapi/libsoup-2.4.vapi           \
-       vapi/webkit2gtk-3.0.deps        \
-       vapi/webkit2gtk-3.0.vapi        \
-       vapi/webkit2gtk-4.0.deps        \
-       vapi/webkit2gtk-4.0.vapi
+EXTRA_DIST +=                                  \
+       vapi/config.vapi                        \
+       vapi/gdesktop-enums-3.0.vapi            \
+       vapi/gitg-js-utils.vapi                 \
+       vapi/gobject-introspection-1.0.vapi     \
+       vapi/gtksourceview-3.0.deps             \
+       vapi/gtksourceview-3.0.vapi             \
+       vapi/libpeas-1.0.vapi                   \
+       vapi/libsoup-2.4.deps                   \
+       vapi/libsoup-2.4.vapi
 
 %.typelib: %.gir
        $(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=$(top_srcdir) -o $@ $<
diff --git a/configure.ac b/configure.ac
index a5641d3..ca23a11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,24 +85,10 @@ AC_DEFINE_UNQUOTED(GITG_LIBDIR,"$GITG_LIBDIR", [lib dir])
 
 AC_CHECK_LIB([m], [sinf])
 
-# Pick from supported API versions of WebKit2
-PKG_CHECK_EXISTS([webkit2gtk-4.0], [
-       WEBKIT_PKGCONFIG=webkit2gtk-4.0
-       WEBKIT_MAJOR_VERSION=4
-       AC_SUBST([WEBKIT_PKGCONFIG])
-       AC_SUBST([WEBKIT_MAJOR_VERSION])
-], [
-       WEBKIT_PKGCONFIG=webkit2gtk-3.0
-       WEBKIT_MAJOR_VERSION=3
-       AC_SUBST([WEBKIT_PKGCONFIG])
-       AC_SUBST([WEBKIT_MAJOR_VERSION])
-])
-
 GLIB_REQUIRED_VERSION=2.38
 GTK_REQUIRED_VERSION=3.12.0
 GTKSOURCEVIEW_REQUIRED_VERSION=3.10
 INTROSPECTION_REQUIRED=0.10.1
-WEBKITGTK_REQUIRED_VERSION=2.2
 LIBGIT2_GLIB_REQUIRED_VERSION=0.23.5
 LIBGIT2_GLIB_REQUIRED_MAX_VERSION=0.24.0
 
@@ -117,10 +103,10 @@ PKG_CHECK_MODULES(LIBGITG, [
        libgit2-glib-1.0 >= $LIBGIT2_GLIB_REQUIRED_VERSION
        libgit2-glib-1.0 < $LIBGIT2_GLIB_REQUIRED_MAX_VERSION
        gtk+-3.0 >= $GTK_REQUIRED_VERSION
-       $WEBKIT_PKGCONFIG >= WEBKITGTK_REQUIRED_VERSION
+       gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED_VERSION
        gsettings-desktop-schemas
        gee-0.8
-       json-glib-1.0
+       libsoup-2.4
        libsecret-1
 ])
 
@@ -191,8 +177,6 @@ if test "x$enable_debug" = "xyes"; then
        AC_DEFINE([ENABLE_DEBUG],[1],[Whether debugging support is enabled])
 fi
 
-LIBGITG_CFLAGS="$LIBGITG_CFLAGS -DLIBSOUP_USE_UNSTABLE_REQUEST_API"
-
 AC_SUBST(LIBGITG_CFLAGS)
 AC_SUBST(LIBGITG_LIBS)
 
@@ -280,9 +264,7 @@ GITG_PLUGIN_VALAFLAGS="                             \
        --pkg libpeas-1.0                       \
        --pkg gee-0.8                           \
        --pkg json-glib-1.0                     \
-       --pkg libsoup-2.4                       \
        --pkg libsecret-1                       \
-       --pkg $WEBKIT_PKGCONFIG                 \
        --pkg config                            \
        --pkg gd-1.0                            \
        \$(GITG_VALAFLAGS)                      \
diff --git a/gitg/Makefile.am b/gitg/Makefile.am
index 52516ca..2b2d4eb 100644
--- a/gitg/Makefile.am
+++ b/gitg/Makefile.am
@@ -24,7 +24,6 @@ gitg_gitg_VALAFLAGS =                                         \
        --pkg gobject-introspection-1.0                         \
        --pkg gee-0.8                                           \
        --pkg gd-1.0                                            \
-       --pkg $(WEBKIT_PKGCONFIG)                               \
        --pkg gtksourceview-3.0                                 \
        --pkg GtkSpell-3.0                                      \
        --girdir "$(top_builddir)/libgd"                        \
@@ -59,6 +58,7 @@ gitg_gitg_VALASOURCES =                                               \
        gitg/gitg-animated-paned.vala                           \
        gitg/gitg-application.vala                              \
        gitg/gitg-author-details-dialog.vala                    \
+       gitg/gitg-builder.vala                                  \
        gitg/gitg-clone-dialog.vala                             \
        gitg/gitg-commit-action-create-branch.vala              \
        gitg/gitg-commit-action-create-patch.vala               \
@@ -78,10 +78,10 @@ gitg_gitg_VALASOURCES =                                             \
        gitg/gitg-ref-action-delete.vala                        \
        gitg/gitg-ref-action-fetch.vala                         \
        gitg/gitg-ref-action-merge.vala                         \
+       gitg/gitg-ref-action-pull.vala                          \
        gitg/gitg-ref-action-rename.vala                        \
        gitg/gitg-remote-manager.vala                           \
        gitg/gitg-remote-notification.vala                      \
-       gitg/gitg-resource.vala                                 \
        gitg/gitg-simple-notification.vala                      \
        gitg/gitg-ui-elements.vala                              \
        gitg/gitg-window.vala                                   \
diff --git a/gitg/commit/gitg-commit-dialog.vala b/gitg/commit/gitg-commit-dialog.vala
index 1f97441..1412799 100644
--- a/gitg/commit/gitg-commit-dialog.vala
+++ b/gitg/commit/gitg-commit-dialog.vala
@@ -27,7 +27,7 @@ class Dialog : Gtk.Dialog
        private const string version = Gitg.Config.VERSION;
 
        [GtkChild (name = "source_view_message")]
-       private GtkSource.View d_source_view_message;
+       private Gtk.SourceView d_source_view_message;
 
        [GtkChild (name = "ok-button")]
        private Gtk.Button d_button_ok;
@@ -95,7 +95,7 @@ class Dialog : Gtk.Dialog
                default = 3;
        }
 
-       public GtkSource.View source_view_message
+       public Gtk.SourceView source_view_message
        {
                get { return d_source_view_message; }
        }
@@ -370,7 +370,7 @@ class Dialog : Gtk.Dialog
                        var ac = Gitg.AvatarCache.default();
                        d_cancel_avatar = new Cancellable();
 
-                       ac.load.begin(d_author.get_email(), d_cancel_avatar, (obj, res) => {
+                       ac.load.begin(d_author.get_email(), 50, d_cancel_avatar, (obj, res) => {
                                var pixbuf = ac.load.end(res);
 
                                if (d_cancel_avatar.is_cancelled())
diff --git a/gitg/commit/gitg-commit.vala b/gitg/commit/gitg-commit.vala
index 8a876ef..016263f 100644
--- a/gitg/commit/gitg-commit.vala
+++ b/gitg/commit/gitg-commit.vala
@@ -772,7 +772,7 @@ namespace GitgCommit
                                        var author = get_signature("AUTHOR");
                                        var ac = Gitg.AvatarCache.default();
 
-                                       ac.load.begin(author.get_email(), null, (obj, res) => {
+                                       ac.load.begin(author.get_email(), 50, null, (obj, res) => {
                                                ac.load.end(res);
                                        });
                                } catch {}
diff --git a/gitg/gitg-application.vala b/gitg/gitg-application.vala
index b8f7286..6aac6d4 100644
--- a/gitg/gitg-application.vala
+++ b/gitg/gitg-application.vala
@@ -253,7 +253,7 @@ public class Application : Gtk.Application
                // Create preferences dialog if needed
                if (d_preferences == null)
                {
-                       d_preferences = Resource.load_object<PreferencesDialog>("ui/gitg-preferences.ui", 
"preferences");
+                       d_preferences = Builder.load_object<PreferencesDialog>("ui/gitg-preferences.ui", 
"preferences");
 
                        d_preferences.destroy.connect((w) => {
                                d_preferences = null;
@@ -343,7 +343,7 @@ public class Application : Gtk.Application
 
                if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
                {
-                       MenuModel? menu = Resource.load_object<MenuModel>("ui/gitg-menus.ui", "app-menu");
+                       MenuModel? menu = Builder.load_object<MenuModel>("ui/gitg-menus.ui", "app-menu");
 
                        if (menu != null)
                        {
diff --git a/gitg/gitg-resource.vala b/gitg/gitg-builder.vala
similarity index 52%
copy from gitg/gitg-resource.vala
copy to gitg/gitg-builder.vala
index 581f259..aa1aa69 100644
--- a/gitg/gitg-resource.vala
+++ b/gitg/gitg-builder.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of gitg
  *
- * Copyright (C) 2012 - Jesse van den Kieboom
+ * Copyright (C) 2015 - Jesse van den Kieboom
  *
  * gitg is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,40 +17,17 @@
  * along with gitg. If not, see <http://www.gnu.org/licenses/>.
  */
 
-namespace Gitg
+class Gitg.Builder
 {
-       class Resource
+       public static T? load_object<T>(string id, string object)
        {
-               public static T? load_object<T>(string id, string object)
-               {
-                       var ret = GitgExt.UI.from_builder(id, object);
-
-                       if (ret == null)
-                       {
-                               return null;
-                       }
-
-                       return (T?)ret[object];
-               }
+               var ret = GitgExt.UI.from_builder(id, object);
 
-               public static Gtk.CssProvider? load_css(string id)
+               if (ret == null)
                {
-                       var provider = new Gtk.CssProvider();
-                       var f = File.new_for_uri("resource:///org/gnome/gitg/ui/" + id);
-
-                       try
-                       {
-                               provider.load_from_file(f);
-                       }
-                       catch (Error e)
-                       {
-                               warning("Error while loading resource: %s", e.message);
-                               return null;
-                       }
-
-                       return provider;
+                       return null;
                }
+
+               return (T?)ret[object];
        }
 }
-
-// ex: ts=4 noet
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index c6c902b..a10337c 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -222,8 +222,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
 
                d_dash_view.application = this;
 
-               d_dash_model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-dash");
-               d_activities_model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-views");
+               d_dash_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-dash");
+               d_activities_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-views");
 
                // search bar
                d_search_bar.connect_entry(d_search_entry);
diff --git a/libgitg-ext/Makefile.am b/libgitg-ext/Makefile.am
index 64617ed..81ece7d 100644
--- a/libgitg-ext/Makefile.am
+++ b/libgitg-ext/Makefile.am
@@ -17,7 +17,6 @@ libgitg_ext_libgitg_ext_1_0_la_VALAPKGS =     \
        --pkg gio-2.0                           \
        --pkg gtk+-3.0                          \
        --pkg libsoup-2.4                       \
-       --pkg $(WEBKIT_PKGCONFIG)               \
        --pkg gee-0.8
 
 libgitg_ext_libgitg_ext_1_0_la_VALAFLAGS =             \
diff --git a/libgitg/Makefile.am b/libgitg/Makefile.am
index efa6f3d..b0da4b5 100644
--- a/libgitg/Makefile.am
+++ b/libgitg/Makefile.am
@@ -21,36 +21,26 @@ libgitg_libgitg_1_0_la_LDFLAGS =    \
 libgitg_libgitg_1_0_la_LIBADD =        \
        $(LIBGITG_LIBS)
 
-GITG_GIR_IN = Gitg_in-1.0.gir
-
 libgitg_libgitg_1_0_la_VALAFLAGS =     \
        --pkg ggit-1.0                  \
        --pkg gtk+-3.0                  \
        --pkg gio-2.0                   \
-       --pkg libsoup-2.4               \
-       --pkg $(WEBKIT_PKGCONFIG)       \
        --pkg gee-0.8                   \
-       --pkg json-glib-1.0             \
        --pkg libsecret-1               \
        --pkg gio-unix-2.0              \
-       --pkg gitg-js-utils             \
        --pkg gdesktop-enums-3.0        \
+       --pkg libsoup-2.4               \
+       --pkg gtksourceview-3.0         \
        $(GITG_VALAFLAGS)               \
        --vapidir $(top_srcdir)/vapi    \
        --includedir libgitg            \
        --basedir $(top_srcdir)         \
-       --gir $(GITG_GIR_IN)            \
+       --gir Gitg-1.0.gir              \
        --vapi libgitg/libgitg-1.0.vapi \
        --library libgitg/libgitg-1.0   \
        --header libgitg/libgitg.h      \
        --gresources "$(top_srcdir)/libgitg/resources/resources.xml"
 
-Gitg-1.0.gir: $(GITG_GIR_IN)
-       $(SED) \
-               -e 's/<include name="WebKit2" version="[34].0"\/>/<include name="WebKit2" 
version="$(WEBKIT_MAJOR_VERSION).0"\/>/g' \
-               -e 's/Gitg_in/Gitg/g' \
-               $< >$@
-
 libgitg_libgitg_1_0_la_VALASOURCES =                   \
        libgitg/gitg-assembly-info.vala                 \
        libgitg/gitg-async.vala                         \
@@ -66,12 +56,11 @@ libgitg_libgitg_1_0_la_VALASOURCES =                        \
        libgitg/gitg-credentials-manager.vala           \
        libgitg/gitg-date.vala                          \
        libgitg/gitg-diff-stat.vala                     \
-       libgitg/gitg-diff-view-options.vala             \
-       libgitg/gitg-diff-view-request-diff.vala        \
-       libgitg/gitg-diff-view-request-icon.vala        \
-       libgitg/gitg-diff-view-request-resource.vala    \
-       libgitg/gitg-diff-view-request.vala             \
        libgitg/gitg-diff-view.vala                     \
+       libgitg/gitg-diff-view-file.vala                \
+       libgitg/gitg-diff-view-hunk.vala                \
+       libgitg/gitg-diff-view-lines-renderer.vala      \
+       libgitg/gitg-diff-view-commit-details.vala      \
        libgitg/gitg-hook.vala                          \
        libgitg/gitg-init.vala                          \
        libgitg/gitg-label-renderer.vala                \
@@ -83,6 +72,7 @@ libgitg_libgitg_1_0_la_VALASOURCES =                  \
        libgitg/gitg-remote.vala                        \
        libgitg/gitg-repository-list-box.vala           \
        libgitg/gitg-repository.vala                    \
+       libgitg/gitg-resource.vala                      \
        libgitg/gitg-sidebar.vala                       \
        libgitg/gitg-stage-status-enumerator.vala       \
        libgitg/gitg-stage.vala                         \
@@ -91,14 +81,11 @@ libgitg_libgitg_1_0_la_VALASOURCES =                        \
 
 libgitg_libgitg_1_0_la_SOURCES =               \
        $(libgitg_libgitg_1_0_la_VALASOURCES)   \
-       libgitg/gitg-resources.c                \
-       libgitg/gitg-js-utils.c
+       libgitg/gitg-resources.c
 
 libgitg_libgitg_1_0_la_headerdir = $(prefix)/include/libgitg-1.0/libgitg
 libgitg_libgitg_1_0_la_header_HEADERS = libgitg/libgitg.h
 
-noinst_HEADERS += libgitg/gitg-js-utils.h
-
 libgitg_libgitg_1_0_la_vapidir = $(prefix)/share/vala/vapi
 libgitg_libgitg_1_0_la_vapi_DATA = libgitg/libgitg-1.0.vapi
 
@@ -116,17 +103,14 @@ libgitg/gitg-resources.c: $(libgitg_resources_deps)
        $(GRESGEN)
 
 GITIGNOREFILES +=                                      \
-       $(GITG_GIR_IN)                                  \
        libgitg/libgitg.h
 
 CLEANFILES +=                                          \
        $(libgitg_libgitg_1_0_la_typelib_DATA)          \
-       $(libgitg_libgitg_1_0_la_gir_DATA)              \
        libgitg/gitg-resources.c
 
 EXTRA_DIST +=                                          \
        $(libgitg_libgitg_1_0_la_pkgconfig_DATA)        \
-       $(GITG_GIR_IN)                                  \
        $(libgitg_resources_deps)
 
 # vi:ts=8:noet
diff --git a/libgitg/gitg-avatar-cache.vala b/libgitg/gitg-avatar-cache.vala
index b8a349b..9134e6b 100644
--- a/libgitg/gitg-avatar-cache.vala
+++ b/libgitg/gitg-avatar-cache.vala
@@ -42,26 +42,29 @@ public class Gitg.AvatarCache : Object
                return s_instance;
        }
 
-       public async Gdk.Pixbuf? load(string email, Cancellable? cancellable = null)
+       public async Gdk.Pixbuf? load(string email, int size = 50, Cancellable? cancellable = null)
        {
                var id = Checksum.compute_for_string(ChecksumType.MD5, email.down());
 
-               if (d_cache.has_key(id))
+               var ckey = @"$id $size";
+
+               if (d_cache.has_key(ckey))
                {
-                       return d_cache[id];
+                       return d_cache[ckey];
                }
 
-               var gravatar = @"http://www.gravatar.com/avatar/$(id)?d=404&s=50";
+               var gravatar = @"http://www.gravatar.com/avatar/$(id)?d=404&s=$(size)";
                var gfile = File.new_for_uri(gravatar);
 
-               var pixbuf = yield read_avatar_from_file(id, gfile, cancellable);
+               var pixbuf = yield read_avatar_from_file(id, gfile, size, cancellable);
 
-               d_cache[id] = pixbuf;
+               d_cache[ckey] = pixbuf;
                return pixbuf;
        }
 
        private async Gdk.Pixbuf? read_avatar_from_file(string       id,
                                                        File         file,
+                                                       int          size,
                                                        Cancellable? cancellable)
        {
                InputStream stream;
@@ -78,7 +81,7 @@ public class Gitg.AvatarCache : Object
                uint8[] buffer = new uint8[4096];
                var loader = new Gdk.PixbufLoader();
 
-               loader.set_size(50, 50);
+               loader.set_size(size, size);
 
                return yield read_avatar(id, stream, buffer, loader, cancellable);
        }
diff --git a/libgitg/gitg-diff-stat.vala b/libgitg/gitg-diff-stat.vala
index ebf8713..2ec2207 100644
--- a/libgitg/gitg-diff-stat.vala
+++ b/libgitg/gitg-diff-stat.vala
@@ -59,89 +59,6 @@ public class Gitg.DiffStat : Gtk.DrawingArea
        construct
        {
                make_layout();
-
-               var css = new Gtk.CssProvider();
-
-               var fb = @"
-                       GitgDiffStat {
-                               border: 1px inset shade(@borders, 1.2);
-                               border-radius: 5px;
-                               background-color: shade(@theme_bg_color, 1.2);
-                               -GitgDiffStat-bar-height: 5px;
-                       }
-
-                       GitgDiffStat.no-frame {
-                               border: 0;
-                               border-radius: 0;
-                               background-color: inherit;
-                       }
-
-                       GitgDiffStat added,
-                       GitgDiffStat removed,
-                       GitgDiffStat.no-frame added,
-                       GitgDiffStat.no-frame removed {
-                               border: 0;
-                       }
-
-                       GitgDiffStat added,
-                       GitgDiffStat.no-frame added {
-                               background-color: #33cc33;
-                               border-radius: 3px 0px 0px 3px;
-                       }
-
-                       GitgDiffStat added:dir(rtl),
-                       GitgDiffStat.no-frame added:dir(rtl) {
-                               border-radius: 0px 3px 3px 0px;
-                       }
-
-                       GitgDiffStat removed,
-                       GitgDiffStat.no-frame removed {
-                               background-color: #cc3333;
-                               border-radius: 0px 3px 3px 0px;
-                       }
-
-                       GitgDiffStat removed:dir(rtl),
-                       GitgDiffStat.no-frame removed:dir(rtl) {
-                               border-radius: 3px 0px 0px 3px;
-                       }
-
-                       GitgDiffStat removed:only-child,
-                       GitgDiffStat added:only-child,
-                       GitgDiffStat.no-frame removed:only-child,
-                       GitgDiffStat.no-frame added:only-child {
-                               border-radius: 3px;
-                       }
-               ";
-
-               try
-               {
-                       css.load_from_data(fb, fb.length);
-               }
-               catch (Error e)
-               {
-                       warning("Failed to load diff-stat style: %s", e.message);
-               }
-
-               get_style_context().add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_FALLBACK);
-
-               css = new Gtk.CssProvider();
-
-               var us = @"
-                       GitgDiffStat {
-                               padding: 1px 5px 1px 3px;
-                       }
-               ";
-
-               try
-               {
-                       css.load_from_data(us, us.length);
-               }
-               catch (Error e)
-               {
-                       warning("Failed to load diff-stat style: %s", e.message);
-               }
-
-               get_style_context().add_provider(css, Gtk.STYLE_PROVIDER_PRIORITY_USER);
        }
 
        private void make_layout()
diff --git a/libgitg/gitg-diff-view-commit-details.vala b/libgitg/gitg-diff-view-commit-details.vala
new file mode 100644
index 0000000..00b87d6
--- /dev/null
+++ b/libgitg/gitg-diff-view-commit-details.vala
@@ -0,0 +1,270 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2015 - Jesse van den Kieboom
+ *
+ * gitg 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.
+ *
+ * gitg 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+[GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-diff-view-commit-details.ui")]
+class Gitg.DiffViewCommitDetails : Gtk.Grid
+{
+       [GtkChild( name = "image_avatar" )]
+       private Gtk.Image d_image_avatar;
+
+       [GtkChild( name = "label_author" )]
+       private Gtk.Label d_label_author;
+
+       [GtkChild( name = "label_author_date" )]
+       private Gtk.Label d_label_author_date;
+
+       [GtkChild( name = "label_committer" )]
+       private Gtk.Label d_label_committer;
+
+       [GtkChild( name = "label_committer_date" )]
+       private Gtk.Label d_label_committer_date;
+
+       [GtkChild( name = "label_subject" )]
+       private Gtk.Label d_label_subject;
+
+       [GtkChild( name = "label_sha1" )]
+       private Gtk.Label d_label_sha1;
+
+       [GtkChild( name = "grid_parents_container" )]
+       private Gtk.Grid d_grid_parents_container;
+
+       [GtkChild( name = "grid_parents" )]
+       private Gtk.Grid d_grid_parents;
+
+       [GtkChild( name = "expander_files" )]
+       private Gtk.Expander d_expander_files;
+
+       public bool expanded
+       {
+               get { return d_expander_files.expanded; }
+               set
+               {
+                       if (d_expander_files.expanded != value)
+                       {
+                               d_expander_files.expanded = value;
+
+                               if (value)
+                               {
+                                       d_expander_files.label = _("Collapse all");
+                               }
+                               else
+                               {
+                                       d_expander_files.label = _("Expand all");
+                               }
+                       }
+               }
+       }
+
+       private Cancellable? d_avatar_cancel;
+
+       private Ggit.Commit? d_commit;
+
+       public Ggit.Commit? commit
+       {
+               get { return d_commit; }
+               construct set
+               {
+                       if (d_commit != value)
+                       {
+                               d_commit = value;
+                               update();
+                       }
+               }
+       }
+
+       private Ggit.Commit d_parent_commit;
+
+       public Ggit.Commit parent_commit
+       {
+               get { return d_parent_commit; }
+               set
+               {
+                       if (d_parent_commit != value)
+                       {
+                               d_parent_commit = value;
+
+                               var button = d_parents_map[value.get_id()];
+
+                               if (button != null)
+                               {
+                                       button.active = true;
+                               }
+                       }
+               }
+       }
+
+       public DiffViewCommitDetails(Ggit.Commit? commit)
+       {
+               Object(commit: commit);
+       }
+
+       private bool d_use_gravatar;
+
+       public bool use_gravatar
+       {
+               get { return d_use_gravatar; }
+               construct set
+               {
+                       d_use_gravatar = value;
+                       update_avatar();
+               }
+               default = true;
+       }
+
+       private Gee.HashMap<Ggit.OId, Gtk.RadioButton> d_parents_map;
+
+       construct
+       {
+               d_expander_files.notify["expanded"].connect(() => {
+                       notify_property("expanded");
+               });
+       }
+
+       private string author_to_markup(Ggit.Signature author)
+       {
+               var name = Markup.escape_text(author.get_name());
+               var email = Markup.escape_text(author.get_email());
+
+               return "%s &lt;<a href=\"mailto:%s\";>%s</a>&gt;".printf(name, email, email);
+       }
+
+       private void update()
+       {
+               d_parents_map = new Gee.HashMap<Ggit.OId, Gtk.RadioButton>((oid) => oid.hash(), (o1, o2) => 
o1.equal(o2));
+
+               foreach (var child in d_grid_parents.get_children())
+               {
+                       child.destroy();
+               }
+
+               if (commit == null)
+               {
+                       return;
+               }
+
+               d_label_subject.label = commit.get_subject();
+               d_label_sha1.label = commit.get_id().to_string();
+
+               var author = commit.get_author();
+
+               d_label_author.label = author_to_markup(author);
+               d_label_author_date.label = author.get_time().to_timezone(author.get_time_zone()).format("%x 
%X %z");
+
+               var committer = commit.get_committer();
+
+               if (committer.get_name() != author.get_name() ||
+                   committer.get_email() != author.get_email() ||
+                   committer.get_time().compare(author.get_time()) != 0)
+               {
+                       d_label_committer.label = author_to_markup(committer);
+                       d_label_committer_date.label = 
committer.get_time().to_timezone(committer.get_time_zone()).format("%x %X %z");
+
+                       d_label_committer.show();
+                       d_label_committer_date.show();
+               }
+               else
+               {
+                       d_label_committer.hide();
+                       d_label_committer_date.hide();
+               }
+
+               var parents = commit.get_parents();
+               var first_parent = parents.size == 0 ? null : parents.get(0);
+
+               d_parent_commit = first_parent;
+
+               if (parents.size > 1)
+               {
+                       d_grid_parents_container.show();
+                       var grp = new SList<Gtk.RadioButton>();
+
+                       foreach (var parent in parents)
+                       {
+                               var pid = parent.get_id().to_string().substring(0, 6);
+                               var psubj = parent.get_subject();
+
+                               var button = new Gtk.RadioButton.with_label(grp, @"$pid: $psubj");
+                               d_parents_map[parent.get_id()] = button;
+
+                               button.show();
+                               d_grid_parents.add(button);
+
+                               var par = parent;
+
+                               button.activate.connect(() => {
+                                       d_parent_commit = par;
+                               });
+                       }
+               }
+               else
+               {
+                       d_grid_parents_container.hide();
+               }
+
+               update_avatar();
+       }
+
+       private void update_avatar()
+       {
+               if (commit == null)
+               {
+                       return;
+               }
+
+               if (d_use_gravatar)
+               {
+                       if (d_avatar_cancel != null)
+                       {
+                               d_avatar_cancel.cancel();
+                       }
+
+                       d_avatar_cancel = new Cancellable();
+                       var cancel = d_avatar_cancel;
+
+                       var cache = AvatarCache.default();
+
+                       cache.load.begin(commit.get_author().get_email(), d_image_avatar.pixel_size, cancel, 
(obj, res) => {
+                               if (!cancel.is_cancelled())
+                               {
+                                       var pixbuf = cache.load.end(res);
+
+                                       if (pixbuf != null)
+                                       {
+                                               d_image_avatar.pixbuf = pixbuf;
+                                       }
+                                       else
+                                       {
+                                               d_image_avatar.icon_name = "avatar-default-symbolic";
+                                       }
+                               }
+
+                               if (cancel == d_avatar_cancel)
+                               {
+                                       d_avatar_cancel = null;
+                               }
+                       });
+               }
+               else
+               {
+                       d_image_avatar.icon_name = "avatar-default-symbolic";
+               }
+       }
+}
+
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view-file.vala b/libgitg/gitg-diff-view-file.vala
new file mode 100644
index 0000000..cd72ec8
--- /dev/null
+++ b/libgitg/gitg-diff-view-file.vala
@@ -0,0 +1,118 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2015 - Jesse van den Kieboom
+ *
+ * gitg 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.
+ *
+ * gitg 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+[GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-diff-view-file.ui")]
+class Gitg.DiffViewFile : Gtk.Grid
+{
+       [GtkChild( name = "expander" )]
+       private Gtk.Expander d_expander;
+
+       [GtkChild( name = "label_file_header" )]
+       private Gtk.Label d_label_file_header;
+
+       [GtkChild( name = "grid_hunks" )]
+       private Gtk.Grid d_grid_hunks;
+
+       [GtkChild( name = "diff_stat_file" )]
+       private DiffStat d_diff_stat_file;
+
+       [GtkChild( name = "grid_file_header" )]
+       private Gtk.Grid d_grid_file_header;
+
+       private bool d_expanded;
+
+       public bool expanded
+       {
+               get
+               {
+                       return d_expanded;
+               }
+
+               set
+               {
+                       if (d_expanded != value)
+                       {
+                               d_expanded = value;
+
+                               var ctx = get_style_context();
+
+                               if (d_expanded)
+                               {
+                                       ctx.add_class("expanded");
+                               }
+                               else
+                               {
+                                       ctx.remove_class("expanded");
+                               }
+                       }
+               }
+       }
+
+       public Ggit.DiffDelta delta
+       {
+               get;
+               construct set;
+       }
+
+       public DiffViewFile(Ggit.DiffDelta delta)
+       {
+               Object(delta: delta);
+       }
+
+       protected override void constructed()
+       {
+               base.constructed();
+
+               var oldfile = delta.get_old_file();
+               var newfile = delta.get_new_file();
+
+               var oldpath = (oldfile != null ? oldfile.get_path() : null);
+               var newpath = (newfile != null ? newfile.get_path() : null);
+
+               if (delta.get_similarity() > 0)
+               {
+                       d_label_file_header.label = @"$(newfile.get_path()) ← $(oldfile.get_path())";
+               }
+               else if (newpath != null)
+               {
+                       d_label_file_header.label = newpath;
+               }
+               else
+               {
+                       d_label_file_header.label = oldpath;
+               }
+
+               d_expander.bind_property("expanded", this, "expanded", BindingFlags.BIDIRECTIONAL);
+       }
+
+       public void add_hunk(Ggit.DiffHunk hunk, Gee.ArrayList<Ggit.DiffLine> lines)
+       {
+               var widget = new Gitg.DiffViewHunk(hunk, lines);
+               widget.show();
+
+               d_diff_stat_file.added += widget.added;
+               d_diff_stat_file.removed += widget.removed;
+
+               d_grid_hunks.add(widget);
+
+               sensitive = true;
+       }
+}
+
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view-hunk.vala b/libgitg/gitg-diff-view-hunk.vala
new file mode 100644
index 0000000..ea40121
--- /dev/null
+++ b/libgitg/gitg-diff-view-hunk.vala
@@ -0,0 +1,133 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2015 - Jesse van den Kieboom
+ *
+ * gitg 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.
+ *
+ * gitg 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+[GtkTemplate (ui = "/org/gnome/gitg/ui/gitg-diff-view-hunk.ui")]
+class Gitg.DiffViewHunk : Gtk.Grid
+{
+       [GtkChild( name = "label_hunk" )]
+       private Gtk.Label d_label_hunk;
+
+       [GtkChild( name = "sourceview_hunk" )]
+       private Gtk.SourceView d_sourceview_hunk;
+
+       public Ggit.DiffHunk hunk
+       {
+               get;
+               construct set;
+       }
+
+       public Gee.ArrayList<Ggit.DiffLine> lines
+       {
+               get;
+               construct set;
+       }
+
+       public DiffViewHunk(Ggit.DiffHunk hunk, Gee.ArrayList<Ggit.DiffLine> lines)
+       {
+               Object(hunk: hunk, lines: lines);
+       }
+
+       private uint d_added;
+
+       public uint added
+       {
+               get { return d_added; }
+       }
+
+       private uint d_removed;
+
+       public uint removed
+       {
+               get { return d_removed; }
+       }
+
+       construct
+       {
+               var gutter = d_sourceview_hunk.get_gutter(Gtk.TextWindowType.LEFT);
+
+               var old_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.OLD);
+               var new_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.NEW);
+               var sym_lines = new DiffViewLinesRenderer(hunk, lines, DiffViewLinesRenderer.Style.SYMBOL);
+
+               old_lines.xpad = 8;
+               new_lines.xpad = 8;
+               sym_lines.xpad = 6;
+
+               gutter.insert(old_lines, 0);
+               gutter.insert(new_lines, 1);
+               gutter.insert(sym_lines, 2);
+
+               update_hunk_label();
+               update_lines();
+       }
+
+       private void update_hunk_label()
+       {
+               var h = hunk.get_header();
+               var pos = h.last_index_of("@@");
+
+               if (pos >= 0)
+               {
+                       h = h.substring(pos + 2).chug();
+               }
+
+               h = h.chomp();
+               d_label_hunk.label = @"@@ -$(hunk.get_old_start()),$(hunk.get_old_lines()) 
+$(hunk.get_new_start()),$(hunk.get_new_lines()) @@ $h";
+       }
+
+       private void update_lines()
+       {
+               var content = new StringBuilder();
+
+               for (var i = 0; i < lines.size; i++)
+               {
+                       var line = lines[i];
+                       var text = line.get_text();
+
+                       switch (line.get_origin())
+                       {
+                               case Ggit.DiffLineType.ADDITION:
+                                       ++d_added;
+                               break;
+                               case Ggit.DiffLineType.DELETION:
+                                       ++d_removed;
+                               break;
+                               case Ggit.DiffLineType.CONTEXT_EOFNL:
+                               case Ggit.DiffLineType.ADD_EOFNL:
+                               case Ggit.DiffLineType.DEL_EOFNL:
+                                       text = text.substring(1);
+                               break;
+                       }
+
+                       if (i == lines.size - 1 && text.length > 0 && text[text.length - 1] == '\n')
+                       {
+                               text = text.slice(0, text.length - 1);
+                       }
+
+                       content.append(text);
+               }
+
+               d_sourceview_hunk.buffer.set_text((string)content.data);
+
+               notify_property("added");
+               notify_property("removed");
+       }
+}
+
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view-lines-renderer.vala b/libgitg/gitg-diff-view-lines-renderer.vala
new file mode 100644
index 0000000..f878c9e
--- /dev/null
+++ b/libgitg/gitg-diff-view-lines-renderer.vala
@@ -0,0 +1,192 @@
+/*
+ * This file is part of gitg
+ *
+ * Copyright (C) 2015 - Jesse van den Kieboom
+ *
+ * gitg 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.
+ *
+ * gitg 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with gitg. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class Gitg.DiffViewLinesRenderer : Gtk.SourceGutterRendererText
+{
+       public enum Style
+       {
+               OLD,
+               NEW,
+               SYMBOL
+       }
+
+       private int d_num_digits;
+       private string d_num_digits_fmts;
+       private string d_num_digits_fill;
+
+       private ulong d_view_style_updated_id;
+
+       private string[] d_line_infos;
+
+       public Ggit.DiffHunk hunk
+       {
+               get; construct set;
+       }
+
+       public Gee.ArrayList<Ggit.DiffLine> lines
+       {
+               get; construct set;
+       }
+
+       public Style style
+       {
+               get; construct set;
+       }
+
+       public DiffViewLinesRenderer(Ggit.DiffHunk hunk, Gee.ArrayList<Ggit.DiffLine> lines, Style style)
+       {
+               Object(hunk: hunk, lines: lines, style: style);
+       }
+
+       protected override void constructed()
+       {
+               calulate_num_digits();
+               precalculate_line_strings();
+       }
+
+       private void precalculate_line_strings()
+       {
+               var oldn = hunk.get_old_start();
+               var newn = hunk.get_new_start();
+
+               var lns = lines;
+
+               d_line_infos = new string[lns.size];
+
+               for (var i = 0; i < lns.size; i++)
+               {
+                       var line = lns[i];
+                       var origin = line.get_origin();
+
+                       string ltext = "";
+
+                       switch (style)
+                       {
+                       case Style.NEW:
+                               if (origin == Ggit.DiffLineType.CONTEXT || origin == 
Ggit.DiffLineType.ADDITION)
+                               {
+                                       ltext = d_num_digits_fmts.printf(newn);
+                                       newn++;
+                               }
+                               break;
+                       case Style.OLD:
+                               if (origin == Ggit.DiffLineType.CONTEXT || origin == 
Ggit.DiffLineType.DELETION)
+                               {
+                                       ltext = d_num_digits_fmts.printf(oldn);
+                                       oldn++;
+                               }
+                               break;
+                       case Style.SYMBOL:
+                               if (origin == Ggit.DiffLineType.ADDITION)
+                               {
+                                       ltext = "+";
+                               }
+                               else if (origin == Ggit.DiffLineType.DELETION)
+                               {
+                                       ltext = "-";
+                               }
+                               break;
+                       }
+
+                       d_line_infos[i] = ltext;
+               }
+       }
+
+       protected Gtk.TextBuffer buffer
+       {
+               get { return get_view().buffer; }
+       }
+
+       protected override void query_data(Gtk.TextIter start, Gtk.TextIter end, 
Gtk.SourceGutterRendererState state)
+       {
+               var line = start.get_line();
+
+               if (line >= d_line_infos.length)
+               {
+                       set_text("", -1);
+               }
+               else
+               {
+                       set_text(d_line_infos[start.get_line()], -1);
+               }
+       }
+
+       private void on_view_style_updated()
+       {
+               recalculate_size();
+       }
+
+       protected override void change_view(Gtk.TextView? old_view)
+       {
+               if (old_view != null)
+               {
+                       old_view.disconnect(d_view_style_updated_id);
+                       d_view_style_updated_id = 0;
+               }
+
+               var view = get_view();
+
+               if (view != null)
+               {
+                       d_view_style_updated_id = view.style_updated.connect(on_view_style_updated);
+                       recalculate_size();
+               }
+
+               base.change_view(old_view);
+       }
+
+       private void recalculate_size()
+       {
+               int size = 0;
+               int height = 0;
+
+               measure(@"$d_num_digits_fill", out size, out height);
+               set_size(size);
+       }
+
+       private void calulate_num_digits()
+       {
+               var num_digits = 0;
+
+               if (style == Style.OLD || style == Style.NEW)
+               {
+                       var oldn = hunk.get_old_start() + hunk.get_old_lines();
+                       var newn = hunk.get_new_start() + hunk.get_new_lines();
+
+                       var num = int.max(oldn, newn);
+
+                       while (num > 0)
+                       {
+                               ++num_digits;
+                               num /= 10;
+                       }
+
+                       d_num_digits = int.max(2, num_digits);
+               }
+               else
+               {
+                       num_digits = 1;
+               }
+
+               d_num_digits_fmts = @"%$(num_digits)d";
+               d_num_digits_fill = string.nfill(num_digits, ' ');
+       }
+}
+
+// ex:ts=4 noet
diff --git a/libgitg/gitg-diff-view-options.vala b/libgitg/gitg-diff-view-options.vala
index a00bebb..bd24591 100644
--- a/libgitg/gitg-diff-view-options.vala
+++ b/libgitg/gitg-diff-view-options.vala
@@ -20,7 +20,7 @@
 namespace Gitg
 {
 
-[GtkTemplate ( ui = "/org/gnome/gitg/ui/diff-view/diff-view-options.ui" )]
+[GtkTemplate ( ui = "/org/gnome/gitg/ui/gitg-diff-view-options.ui" )]
 public class DiffViewOptions : Gtk.Grid
 {
        [GtkChild (name = "switch_changes_inline")]
@@ -44,12 +44,6 @@ public class DiffViewOptions : Gtk.Grid
        [GtkChild (name = "adjustment_tab_width")]
        private Gtk.Adjustment d_adjustment_tab_width;
 
-       [GtkChild (name = "button_developer_tools")]
-       private Gtk.Button d_button_developer_tools;
-
-       [GtkChild (name = "separator_developer_tools")]
-       private Gtk.Separator d_separator_developer_tools;
-
        [GtkChild (name = "separator_first_options")]
        private Gtk.Separator d_separator_first_options;
 
@@ -148,11 +142,6 @@ public class DiffViewOptions : Gtk.Grid
                              transform_int_to_double,
                              transform_double_to_int);
 
-               var dbg = (Environment.get_variable("GITG_GTK_DIFF_VIEW_DEBUG") != null);
-
-               d_separator_developer_tools.visible = dbg;
-               d_button_developer_tools.visible = dbg;
-
                if (view.commit == null)
                {
                        d_label_changes_inline.visible = false;
@@ -164,13 +153,6 @@ public class DiffViewOptions : Gtk.Grid
                        d_separator_first_options.visible = false;
                }
        }
-
-       [GtkCallback]
-       private void on_button_developer_tools_clicked()
-       {
-               view.get_inspector().show();
-               hide();
-       }
 }
 
 }
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index c438228..390fe04 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of gitg
  *
- * Copyright (C) 2012 - Jesse van den Kieboom
+ * Copyright (C) 2015 - Jesse van den Kieboom
  *
  * gitg is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -17,727 +17,342 @@
  * along with gitg. If not, see <http://www.gnu.org/licenses/>.
  */
 
-namespace Gitg
+[GtkTemplate( ui = "/org/gnome/gitg/ui/gitg-diff-view.ui" )]
+public class Gitg.DiffView : Gtk.ScrolledWindow
 {
-       public class DiffView : WebKit.WebView
-       {
-               private class DiffViewRequestInternal : DiffViewRequest
-               {
-                       public DiffViewRequestInternal(DiffView? view, WebKit.URISchemeRequest request, 
Soup.URI uri)
-                       {
-                               base(view, request, uri);
-                       }
+       [GtkChild( name = "commit_details" )]
+       private Gitg.DiffViewCommitDetails d_commit_details;
 
-                       protected override InputStream? run_async(Cancellable? cancellable) throws Error
-                       {
-                               Idle.add(() => {
-                                       switch (parameter("action"))
-                                       {
-                                               case "selection-changed":
-                                                       d_view.update_has_selection(parameter("value") == 
"yes");
-                                                       break;
-                                               case "loaded":
-                                                       d_view.loaded();
-                                                       break;
-                                               case "load-parent":
-                                                       d_view.load_parent(parameter("value"));
-                                                       break;
-                                               case "select-parent":
-                                                       d_view.select_parent(parameter("value"));
-                                                       break;
-                                               case "open-url":
-                                                       d_view.open_url(parameter("url"));
-                                                       break;
-                                       }
+       [GtkChild( name = "grid_files" )]
+       private Gtk.Grid d_grid_files;
 
-                                       return false;
-                               });
+       private Ggit.Diff? d_diff;
+       private Commit? d_commit;
 
-                               return null;
-                       }
-               }
+       private Ggit.DiffOptions? d_options;
+       private Ggit.OId? d_parent;
 
-               public signal void request_select_commit(string id);
-
-               private Ggit.Diff? d_diff;
-               private Commit? d_commit;
-               private Settings? d_fontsettings;
-               private bool d_has_selection;
-               private Ggit.DiffOptions? d_options;
-               private string? d_parent;
-
-               private static Gee.HashMap<string, DiffView> s_diff_map;
-               private static uint64 s_diff_id;
-
-               public File? custom_css { get; construct; }
-               public File? custom_js { get; construct; }
-
-               public virtual signal void options_changed()
+       public Ggit.DiffOptions options
+       {
+               get
                {
-                       if (d_commit != null)
+                       if (d_options == null)
                        {
-                               update();
+                               d_options = new Ggit.DiffOptions();
                        }
-               }
-
-               public Ggit.DiffOptions options
-               {
-                       get
-                       {
-                               if (d_options == null)
-                               {
-                                       d_options = new Ggit.DiffOptions();
-                               }
 
-                               return d_options;
-                       }
+                       return d_options;
                }
+       }
 
-               public bool has_selection
-               {
-                       get { return d_has_selection; }
-               }
+       // TODO
+       public bool has_selection
+       {
+               get { return false; }
+       }
 
-               private Cancellable d_cancellable;
-               private bool d_loaded;
-               private ulong d_diffid;
+       private Cancellable d_cancellable;
 
-               public Ggit.Diff? diff
+       public Ggit.Diff? diff
+       {
+               get { return d_diff; }
+               set
                {
-                       get { return d_diff; }
-                       set
-                       {
-                               d_diff = value;
-                               d_commit = null;
-                               d_parent = null;
-
-                               update();
-                       }
-               }
+                       d_diff = value;
 
-               public Commit? commit
-               {
-                       get { return d_commit; }
-                       set
-                       {
-                               if (d_commit != value)
-                               {
-                                       d_commit = value;
-                                       d_diff = null;
-                                       d_parent = null;
-                               }
+                       d_commit = null;
+                       d_parent = null;
 
-                               update();
-                       }
+                       update();
                }
+       }
 
-               private bool d_wrap;
-
-               public bool wrap
+       public Commit? commit
+       {
+               get { return d_commit; }
+               set
                {
-                       get { return d_wrap; }
-                       construct set
+                       if (d_commit != value)
                        {
-                               if (d_wrap != value)
-                               {
-                                       d_wrap = value;
-                                       update_wrap();
-                               }
+                               d_commit = value;
+                               d_diff = null;
+                               d_parent = null;
                        }
-                       default = true;
-               }
-
-               public bool staged { get; set; default = false; }
-               public bool unstaged { get; set; default = false; }
-               public bool show_parents { get; set; default = false; }
-               public bool default_collapse_all { get; set; default = true; }
-
-               private bool d_use_gravatar;
 
-               public bool use_gravatar
-               {
-                       get { return d_use_gravatar; }
-                       construct set
-                       {
-                               if (d_use_gravatar != value)
-                               {
-                                       d_use_gravatar = value;
-                                       options_changed();
-                               }
-                       }
-                       default = true;
+                       update();
                }
+       }
 
-               int d_tab_width;
-
-               public int tab_width
+       public virtual signal void options_changed()
+       {
+               if (d_commit != null)
                {
-                       get { return d_tab_width; }
-                       construct set
-                       {
-                               if (d_tab_width != value)
-                               {
-                                       d_tab_width = value;
-                                       update_tab_width();
-                               }
-                       }
-                       default = 4;
+                       update();
                }
+       }
 
-               private bool flag_get(Ggit.DiffOption f)
-               {
-                       return (options.flags & f) != 0;
-               }
+       private bool d_wrap;
 
-               private void flag_set(Ggit.DiffOption f, bool val)
+       public bool wrap
+       {
+               get { return d_wrap; }
+               construct set
                {
-                       var flags = options.flags;
-
-                       if (val)
-                       {
-                               flags |= f;
-                       }
-                       else
+                       if (d_wrap != value)
                        {
-                               flags &= ~f;
-                       }
-
-                       if (flags != options.flags)
-                       {
-                               options.flags = flags;
-
-                               options_changed();
+                               d_wrap = value;
+                               update_wrap();
                        }
                }
+               default = true;
+       }
 
-               public bool ignore_whitespace
-               {
-                       get { return flag_get(Ggit.DiffOption.IGNORE_WHITESPACE); }
-                       set { flag_set(Ggit.DiffOption.IGNORE_WHITESPACE, value); }
-               }
-
-               private bool d_changes_inline;
+       public bool staged { get; set; default = false; }
+       public bool unstaged { get; set; default = false; }
+       public bool show_parents { get; set; default = false; }
+       public bool default_collapse_all { get; set; default = true; }
 
-               public bool changes_inline
-               {
-                       get { return d_changes_inline; }
-                       set
-                       {
-                               if (d_changes_inline != value)
-                               {
-                                       d_changes_inline = value;
+       public bool use_gravatar
+       {
+               get;
+               construct set;
+               default = true;
+       }
 
-                                       options_changed();
-                               }
-                       }
-               }
+       int d_tab_width;
 
-               public int context_lines
+       public int tab_width
+       {
+               get { return d_tab_width; }
+               construct set
                {
-                       get { return options.n_context_lines; }
-
-                       construct set
+                       if (d_tab_width != value)
                        {
-                               if (options.n_context_lines != value)
-                               {
-                                       options.n_context_lines = value;
-                                       options.n_interhunk_lines = value;
-
-                                       options_changed();
-                               }
+                               d_tab_width = value;
+                               update_tab_width();
                        }
-
-                       default = 3;
                }
+               default = 4;
+       }
 
-               static construct
-               {
-                       s_diff_map = new Gee.HashMap<string, DiffView>();
-
-                       var context = WebKit.WebContext.get_default();
-
-                       context.register_uri_scheme("gitg-diff", gitg_diff_request);
-                       context.register_uri_scheme("mailto", gitg_diff_mailto_request);
+       private bool flag_get(Ggit.DiffOption f)
+       {
+               return (options.flags & f) != 0;
+       }
 
-                       context.set_cache_model(WebKit.CacheModel.DOCUMENT_VIEWER);
-               }
+       private void flag_set(Ggit.DiffOption f, bool val)
+       {
+               var flags = options.flags;
 
-               private string json_settings()
+               if (val)
                {
-                       var o = new Json.Object();
-
-                       o.set_boolean_member("wrap", wrap);
-                       o.set_int_member("tab_width", tab_width);
-                       o.set_boolean_member("staged", staged);
-                       o.set_boolean_member("unstaged", unstaged);
-                       o.set_boolean_member("debug", Environment.get_variable("GITG_GTK_DIFF_VIEW_DEBUG") != 
null);
-                       o.set_boolean_member("changes_inline", changes_inline);
-                       o.set_boolean_member("show_parents", show_parents);
-                       o.set_boolean_member("default_collapse_all", default_collapse_all);
-                       o.set_string_member("parent", d_parent);
-                       o.set_boolean_member("use_gravatar", use_gravatar);
-
-                       var strings = new Json.Object();
-
-                       strings.set_string_member("stage", _("stage"));
-                       strings.set_string_member("unstage", _("unstage"));
-                       strings.set_string_member("loading_diff", _("Loading diff…"));
-                       strings.set_string_member("notes", _("Notes:"));
-                       strings.set_string_member("parents", _("Parents:"));
-                       strings.set_string_member("diff_against", _("Diff against:"));
-                       strings.set_string_member("committed_by", _("Committed by:"));
-                       strings.set_string_member("expand_all", _("Expand all"));
-                       strings.set_string_member("collapse_all", _("Collapse all"));
-
-                       o.set_object_member("strings", strings);
-
-                       var gen = new Json.Generator();
-
-                       var node = new Json.Node(Json.NodeType.OBJECT);
-                       node.set_object(o);
-
-                       gen.set_root(node);
-
-                       size_t l;
-                       var ret = gen.to_data(out l);
-                       return ret[0:(long)l];
+                       flags |= f;
                }
-
-               private static DiffViewRequest? parse_request(WebKit.URISchemeRequest request)
+               else
                {
-                       var uri = new Soup.URI(request.get_uri());
-                       var path = uri.get_path();
-                       var parts = path.split("/", 3);
-
-                       if (parts.length != 3)
-                       {
-                               return null;
-                       }
-
-                       uri.set_scheme(parts[1]);
-                       uri.set_path("/" + parts[2]);
-
-                       DiffView? view = null;
-
-                       var q = uri.get_query();
-
-                       if (q != null)
-                       {
-                               var f = Soup.Form.decode(q);
-                               var vid = f.lookup("viewid");
-
-                               if (vid != null && s_diff_map.has_key(vid))
-                               {
-                                       view = s_diff_map[vid];
-                               }
-                       }
-
-                       switch (parts[1])
-                       {
-                               case "resource":
-                                       return new DiffViewRequestResource(view, request, uri);
-                               case "icon":
-                                       return new DiffViewRequestIcon(view, request, uri);
-                               case "diff":
-                                       return new DiffViewRequestDiff(view, request, uri);
-                               case "internal":
-                                       return new DiffViewRequestInternal(view, request, uri);
-                       }
-
-                       return null;
+                       flags &= ~f;
                }
 
-               private static void gitg_diff_mailto_request(WebKit.URISchemeRequest request)
+               if (flags != options.flags)
                {
-                       try
-                       {
-                               Gtk.show_uri(null, request.get_uri(), 0);
-                       } catch {}
+                       options.flags = flags;
+                       options_changed();
                }
+       }
 
-               private static void gitg_diff_request(WebKit.URISchemeRequest request)
-               {
-                       var req = parse_request(request);
-
-                       if (req == null)
-                       {
-                               return;
-                       }
-
-                       if (req.view != null)
-                       {
-                               req.view.request(req);
-                       }
-                       else
-                       {
-                               req.run(null);
-                       }
-               }
-
-               private void parse_font(string val, ref string family, ref uint size)
-               {
-                       var fdesc = Pango.FontDescription.from_string(val);
-
-                       var f = fdesc.get_family();
-                       var s = fdesc.get_size();
-
-                       if (f != null && f != "")
-                       {
-                               family = f;
-                       }
-
-                       if (s != 0)
-                       {
-                               if (fdesc.get_size_is_absolute())
-                               {
-                                       size = s;
-                               }
-                               else
-                               {
-                                       size = s / Pango.SCALE;
-                               }
+       public bool ignore_whitespace
+       {
+               get { return flag_get(Ggit.DiffOption.IGNORE_WHITESPACE); }
+               set { flag_set(Ggit.DiffOption.IGNORE_WHITESPACE, value); }
+       }
 
-                               size = (uint)(size * get_screen().get_resolution() / 72.0);
-                       }
-               }
+       private bool d_changes_inline;
 
-               public void request(DiffViewRequest request)
+       public bool changes_inline
+       {
+               get { return d_changes_inline; }
+               set
                {
-                       var did = request.parameter("diffid");
-
-                       if (did != null)
+                       if (d_changes_inline != value)
                        {
-                               uint64 i = uint64.parse(did);
+                               d_changes_inline = value;
 
-                               if (i == d_diffid)
-                               {
-                                       request.run(d_cancellable);
-                                       return;
-                               }
+                               // TODO
+                               //options_changed();
                        }
-
-                       // Still finish request, but with something bogus
-                       request.finish_empty();
                }
+       }
 
-               private void update_font_settings()
-               {
-                       var settings = get_settings();
-
-                       var fname = settings.default_font_family;
-                       var fsize = settings.default_font_size;
-
-                       parse_font(d_fontsettings.get_string("font-name"), ref fname, ref fsize);
-
-                       settings.default_font_family = fname;
-                       settings.default_font_size = fsize;
-
-                       fname = settings.monospace_font_family;
-                       fsize = settings.default_monospace_font_size;
-
-                       parse_font(d_fontsettings.get_string("monospace-font-name"), ref fname, ref fsize);
-
-                       settings.monospace_font_family = fname;
-                       settings.default_monospace_font_size = fsize;
-               }
+       public int context_lines
+       {
+               get { return options.n_context_lines; }
 
-               private Settings? try_settings(string schema_id)
+               construct set
                {
-                       var source = SettingsSchemaSource.get_default();
-
-                       if (source == null)
+                       if (options.n_context_lines != value)
                        {
-                               return null;
-                       }
+                               options.n_context_lines = value;
+                               options.n_interhunk_lines = value;
 
-                       if (source.lookup(schema_id, true) != null)
-                       {
-                               return new Settings(schema_id);
+                               options_changed();
                        }
-
-                       return null;
                }
 
-               protected override void constructed()
-               {
-                       base.constructed();
-
-                       var settings = new WebKit.Settings();
-
-                       var dbg = Environment.get_variable("GITG_GTK_DIFF_VIEW_DEBUG") != null;
-
-                       if (dbg)
-                       {
-                               settings.enable_developer_extras = true;
-                               settings.enable_write_console_messages_to_stdout = true;
-                       }
-
-                       settings.javascript_can_access_clipboard = true;
-                       settings.enable_page_cache = false;
-
-                       set_settings(settings);
-
-                       d_fontsettings = try_settings("org.gnome.desktop.interface");
-
-                       if (d_fontsettings != null)
-                       {
-                               update_font_settings();
-
-                               d_fontsettings.changed["monospace-font-name"].connect((s, k) => {
-                                       update_font_settings();
-                               });
-
-                               d_fontsettings.changed["font-name"].connect((s, k) => {
-                                       update_font_settings();
-                               });
-                       }
-
-                       ++s_diff_id;
-                       s_diff_map[s_diff_id.to_string()] = this;
-
-                       d_cancellable = new Cancellable();
-
-                       d_loaded = false;
-
-                       // Load the diff base html
-                       var uri = "gitg-diff:///resource/org/gnome/gitg/ui/diff-view/diff-view.html?viewid=" 
+ s_diff_id.to_string();
-
-                       uri += "&settings=" + Soup.URI.encode(json_settings(), null);
-
-                       load_uri(uri);
-               }
+               default = 3;
+       }
 
-               public DiffView()
-               {
-                       Object();
-               }
+       private void update_wrap()
+       {
+       }
 
-               public void loaded()
-               {
-                       d_loaded = true;
-                       update();
-               }
+       private void update_tab_width()
+       {
+       }
 
-               private void update_wrap()
+       private void update()
+       {
+               // If both `d_diff` and `d_commit` are null, clear
+               // the diff content
+               if (d_diff == null && d_commit == null)
                {
-                       if (!d_loaded)
-                       {
-                               return;
-                       }
-
-                       var v = d_wrap ? "true" : "false";
-
-                       run_javascript.begin("update_wrap(" + v + ");", null, (obj, res) => {
-                               try
-                               {
-                                       run_javascript.end(res);
-                               } catch {}
-                       });
+                       hide();
+                       return;
                }
 
-               private void update_tab_width()
-               {
-                       if (!d_loaded)
-                       {
-                               return;
-                       }
+               show();
 
-                       run_javascript.begin(@"update_tab_width($d_tab_width);", null, (obj, res) => {
-                               try
-                               {
-                                       run_javascript.end(res);
-                               } catch {}
-                       });
-               }
+               // Cancel running operations
+               d_cancellable.cancel();
+               d_cancellable = new Cancellable();
 
-               private void update()
+               if (d_commit != null)
                {
-                       if (!d_loaded)
-                       {
-                               return;
-                       }
+                       int parent = 0;
+                       var parents = d_commit.get_parents();
 
-                       // If both `d_diff` and `d_commit` are null, clear
-                       // the diff content
-                       if (d_diff == null && d_commit == null)
+                       if (d_parent != null)
                        {
-                               run_javascript.begin("update_diff();", d_cancellable, (obj, res) => {
-                                       try
-                                       {
-                                               run_javascript.end(res);
-                                       } catch {}
-                               });
-
-                               return;
-                       }
-
-                       // Cancel running operations
-                       d_cancellable.cancel();
-                       d_cancellable = new Cancellable();
-
-                       ++d_diffid;
-
-                       if (d_commit != null)
-                       {
-                               int parent = 0;
-                               var parents = d_commit.get_parents();
-
-                               if (d_parent != null)
+                               for (var i = 0; i < parents.size; i++)
                                {
-                                       for (var i = 0; i < parents.size; i++)
-                                       {
-                                               var id = parents.get_id(i);
+                                       var id = parents.get_id(i);
 
-                                               if (id.to_string() == d_parent)
-                                               {
-                                                       parent = i;
-                                                       break;
-                                               }
+                                       if (id.equal(d_parent))
+                                       {
+                                               parent = i;
+                                               break;
                                        }
                                }
-
-                               d_diff = d_commit.get_diff(options, parent);
                        }
 
-                       if (d_diff != null)
-                       {
-                               run_javascript.begin("update_diff(%lu, %s);".printf(d_diffid, 
json_settings()), d_cancellable, (obj, res) => {
-                                       try
-                                       {
-                                               run_javascript.end(res);
-                                       } catch {}
-                               });
-                       }
+                       d_diff = d_commit.get_diff(options, parent);
+                       d_commit_details.commit = d_commit;
+                       d_commit_details.show();
                }
-
-               public void update_has_selection(bool hs)
+               else
                {
-                       if (d_has_selection != hs)
-                       {
-                               d_has_selection = hs;
-                               notify_property("has-selection");
-                       }
+                       d_commit_details.commit = null;
+                       d_commit_details.hide();
                }
 
-               public void load_parent(string id)
+               if (d_diff != null)
                {
-                       request_select_commit(id);
-               }
-
-               public void select_parent(string id)
-               {
-                       d_parent = id;
-                       update();
+                       update_diff(d_diff, d_cancellable);
                }
+       }
 
-               public void open_url(string url)
-               {
-                       try
-                       {
-                               Gtk.show_uri(null, url, 0);
-                       } catch {}
-               }
+       private delegate void Anon();
 
-               private PatchSet parse_patchset(Json.Node node)
-               {
-                       PatchSet ret = new PatchSet();
+       private void update_diff(Ggit.Diff diff, Cancellable? cancellable)
+       {
+               Gitg.DiffViewFile? current_file = null;
+               Ggit.DiffHunk? current_hunk = null;
+               Gee.ArrayList<Ggit.DiffLine>? current_lines = null;
 
-                       var elems = node.get_array();
-                       ret.filename = elems.get_element(0).get_string();
+               Anon add_hunk = () => {
+                       if (current_hunk != null)
+                       {
+                               current_file.add_hunk(current_hunk, current_lines);
 
-                       var ps = elems.get_element(1).get_array();
+                               current_lines = null;
+                               current_hunk = null;
+                       }
+               };
 
-                       var l = ps.get_length();
-                       ret.patches = new PatchSet.Patch[l];
+               Anon add_file = () => {
+                       add_hunk();
 
-                       for (uint i = 0; i < l; i++)
+                       if (current_file != null)
                        {
-                               var p = ps.get_element(i).get_array();
-
-                               ret.patches[i] = PatchSet.Patch() {
-                                       type = (PatchSet.Type)p.get_element(0).get_int(),
-                                       old_offset = (size_t)p.get_element(1).get_int(),
-                                       new_offset = (size_t)p.get_element(2).get_int(),
-                                       length = (size_t)p.get_element(3).get_int()
-                               };
-                       }
+                               current_file.show();
+                               d_grid_files.add(current_file);
 
-                       return ret;
-               }
+                               current_file = null;
+                       }
+               };
 
-               public async PatchSet[] get_selection()
+               try
                {
-                       WebKit.JavascriptResult jsret;
-
-                       try
-                       {
-                               jsret = yield run_javascript("get_selection();", d_cancellable);
-                       }
-                       catch (Error e)
-                       {
-                               stderr.printf("Error running get_selection(): %s\n", e.message);
-                               return new PatchSet[] {};
-                       }
+                       diff.foreach(
+                               (delta, progress) => {
+                                       if (cancellable != null && cancellable.is_cancelled())
+                                       {
+                                               return 1;
+                                       }
 
-                       var json = GitgJsUtils.get_json(jsret);
-                       var parser = new Json.Parser();
+                                       add_file();
 
-                       try
-                       {
-                               parser.load_from_data(json, -1);
-                       }
-                       catch (Error e)
-                       {
-                               stderr.printf("Error parsing json: %s\n", e.message);
-                               return new PatchSet[] {};
-                       }
+                                       current_file = new Gitg.DiffViewFile(delta);
+                                       return 0;
+                               },
 
-                       var root = parser.get_root();
+                               (delta, binary) => {
+                                       // FIXME: do we want to handle binary data?
+                                       if (cancellable != null && cancellable.is_cancelled())
+                                       {
+                                               return 1;
+                                       }
 
-                       var elems = root.get_array();
-                       var l = elems.get_length();
+                                       return 0;
+                               },
 
-                       var ret = new PatchSet[l];
+                               (delta, hunk) => {
+                                       if (cancellable != null && cancellable.is_cancelled())
+                                       {
+                                               return 1;
+                                       }
 
-                       for (uint i = 0; i < l; i++)
-                       {
-                               ret[i] = parse_patchset(elems.get_element(i));
-                       }
+                                       add_hunk();
 
-                       return ret;
-               }
+                                       current_hunk = hunk;
+                                       current_lines = new Gee.ArrayList<Ggit.DiffLine>();
 
-               protected override bool context_menu(WebKit.ContextMenu   menu,
-                                                    Gdk.Event            event,
-                                                    WebKit.HitTestResult hit_test_result)
-               {
-                       var m = new Gtk.Popover(this);
-                       var opts = new DiffViewOptions(this);
+                                       return 0;
+                               },
 
-                       m.add(opts);
+                               (delta, hunk, line) => {
+                                       if (cancellable != null && cancellable.is_cancelled())
+                                       {
+                                               return 1;
+                                       }
 
-                       if (event.type == Gdk.EventType.BUTTON_PRESS ||
-                           event.type == Gdk.EventType.BUTTON_RELEASE)
-                       {
-                               var r = Gdk.Rectangle() {
-                                       x = (int)event.button.x,
-                                       y = (int)event.button.y,
-                                       width = 1,
-                                       height = 1
-                               };
-
-                               m.set_pointing_to(r);
-                       }
+                                       if ((delta.get_flags() & Ggit.DiffFlag.BINARY) == 0)
+                                       {
+                                               current_lines.add(line);
+                                       }
 
-                       opts.show();
-                       m.show();
+                                       return 0;
+                               }
+                       );
+               } catch {}
 
-                       opts.notify["visible"].connect(() => {
-                               m.destroy();
-                       });
+               add_hunk();
+               add_file();
+       }
 
-                       return true;
-               }
+       public async PatchSet[] get_selection()
+       {
+               // TODO
+               return new PatchSet[] {};
        }
 }
 
diff --git a/libgitg/gitg-init.vala b/libgitg/gitg-init.vala
index 63d8df5..6bf042e 100644
--- a/libgitg/gitg-init.vala
+++ b/libgitg/gitg-init.vala
@@ -68,6 +68,17 @@ public void init() throws Error
 
        factory.register(typeof(Ggit.Remote),
                         typeof(Gitg.Remote));
+
+       // Add our own css provider
+       Gtk.CssProvider? provider = Gitg.Resource.load_css("libgitg-style.css");
+
+       if (provider != null)
+       {
+               Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(),
+                                                        provider,
+                                                        600);
+       }
+
 }
 
 }
diff --git a/gitg/gitg-resource.vala b/libgitg/gitg-resource.vala
similarity index 57%
rename from gitg/gitg-resource.vala
rename to libgitg/gitg-resource.vala
index 581f259..568fd3c 100644
--- a/gitg/gitg-resource.vala
+++ b/libgitg/gitg-resource.vala
@@ -17,39 +17,24 @@
  * along with gitg. If not, see <http://www.gnu.org/licenses/>.
  */
 
-namespace Gitg
+public class Gitg.Resource
 {
-       class Resource
+       public static Gtk.CssProvider? load_css(string id)
        {
-               public static T? load_object<T>(string id, string object)
-               {
-                       var ret = GitgExt.UI.from_builder(id, object);
-
-                       if (ret == null)
-                       {
-                               return null;
-                       }
+               var provider = new Gtk.CssProvider();
+               var f = File.new_for_uri("resource:///org/gnome/gitg/ui/" + id);
 
-                       return (T?)ret[object];
+               try
+               {
+                       provider.load_from_file(f);
                }
-
-               public static Gtk.CssProvider? load_css(string id)
+               catch (Error e)
                {
-                       var provider = new Gtk.CssProvider();
-                       var f = File.new_for_uri("resource:///org/gnome/gitg/ui/" + id);
-
-                       try
-                       {
-                               provider.load_from_file(f);
-                       }
-                       catch (Error e)
-                       {
-                               warning("Error while loading resource: %s", e.message);
-                               return null;
-                       }
-
-                       return provider;
+                       warning("Error while loading resource: %s", e.message);
+                       return null;
                }
+
+               return provider;
        }
 }
 
diff --git a/libgitg/resources/resources.xml b/libgitg/resources/resources.xml
index 6368ba6..0f520f4 100644
--- a/libgitg/resources/resources.xml
+++ b/libgitg/resources/resources.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <gresources>
   <gresource prefix="/org/gnome/gitg">
-    <file compressed="true">ui/diff-view/diff-view.html</file>
-    <file compressed="true">ui/diff-view/diff-view.js</file>
-    <file compressed="true">ui/diff-view/diff-view-html-builder.js</file>
-    <file compressed="true">ui/diff-view/diff-view.css</file>
-    <file compressed="true">ui/diff-view/jquery-2.0.3.min.js</file>
-    <file compressed="true">ui/diff-view/diff-view-options.ui</file>
-
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-repository-list-box-row.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-authentication-dialog.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-diff-view.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-diff-view-file.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-diff-view-hunk.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-diff-view-options.ui</file>
+    <file compressed="true" preprocess="xml-stripblanks">ui/gitg-diff-view-commit-details.ui</file>
     <file compressed="true" preprocess="xml-stripblanks">ui/gitg-sidebar.ui</file>
+
+    <file compressed="true">ui/libgitg-style.css</file>
   </gresource>
 </gresources>
 
diff --git a/libgitg/resources/ui/gitg-diff-view-commit-details.ui 
b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
new file mode 100644
index 0000000..f08c07b
--- /dev/null
+++ b/libgitg/resources/ui/gitg-diff-view-commit-details.ui
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.19.0 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <template class="GitgDiffViewCommitDetails" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">12</property>
+    <property name="row_spacing">6</property>
+    <property name="column_spacing">6</property>
+    <child>
+      <object class="GtkImage" id="image_avatar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">start</property>
+        <property name="valign">start</property>
+        <property name="pixel_size">70</property>
+        <property name="icon_name">avatar-default-symbolic</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="grid_author_committer">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="GtkLabel" id="label_author">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="label">Author name &amp;lt;&lt;a href="email example com"&gt;email example 
com&lt;/a&gt;&amp;gt;</property>
+            <property name="selectable">True</property>
+            <property name="ellipsize">end</property>
+            <property name="use_markup">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_author_date">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="label">Author date</property>
+            <property name="selectable">True</property>
+            <property name="ellipsize">end</property>
+            <attributes>
+              <attribute name="scale" value="0.833333333333333"/>
+            </attributes>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_committer">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="margin_top">6</property>
+            <property name="label">Committer name &amp;lt;&lt;a href="email example com"&gt;email example 
com&lt;/a&gt;&amp;gt;</property>
+            <property name="selectable">True</property>
+            <property name="ellipsize">end</property>
+            <property name="use_markup">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label_committer_date">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="valign">start</property>
+            <property name="label">Committer date</property>
+            <property name="selectable">True</property>
+            <property name="ellipsize">end</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_subject">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">start</property>
+        <property name="valign">start</property>
+        <property name="margin_top">6</property>
+        <property name="margin_bottom">6</property>
+        <property name="label">Subject</property>
+        <property name="wrap">True</property>
+        <property name="selectable">True</property>
+        <property name="ellipsize">end</property>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">1</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkLabel" id="label_sha1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="halign">end</property>
+        <property name="valign">start</property>
+        <property name="label">0000000000000000000000000000000000000000</property>
+        <property name="selectable">True</property>
+        <property name="ellipsize">end</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">3</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="grid_parents_container">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="margin_bottom">12</property>
+        <property name="row_spacing">6</property>
+        <property name="column_spacing">6</property>
+        <child>
+          <object class="GtkLabel" id="label_parents">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Parents</property>
+            <property name="xalign">0</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid_parents">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="margin_start">12</property>
+            <property name="hexpand">True</property>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">2</property>
+        <property name="width">2</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkExpander" id="expander_files">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="valign">baseline</property>
+        <child type="label">
+          <object class="GtkLabel" id="label_expand_collapse_files">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Collapse all</property>
+          </object>
+        </child>
+        <style>
+          <class name="dim-label"/>
+        </style>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">3</property>
+      </packing>
+    </child>
+  </template>
+</interface>
diff --git a/libgitg/resources/ui/gitg-diff-view-file.ui b/libgitg/resources/ui/gitg-diff-view-file.ui
new file mode 100644
index 0000000..979317d
--- /dev/null
+++ b/libgitg/resources/ui/gitg-diff-view-file.ui
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.19.0 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GitgDiffViewFile" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <style>
+      <class name="gitg-file-header"/>
+    </style>
+    <child>
+      <object class="GtkExpander" id="expander">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="hexpand">True</property>
+        <child>
+          <object class="GtkGrid" id="grid_hunks">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+          </object>
+        </child>
+        <child type="label">
+          <object class="GtkGrid" id="grid_file_header">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <property name="orientation">horizontal</property>
+            <child>
+              <object class="GitgDiffStat" id="diff_stat_file">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="vexpand">False</property>
+                <property name="valign">baseline</property>
+                <property name="margin_top">12</property>
+                <property name="margin_bottom">12</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkLabel" id="label_file_header">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label">the/file/header</property>
+                <property name="halign">start</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/libgitg/resources/ui/gitg-diff-view-hunk.ui b/libgitg/resources/ui/gitg-diff-view-hunk.ui
new file mode 100644
index 0000000..302b077
--- /dev/null
+++ b/libgitg/resources/ui/gitg-diff-view-hunk.ui
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.19.0 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GitgDiffViewHunk" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">True</property>
+    <property name="hexpand">True</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkEventBox" id="event_box_hunk">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <style>
+          <class name="gitg-hunk-header"/>
+        </style>
+        <child>
+          <object class="GtkLabel" id="label_hunk">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">start</property>
+            <property name="margin_top">12</property>
+            <property name="margin_bottom">12</property>
+            <property name="margin_start">6</property>
+            <property name="margin_end">6</property>
+            <property name="wrap">True</property>
+            <style>
+              <class name="dim-label"/>
+            </style>
+          </object>
+        </child>
+      </object>
+    </child>
+    <child>
+      <object class="GtkFrame" id="frame_hunk">
+        <property name="visible">True</property>
+        <style>
+          <class name="gitg-hunk-frame"/>
+        </style>
+        <child>
+          <object class="GtkSourceView" id="sourceview_hunk">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="show_line_numbers">False</property>
+            <property name="editable">False</property>
+            <property name="cursor_visible">False</property>
+            <property name="monospace">True</property>
+            <property name="hexpand">True</property>
+            <property name="pixels_above_lines">1</property>
+            <property name="pixels_below_lines">1</property>
+            <style>
+              <class name="gitg-hunk-source"/>
+            </style>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/libgitg/resources/ui/diff-view/diff-view-options.ui 
b/libgitg/resources/ui/gitg-diff-view-options.ui
similarity index 86%
rename from libgitg/resources/ui/diff-view/diff-view-options.ui
rename to libgitg/resources/ui/gitg-diff-view-options.ui
index 6f3ac33..7d301c3 100644
--- a/libgitg/resources/ui/diff-view/diff-view-options.ui
+++ b/libgitg/resources/ui/gitg-diff-view-options.ui
@@ -107,31 +107,6 @@
       </packing>
     </child>
     <child>
-      <object class="GtkButton" id="button_developer_tools">
-        <property name="label" translatable="yes">Developer tools</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="relief">none</property>
-        <signal name="clicked" handler="on_button_developer_tools_clicked" swapped="no"/>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">7</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkSeparator" id="separator_developer_tools">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-      </object>
-      <packing>
-        <property name="left_attach">0</property>
-        <property name="top_attach">6</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
       <object class="GtkLabel" id="label_context1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
diff --git a/libgitg/resources/ui/gitg-diff-view.ui b/libgitg/resources/ui/gitg-diff-view.ui
new file mode 100644
index 0000000..82b3bc9
--- /dev/null
+++ b/libgitg/resources/ui/gitg-diff-view.ui
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.19.0 -->
+<interface>
+  <requires lib="gtk+" version="3.16"/>
+  <template class="GitgDiffView" parent="GtkScrolledWindow">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkViewport" id="viewport">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child>
+          <object class="GtkGrid" id="grid_main">
+            <property name="visible">True</property>
+            <property name="orientation">vertical</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <child>
+              <object class="GitgDiffViewCommitDetails" id="commit_details">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid_files">
+                <property name="visible">True</property>
+                <property name="orientation">vertical</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/libgitg/resources/ui/libgitg-style.css b/libgitg/resources/ui/libgitg-style.css
new file mode 100644
index 0000000..0a14c06
--- /dev/null
+++ b/libgitg/resources/ui/libgitg-style.css
@@ -0,0 +1,76 @@
+.gitg-hunk-header {
+       border-top: 1px solid shade(@borders, 1.2);
+       background-color: @theme_bg_color;
+}
+
+.gitg-file-header {
+       transition: 0.1s ease-out;
+       background-color: @theme_bg_color;
+}
+
+.gitg-file-header.expanded {
+       transition: 0.1s ease-out;
+       background-color: shade(@theme_bg_color, 0.95);
+}
+
+.gitg-hunk-frame {
+       border-left: 0;
+       border-right: 0;
+}
+
+.gitg-diff-view-grid-files {
+       border-top: 1px solid @borders;
+}
+
+GitgDiffStat {
+       border: 1px inset shade(@borders, 1.2);
+       border-radius: 5px;
+       background-color: shade(@theme_bg_color, 1.2);
+       -GitgDiffStat-bar-height: 5px;
+}
+
+GitgDiffStat.no-frame {
+       border: 0;
+       border-radius: 0;
+       background-color: inherit;
+}
+
+GitgDiffStat added,
+GitgDiffStat removed,
+GitgDiffStat.no-frame added,
+GitgDiffStat.no-frame removed {
+       border: 0;
+}
+
+GitgDiffStat added,
+GitgDiffStat.no-frame added {
+       background-color: #33cc33;
+       border-radius: 3px 0px 0px 3px;
+}
+
+GitgDiffStat added:dir(rtl),
+GitgDiffStat.no-frame added:dir(rtl) {
+       border-radius: 0px 3px 3px 0px;
+}
+
+GitgDiffStat removed,
+GitgDiffStat.no-frame removed {
+       background-color: #cc3333;
+       border-radius: 0px 3px 3px 0px;
+}
+
+GitgDiffStat removed:dir(rtl),
+GitgDiffStat.no-frame removed:dir(rtl) {
+       border-radius: 3px 0px 0px 3px;
+}
+
+GitgDiffStat removed:only-child,
+GitgDiffStat added:only-child,
+GitgDiffStat.no-frame removed:only-child,
+GitgDiffStat.no-frame added:only-child {
+       border-radius: 3px;
+}
+
+GitgDiffStat {
+       padding: 1px 5px 1px 3px;
+}
diff --git a/plugins/diff/gitg-diff.vala b/plugins/diff/gitg-diff.vala
index 0e5e126..76a9bed 100644
--- a/plugins/diff/gitg-diff.vala
+++ b/plugins/diff/gitg-diff.vala
@@ -87,22 +87,6 @@ namespace GitgDiff
 
                        history.selection_changed.connect(on_selection_changed);
                        on_selection_changed(history);
-
-                       d_diff.request_select_commit.connect((id) => {
-                               Gitg.Commit commit;
-
-                               try
-                               {
-                                       commit = application.repository.lookup<Gitg.Commit>(new 
Ggit.OId.from_string(id));
-                               }
-                               catch (Error e)
-                               {
-                                       stderr.printf("Failed to lookup commit '%s': %s\n", id, e.message);
-                                       return;
-                               }
-
-                               history.select(commit);
-                       });
                }
 
                public string id
diff --git a/plugins/files/gitg-files.vala b/plugins/files/gitg-files.vala
index 385c356..6c78019 100644
--- a/plugins/files/gitg-files.vala
+++ b/plugins/files/gitg-files.vala
@@ -29,7 +29,7 @@ namespace GitgFiles
 
                private TreeStore d_model;
                private Gtk.Paned d_paned;
-               private GtkSource.View d_source;
+               private Gtk.SourceView d_source;
                private Settings? d_fontsettings;
                private Settings? d_stylesettings;
 
@@ -93,12 +93,12 @@ namespace GitgFiles
                private void update_style()
                {
                        var scheme = d_stylesettings.get_string("scheme");
-                       var manager = GtkSource.StyleSchemeManager.get_default();
+                       var manager = Gtk.SourceStyleSchemeManager.get_default();
                        var s = manager.get_scheme(scheme);
 
                        if (s != null)
                        {
-                               var buf = d_source.get_buffer() as GtkSource.Buffer;
+                               var buf = d_source.get_buffer() as Gtk.SourceBuffer;
                                buf.set_style_scheme(s);
                        }
                }
@@ -135,7 +135,7 @@ namespace GitgFiles
                        tv.get_selection().changed.connect(selection_changed);
 
                        d_scrolled_files = ret["scrolled_window_files"] as Gtk.ScrolledWindow;
-                       d_source = ret["source_view_file"] as GtkSource.View;
+                       d_source = ret["source_view_file"] as Gtk.SourceView;
                        d_paned = ret["paned_files"] as Gtk.Paned;
                        d_scrolled = ret["scrolled_window_file"] as Gtk.ScrolledWindow;
 
@@ -206,7 +206,7 @@ namespace GitgFiles
                        Gtk.TreeModel mod;
                        Gtk.TreeIter iter;
 
-                       var buf = d_source.get_buffer() as GtkSource.Buffer;
+                       var buf = d_source.get_buffer() as Gtk.SourceBuffer;
                        buf.set_text("");
 
                        if (!selection.get_selected(out mod, out iter) || d_model.get_isdir(iter))
@@ -253,7 +253,7 @@ namespace GitgFiles
                        }
                        else if (ContentType.is_a(ct, "text/plain"))
                        {
-                               var manager = GtkSource.LanguageManager.get_default();
+                               var manager = Gtk.SourceLanguageManager.get_default();
 
                                buf.set_text((string)content);
                                buf.language = manager.guess_language(fname, ct);
diff --git a/tests/diff-view.vala b/tests/diff-view.vala
index 7a0b77d..804b7f9 100644
--- a/tests/diff-view.vala
+++ b/tests/diff-view.vala
@@ -107,41 +107,23 @@ class TestDiffView
 
                var wnd = new Gtk.Window();
                wnd.set_default_size(800, 600);
+
                var sw = new Gtk.ScrolledWindow(null, null);
+               sw.show();
 
                var v = new Gitg.DiffView();
+               v.show();
                sw.add(v);
 
                v.commit = commit;
 
-               v.key_press_event.connect((vv, ev) => {
-                       var state = ev.state & Gtk.accelerator_get_default_mod_mask();
-
-                       if (ev.keyval == Gdk.Key.r && state == Gdk.ModifierType.CONTROL_MASK)
-                       {
-                               v.reload_bypass_cache();
-                               return true;
-                       }
-                       else
-                       {
-                               return false;
-                       }
-               });
-
                wnd.delete_event.connect((w, ev) => {
                        Gtk.main_quit();
                        return true;
                });
 
                wnd.add(sw);
-               wnd.show_all();
-
-               if (Environment.get_variable("GITG_GTK_DIFF_VIEW_DEBUG") != "local")
-               {
-                       stdout.printf("Use `diff-view --local' to use local resources.\n");
-               }
-
-               stdout.printf("Press Ctrl+R to refresh...\n");
+               wnd.show();
 
                Gtk.main();
                return 0;
diff --git a/tests/gitg/Makefile.am b/tests/gitg/Makefile.am
index 7dfd6c1..313de0e 100644
--- a/tests/gitg/Makefile.am
+++ b/tests/gitg/Makefile.am
@@ -17,7 +17,6 @@ tests_gitg_test_gitg_VALAFLAGS =              \
        --pkg gtk+-3.0                          \
        --pkg gee-0.8                           \
        --pkg libsoup-2.4                       \
-       --pkg $(WEBKIT_PKGCONFIG)               \
        --pkg config                            \
        $(GITG_VALAFLAGS)                       \
        --vapidir $(top_srcdir)/tests/support   \
diff --git a/tests/libgitg/Makefile.am b/tests/libgitg/Makefile.am
index 1581031..88b0da1 100644
--- a/tests/libgitg/Makefile.am
+++ b/tests/libgitg/Makefile.am
@@ -17,7 +17,6 @@ tests_libgitg_test_libgitg_VALAFLAGS =                \
        --pkg gtk+-3.0                          \
        --pkg gee-0.8                           \
        --pkg libsoup-2.4                       \
-       --pkg $(WEBKIT_PKGCONFIG)               \
        --pkg config                            \
        $(GITG_VALAFLAGS)                       \
        --vapidir $(top_srcdir)/tests/support   \
diff --git a/vapi/gtksourceview-3.0.vapi b/vapi/gtksourceview-3.0.vapi
index 0d6e008..e8fb8bf 100644
--- a/vapi/gtksourceview-3.0.vapi
+++ b/vapi/gtksourceview-3.0.vapi
@@ -1,21 +1,22 @@
-/* gtksourceview-3.0.vapi generated by vapigen, do not modify. */
+/* gtksourceview-3.0.vapi generated by vapigen-0.28, do not modify. */
 
-[CCode (cprefix = "GtkSource", gir_namespace = "GtkSource", gir_version = "3.0", lower_case_cprefix = 
"gtk_source_")]
-namespace GtkSource {
-       namespace CompletionCapability {
-               [CCode (cheader_filename = "gtksourceview/gtksource.h", cname = 
"GTK_SOURCE_COMPLETION_CAPABILITY_AUTOMATIC")]
-               public const string AUTOMATIC;
-               [CCode (cheader_filename = "gtksourceview/gtksource.h", cname = 
"GTK_SOURCE_COMPLETION_CAPABILITY_INTERACTIVE")]
-               public const string INTERACTIVE;
+[CCode (cprefix = "Gtk", gir_namespace = "GtkSource", gir_version = "3.0", lower_case_cprefix = "gtk_")]
+namespace Gtk {
+       namespace SourceUtils {
+               [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+               public static string escape_search_text (string text);
+               [CCode (cheader_filename = "gtksourceview/gtksource.h")]
+               public static string unescape_search_text (string text);
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_buffer_get_type ()")]
        [GIR (name = "Buffer")]
-       public class Buffer : Gtk.TextBuffer {
+       public class SourceBuffer : Gtk.TextBuffer {
                [CCode (has_construct_function = false)]
-               public Buffer (Gtk.TextTagTable? table);
+               public SourceBuffer (Gtk.TextTagTable? table);
                public bool backward_iter_to_source_mark (Gtk.TextIter iter, string? category);
                public void begin_not_undoable_action ();
-               public unowned GtkSource.Mark create_source_mark (string? name, string category, Gtk.TextIter 
where);
+               public void change_case (Gtk.SourceChangeCaseType case_type, Gtk.TextIter start, Gtk.TextIter 
end);
+               public unowned Gtk.SourceMark create_source_mark (string? name, string category, Gtk.TextIter 
where);
                public void end_not_undoable_action ();
                public void ensure_highlight (Gtk.TextIter start, Gtk.TextIter end);
                public bool forward_iter_to_source_mark (Gtk.TextIter iter, string? category);
@@ -23,59 +24,64 @@ namespace GtkSource {
                public string[] get_context_classes_at_iter (Gtk.TextIter iter);
                public bool get_highlight_matching_brackets ();
                public bool get_highlight_syntax ();
-               public unowned GtkSource.Language get_language ();
+               public bool get_implicit_trailing_newline ();
+               public unowned Gtk.SourceLanguage get_language ();
                public int get_max_undo_levels ();
-               public GLib.SList<weak GtkSource.Mark> get_source_marks_at_iter (Gtk.TextIter iter, string? 
category);
-               public GLib.SList<weak GtkSource.Mark> get_source_marks_at_line (int line, string? category);
-               public unowned GtkSource.StyleScheme get_style_scheme ();
-               public unowned GtkSource.UndoManager get_undo_manager ();
-               public bool iter_backward_to_context_class_toggle (Gtk.TextIter iter, string context_class);
-               public bool iter_forward_to_context_class_toggle (Gtk.TextIter iter, string context_class);
+               public GLib.SList<weak Gtk.SourceMark> get_source_marks_at_iter (Gtk.TextIter iter, string? 
category);
+               public GLib.SList<weak Gtk.SourceMark> get_source_marks_at_line (int line, string? category);
+               public unowned Gtk.SourceStyleScheme get_style_scheme ();
+               public unowned Gtk.SourceUndoManager? get_undo_manager ();
+               public bool iter_backward_to_context_class_toggle (ref Gtk.TextIter iter, string 
context_class);
+               public bool iter_forward_to_context_class_toggle (ref Gtk.TextIter iter, string 
context_class);
                public bool iter_has_context_class (Gtk.TextIter iter, string context_class);
+               public void join_lines (Gtk.TextIter start, Gtk.TextIter end);
                public void remove_source_marks (Gtk.TextIter start, Gtk.TextIter end, string? category);
                public void set_highlight_matching_brackets (bool highlight);
                public void set_highlight_syntax (bool highlight);
-               public void set_language (GtkSource.Language? language);
+               public void set_implicit_trailing_newline (bool implicit_trailing_newline);
+               public void set_language (Gtk.SourceLanguage? language);
                public void set_max_undo_levels (int max_undo_levels);
-               public void set_style_scheme (GtkSource.StyleScheme? scheme);
-               public void set_undo_manager (GtkSource.UndoManager? manager);
+               public void set_style_scheme (Gtk.SourceStyleScheme? scheme);
+               public void set_undo_manager (Gtk.SourceUndoManager? manager);
                [CCode (has_construct_function = false)]
-               public Buffer.with_language (GtkSource.Language language);
+               public SourceBuffer.with_language (Gtk.SourceLanguage language);
                [NoAccessorMethod]
                public bool can_redo { get; }
                [NoAccessorMethod]
                public bool can_undo { get; }
                public bool highlight_matching_brackets { get; set; }
                public bool highlight_syntax { get; set; }
-               public GtkSource.Language language { get; set; }
+               public bool implicit_trailing_newline { get; set construct; }
+               public Gtk.SourceLanguage language { get; set; }
                public int max_undo_levels { get; set; }
-               public GtkSource.StyleScheme style_scheme { get; set; }
-               public GtkSource.UndoManager undo_manager { get; set construct; }
-               public virtual signal void bracket_matched (Gtk.TextIter iter, GtkSource.BracketMatchType 
state);
-               public signal void highlight_updated (Gtk.TextIter object, Gtk.TextIter p0);
+               public Gtk.SourceStyleScheme style_scheme { get; set; }
+               public Gtk.SourceUndoManager undo_manager { get; set construct; }
+               public virtual signal void bracket_matched (Gtk.TextIter iter, Gtk.SourceBracketMatchType 
state);
+               public signal void highlight_updated (Gtk.TextIter start, Gtk.TextIter end);
                [HasEmitter]
                public virtual signal void redo ();
-               public signal void source_mark_updated (Gtk.TextMark object);
+               public signal void source_mark_updated (Gtk.TextMark mark);
                [HasEmitter]
                public virtual signal void undo ();
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_get_type 
()")]
        [GIR (name = "Completion")]
-       public class Completion : GLib.Object {
+       public class SourceCompletion : GLib.Object, Gtk.Buildable {
                [CCode (has_construct_function = false)]
-               protected Completion ();
-               public bool add_provider (GtkSource.CompletionProvider provider) throws GLib.Error;
+               protected SourceCompletion ();
+               public bool add_provider (Gtk.SourceCompletionProvider provider) throws GLib.Error;
                public void block_interactive ();
-               public GtkSource.CompletionContext create_context (Gtk.TextIter? position);
-               public unowned GtkSource.CompletionInfo get_info_window ();
-               public unowned GLib.List<GtkSource.CompletionProvider> get_providers ();
-               public unowned GtkSource.View get_view ();
+               public unowned Gtk.SourceCompletionContext create_context (Gtk.TextIter? position);
+               public unowned Gtk.SourceCompletionInfo get_info_window ();
+               public unowned GLib.List<Gtk.SourceCompletionProvider> get_providers ();
+               public unowned Gtk.SourceView get_view ();
+               [Deprecated (since = "3.8")]
                public void move_window (Gtk.TextIter iter);
                [NoWrapper]
-               public virtual bool proposal_activated (GtkSource.CompletionProvider provider, 
GtkSource.CompletionProposal proposal);
-               public bool remove_provider (GtkSource.CompletionProvider provider) throws GLib.Error;
+               public virtual bool proposal_activated (Gtk.SourceCompletionProvider provider, 
Gtk.SourceCompletionProposal proposal);
+               public bool remove_provider (Gtk.SourceCompletionProvider provider) throws GLib.Error;
                [CCode (cname = "gtk_source_completion_show")]
-               public bool start (GLib.List<GtkSource.CompletionProvider>? providers, owned 
GtkSource.CompletionContext context);
+               public bool start (GLib.List<Gtk.SourceCompletionProvider>? providers, 
Gtk.SourceCompletionContext context);
                public void unblock_interactive ();
                [NoAccessorMethod]
                public uint accelerators { get; set construct; }
@@ -93,50 +99,54 @@ namespace GtkSource {
                public bool show_headers { get; set construct; }
                [NoAccessorMethod]
                public bool show_icons { get; set construct; }
-               public GtkSource.View view { get; construct; }
+               public Gtk.SourceView view { get; construct; }
                public virtual signal void activate_proposal ();
                [HasEmitter]
                public virtual signal void hide ();
                public virtual signal void move_cursor (Gtk.ScrollStep step, int num);
                public virtual signal void move_page (Gtk.ScrollStep step, int num);
-               public virtual signal void populate_context (GtkSource.CompletionContext context);
+               public virtual signal void populate_context (Gtk.SourceCompletionContext context);
                public virtual signal void show ();
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_context_get_type ()")]
        [GIR (name = "CompletionContext")]
-       public class CompletionContext : GLib.InitiallyUnowned {
+       public class SourceCompletionContext : GLib.InitiallyUnowned {
                [CCode (has_construct_function = false)]
-               protected CompletionContext ();
-               public void add_proposals (GtkSource.CompletionProvider provider, 
GLib.List<GtkSource.CompletionProposal> proposals, bool finished);
-               public GtkSource.CompletionActivation get_activation ();
-               public Gtk.TextIter get_iter ();
+               protected SourceCompletionContext ();
+               public void add_proposals (Gtk.SourceCompletionProvider provider, 
GLib.List<Gtk.SourceCompletionProposal>? proposals, bool finished);
+               public Gtk.SourceCompletionActivation get_activation ();
+               public bool get_iter (out Gtk.TextIter iter);
                [NoAccessorMethod]
-               public GtkSource.CompletionActivation activation { get; set; }
+               public Gtk.SourceCompletionActivation activation { get; set construct; }
                [NoAccessorMethod]
-               public GtkSource.Completion completion { owned get; construct; }
+               public Gtk.SourceCompletion completion { owned get; construct; }
                [NoAccessorMethod]
                public Gtk.TextIter iter { get; set; }
                public virtual signal void cancelled ();
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_info_get_type ()")]
        [GIR (name = "CompletionInfo")]
-       public class CompletionInfo : Gtk.Window, Atk.Implementor, Gtk.Buildable {
+       public class SourceCompletionInfo : Gtk.Window, Atk.Implementor, Gtk.Buildable {
                [CCode (has_construct_function = false)]
-               public CompletionInfo ();
+               public SourceCompletionInfo ();
+               [Deprecated (since = "3.8")]
                public unowned Gtk.Widget get_widget ();
                public void move_to_iter (Gtk.TextView view, Gtk.TextIter? iter);
+               [Deprecated (since = "3.8")]
                public void set_widget (Gtk.Widget? widget);
+               [Deprecated (since = "3.10")]
                public virtual signal void before_show ();
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_item_get_type ()")]
        [GIR (name = "CompletionItem")]
-       public class CompletionItem : GLib.Object, GtkSource.CompletionProposal {
+       public class SourceCompletionItem : GLib.Object, Gtk.SourceCompletionProposal {
                [CCode (has_construct_function = false)]
-               public CompletionItem (string label, string text, Gdk.Pixbuf? icon, string? info);
+               public SourceCompletionItem (string label, string text, Gdk.Pixbuf? icon, string? info);
                [CCode (has_construct_function = false)]
-               public CompletionItem.from_stock (string? label, string text, string stock, string? info);
+               [Deprecated (since = "3.10")]
+               public SourceCompletionItem.from_stock (string? label, string text, string stock, string? 
info);
                [CCode (has_construct_function = false)]
-               public CompletionItem.with_markup (string markup, string text, Gdk.Pixbuf? icon, string? 
info);
+               public SourceCompletionItem.with_markup (string markup, string text, Gdk.Pixbuf? icon, 
string? info);
                [NoAccessorMethod]
                public Gdk.Pixbuf icon { owned get; set; }
                [NoAccessorMethod]
@@ -150,12 +160,14 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_words_get_type ()")]
        [GIR (name = "CompletionWords")]
-       public class CompletionWords : GLib.Object, GtkSource.CompletionProvider {
+       public class SourceCompletionWords : GLib.Object, Gtk.SourceCompletionProvider {
                [CCode (has_construct_function = false)]
-               public CompletionWords (string? name, Gdk.Pixbuf? icon);
+               public SourceCompletionWords (string? name, Gdk.Pixbuf? icon);
                public void register (Gtk.TextBuffer buffer);
                public void unregister (Gtk.TextBuffer buffer);
                [NoAccessorMethod]
+               public Gtk.SourceCompletionActivation activation { get; set construct; }
+               [NoAccessorMethod]
                public Gdk.Pixbuf icon { owned get; set construct; }
                [NoAccessorMethod]
                public int interactive_delay { get; set construct; }
@@ -170,42 +182,128 @@ namespace GtkSource {
                [NoAccessorMethod]
                public uint scan_batch_size { get; set construct; }
        }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", copy_function = "g_boxed_copy", free_function 
= "g_boxed_free", type_id = "gtk_source_encoding_get_type ()")]
+       [Compact]
+       [GIR (name = "Encoding")]
+       public class SourceEncoding {
+               public Gtk.SourceEncoding copy ();
+               [CCode (cname = "gtk_source_encoding_get_all")]
+               public static GLib.SList<weak Gtk.SourceEncoding> et_all ();
+               [CCode (cname = "gtk_source_encoding_get_current")]
+               public static unowned Gtk.SourceEncoding et_current ();
+               [CCode (cname = "gtk_source_encoding_get_from_charset")]
+               public static unowned Gtk.SourceEncoding? et_from_charset (string charset);
+               [CCode (cname = "gtk_source_encoding_get_utf8")]
+               public static unowned Gtk.SourceEncoding et_utf8 ();
+               public void free ();
+               public unowned string get_charset ();
+               public unowned string get_name ();
+               public string to_string ();
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_get_type ()")]
+       [GIR (name = "File")]
+       public class SourceFile : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public SourceFile ();
+               public Gtk.SourceCompressionType get_compression_type ();
+               public unowned Gtk.SourceEncoding get_encoding ();
+               public unowned GLib.File get_location ();
+               public Gtk.SourceNewlineType get_newline_type ();
+               public void set_location (GLib.File? location);
+               public Gtk.SourceCompressionType compression_type { get; }
+               public Gtk.SourceEncoding encoding { get; }
+               public GLib.File location { get; set; }
+               public Gtk.SourceNewlineType newline_type { get; }
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_loader_get_type 
()")]
+       [GIR (name = "FileLoader")]
+       public class SourceFileLoader : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public SourceFileLoader (Gtk.SourceBuffer buffer, Gtk.SourceFile file);
+               [CCode (has_construct_function = false)]
+               public SourceFileLoader.from_stream (Gtk.SourceBuffer buffer, Gtk.SourceFile file, 
GLib.InputStream stream);
+               public unowned Gtk.SourceBuffer get_buffer ();
+               public Gtk.SourceCompressionType get_compression_type ();
+               public unowned Gtk.SourceEncoding get_encoding ();
+               public unowned Gtk.SourceFile get_file ();
+               public unowned GLib.InputStream get_input_stream ();
+               public unowned GLib.File get_location ();
+               public Gtk.SourceNewlineType get_newline_type ();
+               public async bool load_async (int io_priority, GLib.Cancellable? cancellable, owned 
GLib.FileProgressCallback? progress_callback) throws GLib.Error;
+               public void set_candidate_encodings (GLib.SList<Gtk.SourceEncoding> candidate_encodings);
+               public Gtk.SourceBuffer buffer { get; construct; }
+               public Gtk.SourceFile file { get; construct; }
+               public GLib.InputStream input_stream { get; construct; }
+               public GLib.File location { get; construct; }
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_file_saver_get_type 
()")]
+       [GIR (name = "FileSaver")]
+       public class SourceFileSaver : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public SourceFileSaver (Gtk.SourceBuffer buffer, Gtk.SourceFile file);
+               public unowned Gtk.SourceBuffer get_buffer ();
+               public Gtk.SourceCompressionType get_compression_type ();
+               public unowned Gtk.SourceEncoding get_encoding ();
+               public unowned Gtk.SourceFile get_file ();
+               public Gtk.SourceFileSaverFlags get_flags ();
+               public unowned GLib.File get_location ();
+               public Gtk.SourceNewlineType get_newline_type ();
+               public async bool save_async (int io_priority, GLib.Cancellable? cancellable, owned 
GLib.FileProgressCallback? progress_callback) throws GLib.Error;
+               public void set_compression_type (Gtk.SourceCompressionType compression_type);
+               public void set_encoding (Gtk.SourceEncoding? encoding);
+               public void set_flags (Gtk.SourceFileSaverFlags flags);
+               public void set_newline_type (Gtk.SourceNewlineType newline_type);
+               [CCode (has_construct_function = false)]
+               public SourceFileSaver.with_target (Gtk.SourceBuffer buffer, Gtk.SourceFile file, GLib.File 
target_location);
+               public Gtk.SourceBuffer buffer { get; construct; }
+               public Gtk.SourceCompressionType compression_type { get; set construct; }
+               public Gtk.SourceEncoding encoding { get; set construct; }
+               public Gtk.SourceFile file { get; construct; }
+               public Gtk.SourceFileSaverFlags flags { get; set construct; }
+               public GLib.File location { get; construct; }
+               public Gtk.SourceNewlineType newline_type { get; set construct; }
+       }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_get_type ()")]
        [GIR (name = "Gutter")]
-       public class Gutter : GLib.Object {
+       public class SourceGutter : GLib.Object {
                [CCode (has_construct_function = false)]
-               protected Gutter ();
+               protected SourceGutter ();
+               [Deprecated (since = "3.12")]
                public void get_padding (int xpad, int ypad);
-               public unowned GtkSource.GutterRenderer get_renderer_at_pos (int x, int y);
+               public unowned Gtk.SourceGutterRenderer get_renderer_at_pos (int x, int y);
+               [Deprecated (since = "3.12")]
                public unowned Gdk.Window get_window ();
-               public bool insert (GtkSource.GutterRenderer renderer, int position);
+               public bool insert (Gtk.SourceGutterRenderer renderer, int position);
                public void queue_draw ();
-               public void remove (GtkSource.GutterRenderer renderer);
-               public void reorder (GtkSource.GutterRenderer renderer, int position);
+               public void remove (Gtk.SourceGutterRenderer renderer);
+               public void reorder (Gtk.SourceGutterRenderer renderer, int position);
+               [Deprecated (since = "3.12")]
                public void set_padding (int xpad, int ypad);
                [NoAccessorMethod]
-               public GtkSource.View view { owned get; construct; }
+               public Gtk.SourceView view { owned get; construct; }
                [NoAccessorMethod]
                public Gtk.TextWindowType window_type { get; construct; }
+               [Deprecated (since = "3.12")]
                [NoAccessorMethod]
                public int xpad { get; set construct; }
+               [Deprecated (since = "3.12")]
                [NoAccessorMethod]
                public int ypad { get; set construct; }
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_gutter_renderer_get_type ()")]
        [GIR (name = "GutterRenderer")]
-       public abstract class GutterRenderer : GLib.InitiallyUnowned {
+       public abstract class SourceGutterRenderer : GLib.InitiallyUnowned {
                [CCode (has_construct_function = false)]
-               protected GutterRenderer ();
+               protected SourceGutterRenderer ();
                public virtual void begin (Cairo.Context cr, Gdk.Rectangle background_area, Gdk.Rectangle 
cell_area, Gtk.TextIter start, Gtk.TextIter end);
                [NoWrapper]
-               public virtual void change_buffer (Gtk.TextBuffer old_buffer);
+               public virtual void change_buffer (Gtk.TextBuffer? old_buffer);
                [NoWrapper]
-               public virtual void change_view (Gtk.TextView old_view);
-               public virtual void draw (Cairo.Context cr, Gdk.Rectangle background_area, Gdk.Rectangle 
cell_area, Gtk.TextIter start, Gtk.TextIter end, GtkSource.GutterRendererState state);
+               public virtual void change_view (Gtk.TextView? old_view);
+               public virtual void draw (Cairo.Context cr, Gdk.Rectangle background_area, Gdk.Rectangle 
cell_area, Gtk.TextIter start, Gtk.TextIter end, Gtk.SourceGutterRendererState state);
                public virtual void end ();
                public void get_alignment (out float xalign, out float yalign);
-               public GtkSource.GutterRendererAlignmentMode get_alignment_mode ();
+               public Gtk.SourceGutterRendererAlignmentMode get_alignment_mode ();
                public bool get_background (out Gdk.RGBA color);
                public void get_padding (out int xpad, out int ypad);
                public int get_size ();
@@ -213,12 +311,12 @@ namespace GtkSource {
                public bool get_visible ();
                public Gtk.TextWindowType get_window_type ();
                public void set_alignment (float xalign, float yalign);
-               public void set_alignment_mode (GtkSource.GutterRendererAlignmentMode mode);
+               public void set_alignment_mode (Gtk.SourceGutterRendererAlignmentMode mode);
                public void set_background (Gdk.RGBA? color);
                public void set_padding (int xpad, int ypad);
                public void set_size (int size);
                public void set_visible (bool visible);
-               public GtkSource.GutterRendererAlignmentMode alignment_mode { get; set construct; }
+               public Gtk.SourceGutterRendererAlignmentMode alignment_mode { get; set construct; }
                [NoAccessorMethod]
                public Gdk.RGBA background_rgba { get; set; }
                [NoAccessorMethod]
@@ -240,7 +338,7 @@ namespace GtkSource {
                [HasEmitter]
                public virtual signal bool query_activatable (Gtk.TextIter iter, Cairo.RectangleInt area, 
Gdk.Event event);
                [HasEmitter]
-               public virtual signal void query_data (Gtk.TextIter start, Gtk.TextIter end, 
GtkSource.GutterRendererState state);
+               public virtual signal void query_data (Gtk.TextIter start, Gtk.TextIter end, 
Gtk.SourceGutterRendererState state);
                [HasEmitter]
                public virtual signal bool query_tooltip (Gtk.TextIter iter, Cairo.RectangleInt area, int x, 
int y, Gtk.Tooltip tooltip);
                [HasEmitter]
@@ -248,29 +346,32 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_gutter_renderer_pixbuf_get_type ()")]
        [GIR (name = "GutterRendererPixbuf")]
-       public class GutterRendererPixbuf : GtkSource.GutterRenderer {
-               [CCode (has_construct_function = false, type = "GtkGutterRenderer*")]
-               public GutterRendererPixbuf ();
+       public class SourceGutterRendererPixbuf : Gtk.SourceGutterRenderer {
+               [CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
+               public SourceGutterRendererPixbuf ();
                public unowned GLib.Icon get_gicon ();
                public unowned string get_icon_name ();
                public unowned Gdk.Pixbuf get_pixbuf ();
+               [Deprecated (since = "3.10")]
                public unowned string get_stock_id ();
-               public void set_gicon (GLib.Icon icon);
-               public void set_icon_name (string icon_name);
-               public void set_pixbuf (Gdk.Pixbuf pixbuf);
-               public void set_stock_id (string stock_id);
+               public void set_gicon (GLib.Icon? icon);
+               public void set_icon_name (string? icon_name);
+               public void set_pixbuf (Gdk.Pixbuf? pixbuf);
+               [Deprecated (since = "3.10")]
+               public void set_stock_id (string? stock_id);
                public GLib.Icon gicon { get; set; }
                public string icon_name { get; set; }
                public Gdk.Pixbuf pixbuf { get; set; }
+               [Deprecated (since = "3.10")]
                public string stock_id { get; set; }
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_gutter_renderer_text_get_type ()")]
        [GIR (name = "GutterRendererText")]
-       public class GutterRendererText : GtkSource.GutterRenderer {
-               [CCode (has_construct_function = false, type = "GtkGutterRenderer*")]
-               public GutterRendererText ();
-               public void measure (string text, int width, int height);
-               public void measure_markup (string markup, int width, int height);
+       public class SourceGutterRendererText : Gtk.SourceGutterRenderer {
+               [CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
+               public SourceGutterRendererText ();
+               public void measure (string text, out int width, out int height);
+               public void measure_markup (string markup, out int width, out int height);
                public void set_markup (string markup, int length);
                public void set_text (string text, int length);
                [NoAccessorMethod]
@@ -280,9 +381,9 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_get_type ()")]
        [GIR (name = "Language")]
-       public class Language : GLib.Object {
+       public class SourceLanguage : GLib.Object {
                [CCode (has_construct_function = false)]
-               protected Language ();
+               protected SourceLanguage ();
                [CCode (array_length = false, array_null_terminated = true)]
                public string[] get_globs ();
                public bool get_hidden ();
@@ -303,16 +404,16 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_language_manager_get_type ()")]
        [GIR (name = "LanguageManager")]
-       public class LanguageManager : GLib.Object {
+       public class SourceLanguageManager : GLib.Object {
                [CCode (has_construct_function = false)]
-               public LanguageManager ();
-               public static unowned GtkSource.LanguageManager get_default ();
-               public unowned GtkSource.Language get_language (string id);
+               public SourceLanguageManager ();
+               public static unowned Gtk.SourceLanguageManager get_default ();
+               public unowned Gtk.SourceLanguage? get_language (string id);
                [CCode (array_length = false, array_null_terminated = true)]
-               public unowned string[] get_language_ids ();
+               public unowned string[]? get_language_ids ();
                [CCode (array_length = false, array_null_terminated = true)]
                public unowned string[] get_search_path ();
-               public unowned GtkSource.Language guess_language (string? filename, string? content_type);
+               public unowned Gtk.SourceLanguage? guess_language (string? filename, string? content_type);
                public void set_search_path ([CCode (array_length = false, array_null_terminated = true)] 
string[]? dirs);
                [CCode (array_length = false, array_null_terminated = true)]
                public string[] language_ids { get; }
@@ -321,52 +422,55 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_get_type ()")]
        [GIR (name = "Mark")]
-       public class Mark : Gtk.TextMark {
+       public class SourceMark : Gtk.TextMark {
                [CCode (has_construct_function = false)]
-               public Mark (string name, string category);
+               public SourceMark (string name, string category);
                public unowned string get_category ();
-               public unowned GtkSource.Mark next (string? category);
-               public unowned GtkSource.Mark prev (string category);
+               public unowned Gtk.SourceMark? next (string? category);
+               public unowned Gtk.SourceMark? prev (string category);
                public string category { get; construct; }
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_mark_attributes_get_type ()")]
        [GIR (name = "MarkAttributes")]
-       public class MarkAttributes : GLib.Object {
+       public class SourceMarkAttributes : GLib.Object {
                [CCode (has_construct_function = false)]
-               public MarkAttributes ();
+               public SourceMarkAttributes ();
                public bool get_background (out Gdk.RGBA background);
                public unowned GLib.Icon get_gicon ();
                public unowned string get_icon_name ();
                public unowned Gdk.Pixbuf get_pixbuf ();
+               [Deprecated (since = "3.10")]
                public unowned string get_stock_id ();
-               public string get_tooltip_markup (GtkSource.Mark mark);
-               public string get_tooltip_text (GtkSource.Mark mark);
+               public string get_tooltip_markup (Gtk.SourceMark mark);
+               public string get_tooltip_text (Gtk.SourceMark mark);
                public unowned Gdk.Pixbuf render_icon (Gtk.Widget widget, int size);
                public void set_background (Gdk.RGBA background);
                public void set_gicon (GLib.Icon gicon);
                public void set_icon_name (string icon_name);
                public void set_pixbuf (Gdk.Pixbuf pixbuf);
+               [Deprecated (since = "3.10")]
                public void set_stock_id (string stock_id);
                [NoAccessorMethod]
                public Gdk.RGBA background { get; set; }
                public GLib.Icon gicon { get; set; }
                public string icon_name { get; set; }
                public Gdk.Pixbuf pixbuf { get; set; }
+               [Deprecated (since = "3.10")]
                public string stock_id { get; set; }
-               public signal string query_tooltip_markup (GtkSource.Mark mark);
-               public signal string query_tooltip_text (GtkSource.Mark mark);
+               public signal string query_tooltip_markup (Gtk.SourceMark mark);
+               public signal string query_tooltip_text (Gtk.SourceMark mark);
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_print_compositor_get_type ()")]
        [GIR (name = "PrintCompositor")]
-       public class PrintCompositor : GLib.Object {
+       public class SourcePrintCompositor : GLib.Object {
                [CCode (has_construct_function = false)]
-               public PrintCompositor (GtkSource.Buffer buffer);
+               public SourcePrintCompositor (Gtk.SourceBuffer buffer);
                public void draw_page (Gtk.PrintContext context, int page_nr);
                [CCode (has_construct_function = false)]
-               public PrintCompositor.from_view (GtkSource.View view);
+               public SourcePrintCompositor.from_view (Gtk.SourceView view);
                public string get_body_font_name ();
                public double get_bottom_margin (Gtk.Unit unit);
-               public unowned GtkSource.Buffer get_buffer ();
+               public unowned Gtk.SourceBuffer get_buffer ();
                public string get_footer_font_name ();
                public string get_header_font_name ();
                public bool get_highlight_syntax ();
@@ -399,7 +503,7 @@ namespace GtkSource {
                public void set_top_margin (double margin, Gtk.Unit unit);
                public void set_wrap_mode (Gtk.WrapMode wrap_mode);
                public string body_font_name { owned get; set; }
-               public GtkSource.Buffer buffer { get; construct; }
+               public Gtk.SourceBuffer buffer { get; construct; }
                public string footer_font_name { owned get; set; }
                public string header_font_name { owned get; set; }
                public bool highlight_syntax { get; set; }
@@ -411,12 +515,61 @@ namespace GtkSource {
                public uint tab_width { get; set; }
                public Gtk.WrapMode wrap_mode { get; set; }
        }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_search_context_get_type 
()")]
+       [GIR (name = "SearchContext")]
+       public class SourceSearchContext : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public SourceSearchContext (Gtk.SourceBuffer buffer, Gtk.SourceSearchSettings? settings);
+               public bool backward (Gtk.TextIter iter, out Gtk.TextIter match_start, out Gtk.TextIter 
match_end);
+               public async bool backward_async (Gtk.TextIter iter, GLib.Cancellable? cancellable, out 
Gtk.TextIter match_start, out Gtk.TextIter match_end) throws GLib.Error;
+               public bool forward (Gtk.TextIter iter, out Gtk.TextIter match_start, out Gtk.TextIter 
match_end);
+               public async bool forward_async (Gtk.TextIter iter, GLib.Cancellable? cancellable, out 
Gtk.TextIter match_start, out Gtk.TextIter match_end) throws GLib.Error;
+               public unowned Gtk.SourceBuffer get_buffer ();
+               public bool get_highlight ();
+               public unowned Gtk.SourceStyle get_match_style ();
+               public int get_occurrence_position (Gtk.TextIter match_start, Gtk.TextIter match_end);
+               public int get_occurrences_count ();
+               public GLib.Error? get_regex_error ();
+               public unowned Gtk.SourceSearchSettings get_settings ();
+               public bool replace (Gtk.TextIter match_start, Gtk.TextIter match_end, string replace, int 
replace_length) throws GLib.Error;
+               public uint replace_all (string replace, int replace_length) throws GLib.Error;
+               public void set_highlight (bool highlight);
+               public void set_match_style (Gtk.SourceStyle? match_style);
+               public void set_settings (Gtk.SourceSearchSettings? settings);
+               public Gtk.SourceBuffer buffer { get; construct; }
+               public bool highlight { get; set construct; }
+               public Gtk.SourceStyle match_style { get; set construct; }
+               public int occurrences_count { get; }
+               public GLib.Error? regex_error { owned get; }
+               public Gtk.SourceSearchSettings settings { get; set construct; }
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_search_settings_get_type ()")]
+       [GIR (name = "SearchSettings")]
+       public class SourceSearchSettings : GLib.Object {
+               [CCode (has_construct_function = false)]
+               public SourceSearchSettings ();
+               public bool get_at_word_boundaries ();
+               public bool get_case_sensitive ();
+               public bool get_regex_enabled ();
+               public unowned string? get_search_text ();
+               public bool get_wrap_around ();
+               public void set_at_word_boundaries (bool at_word_boundaries);
+               public void set_case_sensitive (bool case_sensitive);
+               public void set_regex_enabled (bool regex_enabled);
+               public void set_search_text (string? search_text);
+               public void set_wrap_around (bool wrap_around);
+               public bool at_word_boundaries { get; set construct; }
+               public bool case_sensitive { get; set construct; }
+               public bool regex_enabled { get; set construct; }
+               public string search_text { get; set construct; }
+               public bool wrap_around { get; set construct; }
+       }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_get_type ()")]
        [GIR (name = "Style")]
-       public class Style : GLib.Object {
+       public class SourceStyle : GLib.Object {
                [CCode (has_construct_function = false)]
-               protected Style ();
-               public GtkSource.Style copy ();
+               protected SourceStyle ();
+               public Gtk.SourceStyle copy ();
                [NoAccessorMethod]
                public string background { owned get; construct; }
                [NoAccessorMethod]
@@ -438,6 +591,10 @@ namespace GtkSource {
                [NoAccessorMethod]
                public bool line_background_set { get; construct; }
                [NoAccessorMethod]
+               public string scale { owned get; construct; }
+               [NoAccessorMethod]
+               public bool scale_set { get; construct; }
+               [NoAccessorMethod]
                public bool strikethrough { get; construct; }
                [NoAccessorMethod]
                public bool strikethrough_set { get; construct; }
@@ -448,30 +605,42 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_get_type 
()")]
        [GIR (name = "StyleScheme")]
-       public class StyleScheme : GLib.Object {
+       public class SourceStyleScheme : GLib.Object {
                [CCode (has_construct_function = false)]
-               protected StyleScheme ();
+               protected SourceStyleScheme ();
                [CCode (array_length = false, array_null_terminated = true)]
-               public unowned string[] get_authors ();
-               public unowned string get_description ();
-               public unowned string get_filename ();
+               public unowned string[]? get_authors ();
+               public unowned string? get_description ();
+               public unowned string? get_filename ();
                public unowned string get_id ();
                public unowned string get_name ();
-               public unowned GtkSource.Style get_style (string style_id);
+               public unowned Gtk.SourceStyle? get_style (string style_id);
                public string description { get; }
                public string filename { get; }
                public string id { get; construct; }
                public string name { get; }
        }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_style_scheme_chooser_button_get_type ()")]
+       [GIR (name = "StyleSchemeChooserButton")]
+       public class SourceStyleSchemeChooserButton : Gtk.Button, Atk.Implementor, Gtk.Actionable, 
Gtk.Activatable, Gtk.Buildable, Gtk.SourceStyleSchemeChooser {
+               [CCode (has_construct_function = false, type = "GtkWidget*")]
+               public SourceStyleSchemeChooserButton ();
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_style_scheme_chooser_widget_get_type ()")]
+       [GIR (name = "StyleSchemeChooserWidget")]
+       public class SourceStyleSchemeChooserWidget : Gtk.Bin, Atk.Implementor, Gtk.Buildable, 
Gtk.SourceStyleSchemeChooser {
+               [CCode (has_construct_function = false, type = "GtkWidget*")]
+               public SourceStyleSchemeChooserWidget ();
+       }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_style_scheme_manager_get_type ()")]
        [GIR (name = "StyleSchemeManager")]
-       public class StyleSchemeManager : GLib.Object {
+       public class SourceStyleSchemeManager : GLib.Object {
                [CCode (has_construct_function = false)]
-               public StyleSchemeManager ();
+               public SourceStyleSchemeManager ();
                public void append_search_path (string path);
                public void force_rescan ();
-               public static unowned GtkSource.StyleSchemeManager get_default ();
-               public unowned GtkSource.StyleScheme get_scheme (string scheme_id);
+               public static unowned Gtk.SourceStyleSchemeManager get_default ();
+               public unowned Gtk.SourceStyleScheme get_scheme (string scheme_id);
                [CCode (array_length = false, array_null_terminated = true)]
                public unowned string[] get_scheme_ids ();
                [CCode (array_length = false, array_null_terminated = true)]
@@ -485,43 +654,48 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_view_get_type ()")]
        [GIR (name = "View")]
-       public class View : Gtk.TextView, Atk.Implementor, Gtk.Buildable, Gtk.Scrollable {
+       public class SourceView : Gtk.TextView, Atk.Implementor, Gtk.Buildable, Gtk.Scrollable {
                [CCode (has_construct_function = false, type = "GtkWidget*")]
-               public View ();
+               public SourceView ();
                public bool get_auto_indent ();
-               public unowned GtkSource.Completion get_completion ();
-               public GtkSource.DrawSpacesFlags get_draw_spaces ();
-               public unowned GtkSource.Gutter get_gutter (Gtk.TextWindowType window_type);
+               public Gtk.SourceBackgroundPatternType get_background_pattern ();
+               public unowned Gtk.SourceCompletion get_completion ();
+               public Gtk.SourceDrawSpacesFlags get_draw_spaces ();
+               public unowned Gtk.SourceGutter get_gutter (Gtk.TextWindowType window_type);
                public bool get_highlight_current_line ();
                public bool get_indent_on_tab ();
                public int get_indent_width ();
                public bool get_insert_spaces_instead_of_tabs ();
-               public unowned GtkSource.MarkAttributes get_mark_attributes (string category, int priority);
+               public unowned Gtk.SourceMarkAttributes get_mark_attributes (string category, int priority);
                public uint get_right_margin_position ();
                public bool get_show_line_marks ();
                public bool get_show_line_numbers ();
                public bool get_show_right_margin ();
-               public GtkSource.SmartHomeEndType get_smart_home_end ();
+               public Gtk.SourceSmartHomeEndType get_smart_home_end ();
                public uint get_tab_width ();
                public uint get_visual_column (Gtk.TextIter iter);
+               public void indent_lines (Gtk.TextIter start, Gtk.TextIter end);
                public void set_auto_indent (bool enable);
-               public void set_draw_spaces (GtkSource.DrawSpacesFlags flags);
-               public void set_highlight_current_line (bool hl);
+               public void set_background_pattern (Gtk.SourceBackgroundPatternType background_pattern);
+               public void set_draw_spaces (Gtk.SourceDrawSpacesFlags flags);
+               public void set_highlight_current_line (bool highlight);
                public void set_indent_on_tab (bool enable);
                public void set_indent_width (int width);
                public void set_insert_spaces_instead_of_tabs (bool enable);
-               public void set_mark_attributes (string category, GtkSource.MarkAttributes attributes, int 
priority);
+               public void set_mark_attributes (string category, Gtk.SourceMarkAttributes attributes, int 
priority);
                public void set_right_margin_position (uint pos);
                public void set_show_line_marks (bool show);
                public void set_show_line_numbers (bool show);
                public void set_show_right_margin (bool show);
-               public void set_smart_home_end (GtkSource.SmartHomeEndType smart_he);
+               public void set_smart_home_end (Gtk.SourceSmartHomeEndType smart_home_end);
                public void set_tab_width (uint width);
+               public void unindent_lines (Gtk.TextIter start, Gtk.TextIter end);
                [CCode (has_construct_function = false, type = "GtkWidget*")]
-               public View.with_buffer (GtkSource.Buffer buffer);
+               public SourceView.with_buffer (Gtk.SourceBuffer buffer);
                public bool auto_indent { get; set; }
-               public GtkSource.Completion completion { get; }
-               public GtkSource.DrawSpacesFlags draw_spaces { get; set; }
+               public Gtk.SourceBackgroundPatternType background_pattern { get; set; }
+               public Gtk.SourceCompletion completion { get; }
+               public Gtk.SourceDrawSpacesFlags draw_spaces { get; set; }
                public bool highlight_current_line { get; set; }
                public bool indent_on_tab { get; set; }
                public int indent_width { get; set; }
@@ -530,10 +704,14 @@ namespace GtkSource {
                public bool show_line_marks { get; set; }
                public bool show_line_numbers { get; set; }
                public bool show_right_margin { get; set; }
-               public GtkSource.SmartHomeEndType smart_home_end { get; set; }
+               public Gtk.SourceSmartHomeEndType smart_home_end { get; set; }
                public uint tab_width { get; set; }
+               public signal void change_case (Gtk.SourceChangeCaseType case_type);
+               public signal void change_number (int count);
+               public signal void join_lines ();
                public virtual signal void line_mark_activated (Gtk.TextIter iter, Gdk.Event event);
                public virtual signal void move_lines (bool copy, int step);
+               public signal void move_to_matching_bracket (bool extend_selection);
                public virtual signal void move_words (int step);
                public virtual signal void redo ();
                public virtual signal void show_completion ();
@@ -541,8 +719,8 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_proposal_get_type ()")]
        [GIR (name = "CompletionProposal")]
-       public interface CompletionProposal : GLib.Object {
-               public virtual bool equal (GtkSource.CompletionProposal other);
+       public interface SourceCompletionProposal : GLib.Object {
+               public virtual bool equal (Gtk.SourceCompletionProposal other);
                public virtual unowned Gdk.Pixbuf get_icon ();
                public abstract string get_info ();
                public abstract string get_label ();
@@ -554,22 +732,29 @@ namespace GtkSource {
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_completion_provider_get_type ()")]
        [GIR (name = "CompletionProvider")]
-       public interface CompletionProvider : GLib.Object {
-               public virtual bool activate_proposal (GtkSource.CompletionProposal proposal, Gtk.TextIter 
iter);
-               public virtual GtkSource.CompletionActivation get_activation ();
+       public interface SourceCompletionProvider : GLib.Object {
+               public virtual bool activate_proposal (Gtk.SourceCompletionProposal proposal, Gtk.TextIter 
iter);
+               public virtual Gtk.SourceCompletionActivation get_activation ();
                public virtual unowned Gdk.Pixbuf? get_icon ();
-               public virtual unowned Gtk.Widget? get_info_widget (GtkSource.CompletionProposal proposal);
+               public virtual unowned Gtk.Widget? get_info_widget (Gtk.SourceCompletionProposal proposal);
                public virtual int get_interactive_delay ();
                public virtual string get_name ();
                public virtual int get_priority ();
-               public virtual bool get_start_iter (GtkSource.CompletionContext context, 
GtkSource.CompletionProposal proposal, Gtk.TextIter iter);
-               public virtual bool match (GtkSource.CompletionContext context);
-               public virtual void populate (GtkSource.CompletionContext context);
-               public virtual void update_info (GtkSource.CompletionProposal proposal, 
GtkSource.CompletionInfo info);
+               public virtual bool get_start_iter (Gtk.SourceCompletionContext context, 
Gtk.SourceCompletionProposal proposal, out Gtk.TextIter iter);
+               public virtual bool match (Gtk.SourceCompletionContext context);
+               public virtual void populate (Gtk.SourceCompletionContext context);
+               public virtual void update_info (Gtk.SourceCompletionProposal proposal, 
Gtk.SourceCompletionInfo info);
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = 
"gtk_source_style_scheme_chooser_get_type ()")]
+       [GIR (name = "StyleSchemeChooser")]
+       public interface SourceStyleSchemeChooser : GLib.Object {
+               public abstract unowned Gtk.SourceStyleScheme get_style_scheme ();
+               public abstract void set_style_scheme (Gtk.SourceStyleScheme scheme);
+               public abstract Gtk.SourceStyleScheme style_scheme { get; set; }
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_undo_manager_get_type 
()")]
        [GIR (name = "UndoManager")]
-       public interface UndoManager : GLib.Object {
+       public interface SourceUndoManager : GLib.Object {
                public abstract void begin_not_undoable_action ();
                public abstract bool can_redo ();
                public abstract bool can_undo ();
@@ -581,26 +766,46 @@ namespace GtkSource {
                [HasEmitter]
                public virtual signal void can_undo_changed ();
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_BRACKET_MATCH_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_BACKGROUND_PATTERN_TYPE_", type_id = "gtk_source_background_pattern_type_get_type ()")]
+       [GIR (name = "BackgroundPatternType")]
+       public enum SourceBackgroundPatternType {
+               NONE,
+               GRID
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_BRACKET_MATCH_", 
type_id = "gtk_source_bracket_match_type_get_type ()")]
        [GIR (name = "BracketMatchType")]
-       public enum BracketMatchType {
+       public enum SourceBracketMatchType {
                NONE,
                OUT_OF_RANGE,
                NOT_FOUND,
                FOUND
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_COMPLETION_ACTIVATION_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_CHANGE_CASE_", type_id 
= "gtk_source_change_case_type_get_type ()")]
+       [GIR (name = "ChangeCaseType")]
+       public enum SourceChangeCaseType {
+               LOWER,
+               UPPER,
+               TOGGLE,
+               TITLE
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_COMPLETION_ACTIVATION_", type_id = "gtk_source_completion_activation_get_type ()")]
        [Flags]
        [GIR (name = "CompletionActivation")]
-       public enum CompletionActivation {
+       public enum SourceCompletionActivation {
                NONE,
                INTERACTIVE,
                USER_REQUESTED
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_DRAW_SPACES_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPRESSION_TYPE_", 
type_id = "gtk_source_compression_type_get_type ()")]
+       [GIR (name = "CompressionType")]
+       public enum SourceCompressionType {
+               NONE,
+               GZIP
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_DRAW_SPACES_", type_id 
= "gtk_source_draw_spaces_flags_get_type ()")]
        [Flags]
        [GIR (name = "DrawSpacesFlags")]
-       public enum DrawSpacesFlags {
+       public enum SourceDrawSpacesFlags {
                SPACE,
                TAB,
                NEWLINE,
@@ -610,42 +815,75 @@ namespace GtkSource {
                TRAILING,
                ALL
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_SAVER_FLAGS_", 
type_id = "gtk_source_file_saver_flags_get_type ()")]
+       [Flags]
+       [GIR (name = "FileSaverFlags")]
+       public enum SourceFileSaverFlags {
+               NONE,
+               IGNORE_INVALID_CHARS,
+               IGNORE_MODIFICATION_TIME,
+               CREATE_BACKUP
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_", type_id = "gtk_source_gutter_renderer_alignment_mode_get_type 
()")]
        [GIR (name = "GutterRendererAlignmentMode")]
-       public enum GutterRendererAlignmentMode {
+       public enum SourceGutterRendererAlignmentMode {
                CELL,
                FIRST,
                LAST
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_GUTTER_RENDERER_STATE_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = 
"GTK_SOURCE_GUTTER_RENDERER_STATE_", type_id = "gtk_source_gutter_renderer_state_get_type ()")]
        [Flags]
        [GIR (name = "GutterRendererState")]
-       public enum GutterRendererState {
+       public enum SourceGutterRendererState {
                NORMAL,
                CURSOR,
                PRELIT,
                SELECTED
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SMART_HOME_END_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_NEWLINE_TYPE_", type_id 
= "gtk_source_newline_type_get_type ()")]
+       [GIR (name = "NewlineType")]
+       public enum SourceNewlineType {
+               LF,
+               CR,
+               CR_LF
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_SMART_HOME_END_", 
type_id = "gtk_source_smart_home_end_type_get_type ()")]
        [GIR (name = "SmartHomeEndType")]
-       public enum SmartHomeEndType {
+       public enum SourceSmartHomeEndType {
                DISABLED,
                BEFORE,
                AFTER,
                ALWAYS
        }
-       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_VIEW_GUTTER_POSITION_")]
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_VIEW_GUTTER_POSITION_", 
type_id = "gtk_source_view_gutter_position_get_type ()")]
        [GIR (name = "ViewGutterPosition")]
-       public enum ViewGutterPosition {
+       public enum SourceViewGutterPosition {
                LINES,
                MARKS
        }
        [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ERROR_")]
        [GIR (name = "CompletionError")]
-       public errordomain CompletionError {
+       public errordomain SourceCompletionError {
                ALREADY_BOUND,
                NOT_BOUND;
                [CCode (cname = "gtk_source_completion_error_quark")]
                public static GLib.Quark uark ();
        }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_LOADER_ERROR_")]
+       [GIR (name = "FileLoaderError")]
+       public errordomain SourceFileLoaderError {
+               TOO_BIG,
+               ENCODING_AUTO_DETECTION_FAILED,
+               CONVERSION_FALLBACK;
+               [CCode (cname = "gtk_source_file_loader_error_quark")]
+               public static GLib.Quark uark ();
+       }
+       [CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_FILE_SAVER_ERROR_")]
+       [GIR (name = "FileSaverError")]
+       public errordomain SourceFileSaverError {
+               INVALID_CHARS,
+               EXTERNALLY_MODIFIED;
+               [CCode (cname = "gtk_source_file_saver_error_quark")]
+               public static GLib.Quark uark ();
+       }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]