mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-07-02 16:09:26 +00:00
First step in replacing webkit with standard gtk+
This commit is contained in:
parent
f13e1ca4aa
commit
bd2e369b88
24
Makefile.am
24
Makefile.am
|
@ -106,20 +106,16 @@ include icons.mk
|
||||||
|
|
||||||
GITIGNOREFILES += $(gsettings_SCHEMAS)
|
GITIGNOREFILES += $(gsettings_SCHEMAS)
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
vapi/config.vapi \
|
vapi/config.vapi \
|
||||||
vapi/gdesktop-enums-3.0.vapi \
|
vapi/gdesktop-enums-3.0.vapi \
|
||||||
vapi/gitg-js-utils.vapi \
|
vapi/gitg-js-utils.vapi \
|
||||||
vapi/gobject-introspection-1.0.vapi \
|
vapi/gobject-introspection-1.0.vapi \
|
||||||
vapi/gtksourceview-3.0.deps \
|
vapi/gtksourceview-3.0.deps \
|
||||||
vapi/gtksourceview-3.0.vapi \
|
vapi/gtksourceview-3.0.vapi \
|
||||||
vapi/libpeas-1.0.vapi \
|
vapi/libpeas-1.0.vapi \
|
||||||
vapi/libsoup-2.4.deps \
|
vapi/libsoup-2.4.deps \
|
||||||
vapi/libsoup-2.4.vapi \
|
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
|
|
||||||
|
|
||||||
%.typelib: %.gir
|
%.typelib: %.gir
|
||||||
$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=$(top_srcdir) -o $@ $<
|
$(INTROSPECTION_COMPILER) $(INTROSPECTION_COMPILER_ARGS) --includedir=$(top_srcdir) -o $@ $<
|
||||||
|
|
22
configure.ac
22
configure.ac
|
@ -85,24 +85,10 @@ AC_DEFINE_UNQUOTED(GITG_LIBDIR,"$GITG_LIBDIR", [lib dir])
|
||||||
|
|
||||||
AC_CHECK_LIB([m], [sinf])
|
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
|
GLIB_REQUIRED_VERSION=2.38
|
||||||
GTK_REQUIRED_VERSION=3.12.0
|
GTK_REQUIRED_VERSION=3.12.0
|
||||||
GTKSOURCEVIEW_REQUIRED_VERSION=3.10
|
GTKSOURCEVIEW_REQUIRED_VERSION=3.10
|
||||||
INTROSPECTION_REQUIRED=0.10.1
|
INTROSPECTION_REQUIRED=0.10.1
|
||||||
WEBKITGTK_REQUIRED_VERSION=2.2
|
|
||||||
LIBGIT2_GLIB_REQUIRED_VERSION=0.23.5
|
LIBGIT2_GLIB_REQUIRED_VERSION=0.23.5
|
||||||
LIBGIT2_GLIB_REQUIRED_MAX_VERSION=0.24.0
|
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_VERSION
|
||||||
libgit2-glib-1.0 < $LIBGIT2_GLIB_REQUIRED_MAX_VERSION
|
libgit2-glib-1.0 < $LIBGIT2_GLIB_REQUIRED_MAX_VERSION
|
||||||
gtk+-3.0 >= $GTK_REQUIRED_VERSION
|
gtk+-3.0 >= $GTK_REQUIRED_VERSION
|
||||||
$WEBKIT_PKGCONFIG >= WEBKITGTK_REQUIRED_VERSION
|
gtksourceview-3.0 >= $GTKSOURCEVIEW_REQUIRED_VERSION
|
||||||
gsettings-desktop-schemas
|
gsettings-desktop-schemas
|
||||||
gee-0.8
|
gee-0.8
|
||||||
json-glib-1.0
|
libsoup-2.4
|
||||||
libsecret-1
|
libsecret-1
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -191,8 +177,6 @@ if test "x$enable_debug" = "xyes"; then
|
||||||
AC_DEFINE([ENABLE_DEBUG],[1],[Whether debugging support is enabled])
|
AC_DEFINE([ENABLE_DEBUG],[1],[Whether debugging support is enabled])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LIBGITG_CFLAGS="$LIBGITG_CFLAGS -DLIBSOUP_USE_UNSTABLE_REQUEST_API"
|
|
||||||
|
|
||||||
AC_SUBST(LIBGITG_CFLAGS)
|
AC_SUBST(LIBGITG_CFLAGS)
|
||||||
AC_SUBST(LIBGITG_LIBS)
|
AC_SUBST(LIBGITG_LIBS)
|
||||||
|
|
||||||
|
@ -280,9 +264,7 @@ GITG_PLUGIN_VALAFLAGS=" \
|
||||||
--pkg libpeas-1.0 \
|
--pkg libpeas-1.0 \
|
||||||
--pkg gee-0.8 \
|
--pkg gee-0.8 \
|
||||||
--pkg json-glib-1.0 \
|
--pkg json-glib-1.0 \
|
||||||
--pkg libsoup-2.4 \
|
|
||||||
--pkg libsecret-1 \
|
--pkg libsecret-1 \
|
||||||
--pkg $WEBKIT_PKGCONFIG \
|
|
||||||
--pkg config \
|
--pkg config \
|
||||||
--pkg gd-1.0 \
|
--pkg gd-1.0 \
|
||||||
\$(GITG_VALAFLAGS) \
|
\$(GITG_VALAFLAGS) \
|
||||||
|
|
|
@ -24,7 +24,6 @@ gitg_gitg_VALAFLAGS = \
|
||||||
--pkg gobject-introspection-1.0 \
|
--pkg gobject-introspection-1.0 \
|
||||||
--pkg gee-0.8 \
|
--pkg gee-0.8 \
|
||||||
--pkg gd-1.0 \
|
--pkg gd-1.0 \
|
||||||
--pkg $(WEBKIT_PKGCONFIG) \
|
|
||||||
--pkg gtksourceview-3.0 \
|
--pkg gtksourceview-3.0 \
|
||||||
--pkg GtkSpell-3.0 \
|
--pkg GtkSpell-3.0 \
|
||||||
--girdir "$(top_builddir)/libgd" \
|
--girdir "$(top_builddir)/libgd" \
|
||||||
|
@ -59,6 +58,7 @@ gitg_gitg_VALASOURCES = \
|
||||||
gitg/gitg-animated-paned.vala \
|
gitg/gitg-animated-paned.vala \
|
||||||
gitg/gitg-application.vala \
|
gitg/gitg-application.vala \
|
||||||
gitg/gitg-author-details-dialog.vala \
|
gitg/gitg-author-details-dialog.vala \
|
||||||
|
gitg/gitg-builder.vala \
|
||||||
gitg/gitg-clone-dialog.vala \
|
gitg/gitg-clone-dialog.vala \
|
||||||
gitg/gitg-commit-action-create-branch.vala \
|
gitg/gitg-commit-action-create-branch.vala \
|
||||||
gitg/gitg-commit-action-create-patch.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-delete.vala \
|
||||||
gitg/gitg-ref-action-fetch.vala \
|
gitg/gitg-ref-action-fetch.vala \
|
||||||
gitg/gitg-ref-action-merge.vala \
|
gitg/gitg-ref-action-merge.vala \
|
||||||
|
gitg/gitg-ref-action-pull.vala \
|
||||||
gitg/gitg-ref-action-rename.vala \
|
gitg/gitg-ref-action-rename.vala \
|
||||||
gitg/gitg-remote-manager.vala \
|
gitg/gitg-remote-manager.vala \
|
||||||
gitg/gitg-remote-notification.vala \
|
gitg/gitg-remote-notification.vala \
|
||||||
gitg/gitg-resource.vala \
|
|
||||||
gitg/gitg-simple-notification.vala \
|
gitg/gitg-simple-notification.vala \
|
||||||
gitg/gitg-ui-elements.vala \
|
gitg/gitg-ui-elements.vala \
|
||||||
gitg/gitg-window.vala \
|
gitg/gitg-window.vala \
|
||||||
|
|
|
@ -27,7 +27,7 @@ class Dialog : Gtk.Dialog
|
||||||
private const string version = Gitg.Config.VERSION;
|
private const string version = Gitg.Config.VERSION;
|
||||||
|
|
||||||
[GtkChild (name = "source_view_message")]
|
[GtkChild (name = "source_view_message")]
|
||||||
private GtkSource.View d_source_view_message;
|
private Gtk.SourceView d_source_view_message;
|
||||||
|
|
||||||
[GtkChild (name = "ok-button")]
|
[GtkChild (name = "ok-button")]
|
||||||
private Gtk.Button d_button_ok;
|
private Gtk.Button d_button_ok;
|
||||||
|
@ -95,7 +95,7 @@ class Dialog : Gtk.Dialog
|
||||||
default = 3;
|
default = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GtkSource.View source_view_message
|
public Gtk.SourceView source_view_message
|
||||||
{
|
{
|
||||||
get { return d_source_view_message; }
|
get { return d_source_view_message; }
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ class Dialog : Gtk.Dialog
|
||||||
var ac = Gitg.AvatarCache.default();
|
var ac = Gitg.AvatarCache.default();
|
||||||
d_cancel_avatar = new Cancellable();
|
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);
|
var pixbuf = ac.load.end(res);
|
||||||
|
|
||||||
if (d_cancel_avatar.is_cancelled())
|
if (d_cancel_avatar.is_cancelled())
|
||||||
|
|
|
@ -772,7 +772,7 @@ namespace GitgCommit
|
||||||
var author = get_signature("AUTHOR");
|
var author = get_signature("AUTHOR");
|
||||||
var ac = Gitg.AvatarCache.default();
|
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);
|
ac.load.end(res);
|
||||||
});
|
});
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
|
@ -253,7 +253,7 @@ public class Application : Gtk.Application
|
||||||
// Create preferences dialog if needed
|
// Create preferences dialog if needed
|
||||||
if (d_preferences == null)
|
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.destroy.connect((w) => {
|
||||||
d_preferences = null;
|
d_preferences = null;
|
||||||
|
@ -343,7 +343,7 @@ public class Application : Gtk.Application
|
||||||
|
|
||||||
if (Gtk.Settings.get_default().gtk_shell_shows_app_menu)
|
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)
|
if (menu != null)
|
||||||
{
|
{
|
||||||
|
|
33
gitg/gitg-builder.vala
Normal file
33
gitg/gitg-builder.vala
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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.Builder
|
||||||
|
{
|
||||||
|
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];
|
||||||
|
}
|
||||||
|
}
|
|
@ -222,8 +222,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
|
||||||
|
|
||||||
d_dash_view.application = this;
|
d_dash_view.application = this;
|
||||||
|
|
||||||
d_dash_model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-dash");
|
d_dash_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-dash");
|
||||||
d_activities_model = Resource.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-views");
|
d_activities_model = Builder.load_object<MenuModel>("ui/gitg-menus.ui", menuname + "-views");
|
||||||
|
|
||||||
// search bar
|
// search bar
|
||||||
d_search_bar.connect_entry(d_search_entry);
|
d_search_bar.connect_entry(d_search_entry);
|
||||||
|
|
|
@ -17,7 +17,6 @@ libgitg_ext_libgitg_ext_1_0_la_VALAPKGS = \
|
||||||
--pkg gio-2.0 \
|
--pkg gio-2.0 \
|
||||||
--pkg gtk+-3.0 \
|
--pkg gtk+-3.0 \
|
||||||
--pkg libsoup-2.4 \
|
--pkg libsoup-2.4 \
|
||||||
--pkg $(WEBKIT_PKGCONFIG) \
|
|
||||||
--pkg gee-0.8
|
--pkg gee-0.8
|
||||||
|
|
||||||
libgitg_ext_libgitg_ext_1_0_la_VALAFLAGS = \
|
libgitg_ext_libgitg_ext_1_0_la_VALAFLAGS = \
|
||||||
|
|
|
@ -21,36 +21,26 @@ libgitg_libgitg_1_0_la_LDFLAGS = \
|
||||||
libgitg_libgitg_1_0_la_LIBADD = \
|
libgitg_libgitg_1_0_la_LIBADD = \
|
||||||
$(LIBGITG_LIBS)
|
$(LIBGITG_LIBS)
|
||||||
|
|
||||||
GITG_GIR_IN = Gitg_in-1.0.gir
|
|
||||||
|
|
||||||
libgitg_libgitg_1_0_la_VALAFLAGS = \
|
libgitg_libgitg_1_0_la_VALAFLAGS = \
|
||||||
--pkg ggit-1.0 \
|
--pkg ggit-1.0 \
|
||||||
--pkg gtk+-3.0 \
|
--pkg gtk+-3.0 \
|
||||||
--pkg gio-2.0 \
|
--pkg gio-2.0 \
|
||||||
--pkg libsoup-2.4 \
|
|
||||||
--pkg $(WEBKIT_PKGCONFIG) \
|
|
||||||
--pkg gee-0.8 \
|
--pkg gee-0.8 \
|
||||||
--pkg json-glib-1.0 \
|
|
||||||
--pkg libsecret-1 \
|
--pkg libsecret-1 \
|
||||||
--pkg gio-unix-2.0 \
|
--pkg gio-unix-2.0 \
|
||||||
--pkg gitg-js-utils \
|
|
||||||
--pkg gdesktop-enums-3.0 \
|
--pkg gdesktop-enums-3.0 \
|
||||||
|
--pkg libsoup-2.4 \
|
||||||
|
--pkg gtksourceview-3.0 \
|
||||||
$(GITG_VALAFLAGS) \
|
$(GITG_VALAFLAGS) \
|
||||||
--vapidir $(top_srcdir)/vapi \
|
--vapidir $(top_srcdir)/vapi \
|
||||||
--includedir libgitg \
|
--includedir libgitg \
|
||||||
--basedir $(top_srcdir) \
|
--basedir $(top_srcdir) \
|
||||||
--gir $(GITG_GIR_IN) \
|
--gir Gitg-1.0.gir \
|
||||||
--vapi libgitg/libgitg-1.0.vapi \
|
--vapi libgitg/libgitg-1.0.vapi \
|
||||||
--library libgitg/libgitg-1.0 \
|
--library libgitg/libgitg-1.0 \
|
||||||
--header libgitg/libgitg.h \
|
--header libgitg/libgitg.h \
|
||||||
--gresources "$(top_srcdir)/libgitg/resources/resources.xml"
|
--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_libgitg_1_0_la_VALASOURCES = \
|
||||||
libgitg/gitg-assembly-info.vala \
|
libgitg/gitg-assembly-info.vala \
|
||||||
libgitg/gitg-async.vala \
|
libgitg/gitg-async.vala \
|
||||||
|
@ -66,12 +56,11 @@ libgitg_libgitg_1_0_la_VALASOURCES = \
|
||||||
libgitg/gitg-credentials-manager.vala \
|
libgitg/gitg-credentials-manager.vala \
|
||||||
libgitg/gitg-date.vala \
|
libgitg/gitg-date.vala \
|
||||||
libgitg/gitg-diff-stat.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.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-hook.vala \
|
||||||
libgitg/gitg-init.vala \
|
libgitg/gitg-init.vala \
|
||||||
libgitg/gitg-label-renderer.vala \
|
libgitg/gitg-label-renderer.vala \
|
||||||
|
@ -83,6 +72,7 @@ libgitg_libgitg_1_0_la_VALASOURCES = \
|
||||||
libgitg/gitg-remote.vala \
|
libgitg/gitg-remote.vala \
|
||||||
libgitg/gitg-repository-list-box.vala \
|
libgitg/gitg-repository-list-box.vala \
|
||||||
libgitg/gitg-repository.vala \
|
libgitg/gitg-repository.vala \
|
||||||
|
libgitg/gitg-resource.vala \
|
||||||
libgitg/gitg-sidebar.vala \
|
libgitg/gitg-sidebar.vala \
|
||||||
libgitg/gitg-stage-status-enumerator.vala \
|
libgitg/gitg-stage-status-enumerator.vala \
|
||||||
libgitg/gitg-stage.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_SOURCES = \
|
||||||
$(libgitg_libgitg_1_0_la_VALASOURCES) \
|
$(libgitg_libgitg_1_0_la_VALASOURCES) \
|
||||||
libgitg/gitg-resources.c \
|
libgitg/gitg-resources.c
|
||||||
libgitg/gitg-js-utils.c
|
|
||||||
|
|
||||||
libgitg_libgitg_1_0_la_headerdir = $(prefix)/include/libgitg-1.0/libgitg
|
libgitg_libgitg_1_0_la_headerdir = $(prefix)/include/libgitg-1.0/libgitg
|
||||||
libgitg_libgitg_1_0_la_header_HEADERS = libgitg/libgitg.h
|
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_vapidir = $(prefix)/share/vala/vapi
|
||||||
libgitg_libgitg_1_0_la_vapi_DATA = libgitg/libgitg-1.0.vapi
|
libgitg_libgitg_1_0_la_vapi_DATA = libgitg/libgitg-1.0.vapi
|
||||||
|
|
||||||
|
@ -116,17 +103,16 @@ libgitg/gitg-resources.c: $(libgitg_resources_deps)
|
||||||
$(GRESGEN)
|
$(GRESGEN)
|
||||||
|
|
||||||
GITIGNOREFILES += \
|
GITIGNOREFILES += \
|
||||||
$(GITG_GIR_IN) \
|
$(libgitg_libgitg_1_0_la_gir_DATA) \
|
||||||
libgitg/libgitg.h
|
libgitg/libgitg.h
|
||||||
|
|
||||||
CLEANFILES += \
|
CLEANFILES += \
|
||||||
$(libgitg_libgitg_1_0_la_typelib_DATA) \
|
$(libgitg_libgitg_1_0_la_typelib_DATA) \
|
||||||
$(libgitg_libgitg_1_0_la_gir_DATA) \
|
|
||||||
libgitg/gitg-resources.c
|
libgitg/gitg-resources.c
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
$(libgitg_libgitg_1_0_la_pkgconfig_DATA) \
|
$(libgitg_libgitg_1_0_la_pkgconfig_DATA) \
|
||||||
$(GITG_GIR_IN) \
|
$(libgitg_libgitg_1_0_la_gir_DATA) \
|
||||||
$(libgitg_resources_deps)
|
$(libgitg_resources_deps)
|
||||||
|
|
||||||
# vi:ts=8:noet
|
# vi:ts=8:noet
|
||||||
|
|
|
@ -42,26 +42,29 @@ public class Gitg.AvatarCache : Object
|
||||||
return s_instance;
|
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());
|
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 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;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Gdk.Pixbuf? read_avatar_from_file(string id,
|
private async Gdk.Pixbuf? read_avatar_from_file(string id,
|
||||||
File file,
|
File file,
|
||||||
|
int size,
|
||||||
Cancellable? cancellable)
|
Cancellable? cancellable)
|
||||||
{
|
{
|
||||||
InputStream stream;
|
InputStream stream;
|
||||||
|
@ -78,7 +81,7 @@ public class Gitg.AvatarCache : Object
|
||||||
uint8[] buffer = new uint8[4096];
|
uint8[] buffer = new uint8[4096];
|
||||||
var loader = new Gdk.PixbufLoader();
|
var loader = new Gdk.PixbufLoader();
|
||||||
|
|
||||||
loader.set_size(50, 50);
|
loader.set_size(size, size);
|
||||||
|
|
||||||
return yield read_avatar(id, stream, buffer, loader, cancellable);
|
return yield read_avatar(id, stream, buffer, loader, cancellable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,89 +59,6 @@ public class Gitg.DiffStat : Gtk.DrawingArea
|
||||||
construct
|
construct
|
||||||
{
|
{
|
||||||
make_layout();
|
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()
|
private void make_layout()
|
||||||
|
|
270
libgitg/gitg-diff-view-commit-details.vala
Normal file
270
libgitg/gitg-diff-view-commit-details.vala
Normal file
|
@ -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 <<a href=\"mailto:%s\">%s</a>>".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
|
118
libgitg/gitg-diff-view-file.vala
Normal file
118
libgitg/gitg-diff-view-file.vala
Normal file
|
@ -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
|
133
libgitg/gitg-diff-view-hunk.vala
Normal file
133
libgitg/gitg-diff-view-hunk.vala
Normal file
|
@ -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
|
192
libgitg/gitg-diff-view-lines-renderer.vala
Normal file
192
libgitg/gitg-diff-view-lines-renderer.vala
Normal file
|
@ -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
|
|
@ -20,7 +20,7 @@
|
||||||
namespace Gitg
|
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
|
public class DiffViewOptions : Gtk.Grid
|
||||||
{
|
{
|
||||||
[GtkChild (name = "switch_changes_inline")]
|
[GtkChild (name = "switch_changes_inline")]
|
||||||
|
@ -44,12 +44,6 @@ public class DiffViewOptions : Gtk.Grid
|
||||||
[GtkChild (name = "adjustment_tab_width")]
|
[GtkChild (name = "adjustment_tab_width")]
|
||||||
private Gtk.Adjustment d_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")]
|
[GtkChild (name = "separator_first_options")]
|
||||||
private Gtk.Separator d_separator_first_options;
|
private Gtk.Separator d_separator_first_options;
|
||||||
|
|
||||||
|
@ -148,11 +142,6 @@ public class DiffViewOptions : Gtk.Grid
|
||||||
transform_int_to_double,
|
transform_int_to_double,
|
||||||
transform_double_to_int);
|
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)
|
if (view.commit == null)
|
||||||
{
|
{
|
||||||
d_label_changes_inline.visible = false;
|
d_label_changes_inline.visible = false;
|
||||||
|
@ -164,13 +153,6 @@ public class DiffViewOptions : Gtk.Grid
|
||||||
d_separator_first_options.visible = false;
|
d_separator_first_options.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[GtkCallback]
|
|
||||||
private void on_button_developer_tools_clicked()
|
|
||||||
{
|
|
||||||
view.get_inspector().show();
|
|
||||||
hide();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of gitg
|
|
||||||
*
|
|
||||||
* Copyright (C) 2014 - 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Gitg
|
|
||||||
{
|
|
||||||
public errordomain DiffViewRequestIconError
|
|
||||||
{
|
|
||||||
ICON_NOT_FOUND
|
|
||||||
}
|
|
||||||
|
|
||||||
class DiffViewRequestIcon : DiffViewRequest
|
|
||||||
{
|
|
||||||
private Gtk.IconTheme d_theme;
|
|
||||||
|
|
||||||
public DiffViewRequestIcon(DiffView? view, WebKit.URISchemeRequest request, Soup.URI uri)
|
|
||||||
{
|
|
||||||
base(view, request, uri);
|
|
||||||
|
|
||||||
if (view == null)
|
|
||||||
{
|
|
||||||
d_theme = Gtk.IconTheme.get_default();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_theme = Gtk.IconTheme.get_for_screen(view.get_screen());
|
|
||||||
}
|
|
||||||
|
|
||||||
d_view = null;
|
|
||||||
d_hasView = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private InputStream ensure_icon(Cancellable? cancellable, out ulong size) throws DiffViewRequestIconError
|
|
||||||
{
|
|
||||||
var name = Soup.URI.decode(d_uri.get_path());
|
|
||||||
name = name[1:name.length];
|
|
||||||
|
|
||||||
var sizes = parameter("size");
|
|
||||||
|
|
||||||
int s = 60;
|
|
||||||
|
|
||||||
if (sizes != null)
|
|
||||||
{
|
|
||||||
s = int.parse(sizes);
|
|
||||||
}
|
|
||||||
|
|
||||||
Gdk.Pixbuf? icon = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
icon = d_theme.load_icon(name, s, 0);
|
|
||||||
}
|
|
||||||
catch (Error e) {
|
|
||||||
throw new DiffViewRequestIconError.ICON_NOT_FOUND("icon not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (icon == null)
|
|
||||||
{
|
|
||||||
throw new DiffViewRequestIconError.ICON_NOT_FOUND("icon not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
var stream = new MemoryOutputStream.resizable();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
icon.save_to_stream(stream, "png", cancellable);
|
|
||||||
}
|
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
throw new DiffViewRequestIconError.ICON_NOT_FOUND("icon not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
stream.close();
|
|
||||||
}
|
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
throw new DiffViewRequestIconError.ICON_NOT_FOUND("icon not found");
|
|
||||||
}
|
|
||||||
|
|
||||||
var b = stream.steal_as_bytes();
|
|
||||||
|
|
||||||
size = b.length;
|
|
||||||
|
|
||||||
var istream = new MemoryInputStream.from_bytes(b);
|
|
||||||
return istream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override InputStream? run_async(Cancellable? cancellable) throws GLib.Error
|
|
||||||
{
|
|
||||||
ulong size;
|
|
||||||
var stream = ensure_icon(cancellable, out size);
|
|
||||||
|
|
||||||
d_size = size;
|
|
||||||
d_mimetype = "image/png";
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ex:ts=4 noet
|
|
|
@ -1,107 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of gitg
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 - 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Gitg
|
|
||||||
{
|
|
||||||
class DiffViewRequestResource : DiffViewRequest
|
|
||||||
{
|
|
||||||
private File? d_resource;
|
|
||||||
|
|
||||||
public DiffViewRequestResource(DiffView? view, WebKit.URISchemeRequest request, Soup.URI uri)
|
|
||||||
{
|
|
||||||
base(view, request, uri);
|
|
||||||
d_view = null;
|
|
||||||
d_hasView = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private File ensure_resource()
|
|
||||||
{
|
|
||||||
if (d_resource != null)
|
|
||||||
{
|
|
||||||
return d_resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
var path = Soup.URI.decode(d_uri.get_path());
|
|
||||||
|
|
||||||
d_resource = File.new_for_uri("resource://" + path);
|
|
||||||
|
|
||||||
// For debugging
|
|
||||||
if (Environment.get_variable("GITG_GTK_DIFF_VIEW_DEBUG") == "local")
|
|
||||||
{
|
|
||||||
var pre = "/org/gnome/gitg/";
|
|
||||||
|
|
||||||
if (path.has_prefix(pre))
|
|
||||||
{
|
|
||||||
path = path.substring(pre.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
File? repopath;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
repopath = Ggit.Repository.discover(File.new_for_path("."));
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
repopath = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (repopath != null)
|
|
||||||
{
|
|
||||||
d_resource = File.new_for_path(Path.build_filename(repopath.get_path(), "..", "libgitg", "resources", path));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_resource = File.new_for_path(Path.build_filename("resources", path));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return d_resource;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override InputStream? run_async(Cancellable? cancellable) throws GLib.Error
|
|
||||||
{
|
|
||||||
var f = ensure_resource();
|
|
||||||
|
|
||||||
var stream = f.read(cancellable);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var info = f.query_info(FileAttribute.STANDARD_CONTENT_TYPE +
|
|
||||||
"," +
|
|
||||||
FileAttribute.STANDARD_SIZE,
|
|
||||||
0,
|
|
||||||
cancellable);
|
|
||||||
|
|
||||||
d_size = info.get_size();
|
|
||||||
|
|
||||||
var ctype = info.get_content_type();
|
|
||||||
|
|
||||||
if (ctype != null)
|
|
||||||
{
|
|
||||||
d_mimetype = ContentType.get_mime_type(ctype);
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ex:ts=4 noet
|
|
|
@ -1,215 +0,0 @@
|
||||||
/*
|
|
||||||
* This file is part of gitg
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 - 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Gitg
|
|
||||||
{
|
|
||||||
public class DiffViewRequest
|
|
||||||
{
|
|
||||||
protected DiffView? d_view;
|
|
||||||
protected Soup.URI d_uri;
|
|
||||||
protected string? d_mimetype;
|
|
||||||
protected int64 d_size;
|
|
||||||
protected WebKit.URISchemeRequest d_request;
|
|
||||||
private HashTable<string, string>? d_form;
|
|
||||||
protected bool d_hasView;
|
|
||||||
|
|
||||||
public DiffViewRequest(DiffView? view, WebKit.URISchemeRequest request, Soup.URI uri)
|
|
||||||
{
|
|
||||||
d_view = view;
|
|
||||||
d_request = request;
|
|
||||||
d_uri = uri;
|
|
||||||
d_size = -1;
|
|
||||||
d_mimetype = null;
|
|
||||||
d_form = null;
|
|
||||||
d_hasView = view != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Soup.URI uri
|
|
||||||
{
|
|
||||||
get { return d_uri; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool has_view
|
|
||||||
{
|
|
||||||
get { return d_hasView; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finish_empty()
|
|
||||||
{
|
|
||||||
d_request.finish(new MemoryInputStream(),
|
|
||||||
get_content_length(),
|
|
||||||
get_content_type());
|
|
||||||
}
|
|
||||||
|
|
||||||
public string? parameter(string v)
|
|
||||||
{
|
|
||||||
if (d_form == null)
|
|
||||||
{
|
|
||||||
var q = d_uri.get_query();
|
|
||||||
|
|
||||||
if (q != null)
|
|
||||||
{
|
|
||||||
d_form = Soup.Form.decode(q);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_form = new HashTable<string, string>(str_hash, str_equal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return d_form.lookup(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiffView? view
|
|
||||||
{
|
|
||||||
get { return d_view; }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual InputStream? run_async(Cancellable? cancellable) throws GLib.Error
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async InputStream? run_impl(Cancellable? cancellable) throws GLib.Error
|
|
||||||
{
|
|
||||||
SourceFunc callback = run_impl.callback;
|
|
||||||
InputStream? ret = null;
|
|
||||||
Error? err = null;
|
|
||||||
|
|
||||||
new Thread<void*>("gitg-gtk-diff-view", () => {
|
|
||||||
// Actually do it
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ret = run_async(cancellable);
|
|
||||||
}
|
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
err = e;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Schedule the callback in idle
|
|
||||||
Idle.add((owned)callback);
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Wait for it to finish, yield to caller
|
|
||||||
yield;
|
|
||||||
|
|
||||||
if (err != null)
|
|
||||||
{
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the input stream
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal InputStream json_to_stream(Json.Builder builder, Cancellable? cancellable, out int64 size) throws GLib.Error
|
|
||||||
{
|
|
||||||
var gen = new Json.Generator();
|
|
||||||
gen.set_root(builder.get_root());
|
|
||||||
|
|
||||||
var stream = new MemoryOutputStream(null, realloc, free);
|
|
||||||
gen.to_stream(stream, cancellable);
|
|
||||||
|
|
||||||
if (cancellable != null && cancellable.is_cancelled())
|
|
||||||
{
|
|
||||||
throw new IOError.CANCELLED("Cancelled");
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.close();
|
|
||||||
|
|
||||||
uint8[] data = stream.steal_data();
|
|
||||||
size = stream.get_data_size();
|
|
||||||
|
|
||||||
data = data[0:size];
|
|
||||||
|
|
||||||
return new MemoryInputStream.from_data(data, stream.destroy_function);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void run(Cancellable? cancellable)
|
|
||||||
{
|
|
||||||
run_impl.begin(cancellable, (obj, res) => {
|
|
||||||
InputStream? stream = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
stream = run_impl.end(res);
|
|
||||||
}
|
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
if (d_mimetype != null && d_mimetype == "application/json")
|
|
||||||
{
|
|
||||||
var builder = new Json.Builder();
|
|
||||||
|
|
||||||
builder.begin_object();
|
|
||||||
builder.set_member_name("error").add_string_value(e.message);
|
|
||||||
builder.end_object();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int64 size;
|
|
||||||
|
|
||||||
stream = json_to_stream(builder, cancellable, out size);
|
|
||||||
d_request.finish(stream, size, "application/json");
|
|
||||||
}
|
|
||||||
catch (Error jerror)
|
|
||||||
{
|
|
||||||
d_request.finish_error(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
d_request.finish_error(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stream == null)
|
|
||||||
{
|
|
||||||
stream = new MemoryInputStream();
|
|
||||||
}
|
|
||||||
|
|
||||||
d_request.finish(stream,
|
|
||||||
get_content_length(),
|
|
||||||
get_content_type());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual int64 get_content_length()
|
|
||||||
{
|
|
||||||
return d_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual string get_content_type()
|
|
||||||
{
|
|
||||||
if (d_mimetype != null)
|
|
||||||
{
|
|
||||||
return d_mimetype;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return "application/octet-stream";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ex:ts=4 noet
|
|
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of gitg
|
* 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
|
* gitg is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* 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/>.
|
* 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
|
[GtkChild( name = "commit_details" )]
|
||||||
|
private Gitg.DiffViewCommitDetails d_commit_details;
|
||||||
|
|
||||||
|
[GtkChild( name = "grid_files" )]
|
||||||
|
private Gtk.Grid d_grid_files;
|
||||||
|
|
||||||
|
private Ggit.Diff? d_diff;
|
||||||
|
private Commit? d_commit;
|
||||||
|
|
||||||
|
private Ggit.DiffOptions? d_options;
|
||||||
|
private Ggit.OId? d_parent;
|
||||||
|
|
||||||
|
public Ggit.DiffOptions options
|
||||||
{
|
{
|
||||||
private class DiffViewRequestInternal : DiffViewRequest
|
get
|
||||||
{
|
{
|
||||||
public DiffViewRequestInternal(DiffView? view, WebKit.URISchemeRequest request, Soup.URI uri)
|
if (d_options == null)
|
||||||
{
|
{
|
||||||
base(view, request, uri);
|
d_options = new Ggit.DiffOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override InputStream? run_async(Cancellable? cancellable) throws Error
|
return d_options;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public signal void request_select_commit(string id);
|
// TODO
|
||||||
|
public bool has_selection
|
||||||
|
{
|
||||||
|
get { return false; }
|
||||||
|
}
|
||||||
|
|
||||||
private Ggit.Diff? d_diff;
|
private Cancellable d_cancellable;
|
||||||
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;
|
public Ggit.Diff? diff
|
||||||
private static uint64 s_diff_id;
|
{
|
||||||
|
get { return d_diff; }
|
||||||
public File? custom_css { get; construct; }
|
set
|
||||||
public File? custom_js { get; construct; }
|
|
||||||
|
|
||||||
public virtual signal void options_changed()
|
|
||||||
{
|
{
|
||||||
if (d_commit != null)
|
d_diff = value;
|
||||||
{
|
|
||||||
update();
|
d_commit = null;
|
||||||
}
|
d_parent = null;
|
||||||
|
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Ggit.DiffOptions options
|
public Commit? commit
|
||||||
|
{
|
||||||
|
get { return d_commit; }
|
||||||
|
set
|
||||||
{
|
{
|
||||||
get
|
if (d_commit != value)
|
||||||
{
|
{
|
||||||
if (d_options == null)
|
d_commit = value;
|
||||||
{
|
d_diff = null;
|
||||||
d_options = new Ggit.DiffOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
return d_options;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool has_selection
|
|
||||||
{
|
|
||||||
get { return d_has_selection; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private Cancellable d_cancellable;
|
|
||||||
private bool d_loaded;
|
|
||||||
private ulong d_diffid;
|
|
||||||
|
|
||||||
public Ggit.Diff? diff
|
|
||||||
{
|
|
||||||
get { return d_diff; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
d_diff = value;
|
|
||||||
d_commit = null;
|
|
||||||
d_parent = null;
|
d_parent = null;
|
||||||
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual signal void options_changed()
|
||||||
|
{
|
||||||
|
if (d_commit != null)
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool d_wrap;
|
||||||
|
|
||||||
|
public bool wrap
|
||||||
|
{
|
||||||
|
get { return d_wrap; }
|
||||||
|
construct set
|
||||||
|
{
|
||||||
|
if (d_wrap != value)
|
||||||
|
{
|
||||||
|
d_wrap = value;
|
||||||
|
update_wrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default = true;
|
||||||
|
}
|
||||||
|
|
||||||
public Commit? commit
|
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 use_gravatar
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
construct set;
|
||||||
|
default = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int d_tab_width;
|
||||||
|
|
||||||
|
public int tab_width
|
||||||
|
{
|
||||||
|
get { return d_tab_width; }
|
||||||
|
construct set
|
||||||
{
|
{
|
||||||
get { return d_commit; }
|
if (d_tab_width != value)
|
||||||
set
|
|
||||||
{
|
{
|
||||||
if (d_commit != value)
|
d_tab_width = value;
|
||||||
{
|
update_tab_width();
|
||||||
d_commit = value;
|
|
||||||
d_diff = null;
|
|
||||||
d_parent = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
default = 4;
|
||||||
|
}
|
||||||
|
|
||||||
private bool d_wrap;
|
private bool flag_get(Ggit.DiffOption f)
|
||||||
|
{
|
||||||
|
return (options.flags & f) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
public bool wrap
|
private void flag_set(Ggit.DiffOption f, bool val)
|
||||||
|
{
|
||||||
|
var flags = options.flags;
|
||||||
|
|
||||||
|
if (val)
|
||||||
{
|
{
|
||||||
get { return d_wrap; }
|
flags |= f;
|
||||||
construct set
|
}
|
||||||
{
|
else
|
||||||
if (d_wrap != value)
|
{
|
||||||
{
|
flags &= ~f;
|
||||||
d_wrap = value;
|
|
||||||
update_wrap();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool staged { get; set; default = false; }
|
if (flags != options.flags)
|
||||||
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; }
|
options.flags = flags;
|
||||||
construct set
|
options_changed();
|
||||||
{
|
|
||||||
if (d_use_gravatar != value)
|
|
||||||
{
|
|
||||||
d_use_gravatar = value;
|
|
||||||
options_changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
default = true;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int d_tab_width;
|
public bool ignore_whitespace
|
||||||
|
{
|
||||||
|
get { return flag_get(Ggit.DiffOption.IGNORE_WHITESPACE); }
|
||||||
|
set { flag_set(Ggit.DiffOption.IGNORE_WHITESPACE, value); }
|
||||||
|
}
|
||||||
|
|
||||||
public int tab_width
|
private bool d_changes_inline;
|
||||||
|
|
||||||
|
public bool changes_inline
|
||||||
|
{
|
||||||
|
get { return d_changes_inline; }
|
||||||
|
set
|
||||||
{
|
{
|
||||||
get { return d_tab_width; }
|
if (d_changes_inline != value)
|
||||||
construct set
|
|
||||||
{
|
{
|
||||||
if (d_tab_width != value)
|
d_changes_inline = value;
|
||||||
{
|
|
||||||
d_tab_width = value;
|
// TODO
|
||||||
update_tab_width();
|
//options_changed();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
default = 4;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool flag_get(Ggit.DiffOption f)
|
public int context_lines
|
||||||
|
{
|
||||||
|
get { return options.n_context_lines; }
|
||||||
|
|
||||||
|
construct set
|
||||||
{
|
{
|
||||||
return (options.flags & f) != 0;
|
if (options.n_context_lines != value)
|
||||||
}
|
|
||||||
|
|
||||||
private void flag_set(Ggit.DiffOption f, bool val)
|
|
||||||
{
|
|
||||||
var flags = options.flags;
|
|
||||||
|
|
||||||
if (val)
|
|
||||||
{
|
{
|
||||||
flags |= f;
|
options.n_context_lines = value;
|
||||||
}
|
options.n_interhunk_lines = value;
|
||||||
else
|
|
||||||
{
|
|
||||||
flags &= ~f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags != options.flags)
|
|
||||||
{
|
|
||||||
options.flags = flags;
|
|
||||||
|
|
||||||
options_changed();
|
options_changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ignore_whitespace
|
default = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update_wrap()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update_tab_width()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void update()
|
||||||
|
{
|
||||||
|
// If both `d_diff` and `d_commit` are null, clear
|
||||||
|
// the diff content
|
||||||
|
if (d_diff == null && d_commit == null)
|
||||||
{
|
{
|
||||||
get { return flag_get(Ggit.DiffOption.IGNORE_WHITESPACE); }
|
hide();
|
||||||
set { flag_set(Ggit.DiffOption.IGNORE_WHITESPACE, value); }
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool d_changes_inline;
|
show();
|
||||||
|
|
||||||
public bool changes_inline
|
// Cancel running operations
|
||||||
|
d_cancellable.cancel();
|
||||||
|
d_cancellable = new Cancellable();
|
||||||
|
|
||||||
|
if (d_commit != null)
|
||||||
{
|
{
|
||||||
get { return d_changes_inline; }
|
int parent = 0;
|
||||||
set
|
var parents = d_commit.get_parents();
|
||||||
|
|
||||||
|
if (d_parent != null)
|
||||||
{
|
{
|
||||||
if (d_changes_inline != value)
|
for (var i = 0; i < parents.size; i++)
|
||||||
{
|
{
|
||||||
d_changes_inline = value;
|
var id = parents.get_id(i);
|
||||||
|
|
||||||
options_changed();
|
if (id.equal(d_parent))
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int context_lines
|
|
||||||
{
|
|
||||||
get { return options.n_context_lines; }
|
|
||||||
|
|
||||||
construct set
|
|
||||||
{
|
|
||||||
if (options.n_context_lines != value)
|
|
||||||
{
|
|
||||||
options.n_context_lines = value;
|
|
||||||
options.n_interhunk_lines = value;
|
|
||||||
|
|
||||||
options_changed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
default = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
context.set_cache_model(WebKit.CacheModel.DOCUMENT_VIEWER);
|
|
||||||
}
|
|
||||||
|
|
||||||
private string json_settings()
|
|
||||||
{
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
|
|
||||||
private static DiffViewRequest? parse_request(WebKit.URISchemeRequest request)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void gitg_diff_mailto_request(WebKit.URISchemeRequest request)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Gtk.show_uri(null, request.get_uri(), 0);
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
size = (uint)(size * get_screen().get_resolution() / 72.0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void request(DiffViewRequest request)
|
|
||||||
{
|
|
||||||
var did = request.parameter("diffid");
|
|
||||||
|
|
||||||
if (did != null)
|
|
||||||
{
|
|
||||||
uint64 i = uint64.parse(did);
|
|
||||||
|
|
||||||
if (i == d_diffid)
|
|
||||||
{
|
|
||||||
request.run(d_cancellable);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Settings? try_settings(string schema_id)
|
|
||||||
{
|
|
||||||
var source = SettingsSchemaSource.get_default();
|
|
||||||
|
|
||||||
if (source == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (source.lookup(schema_id, true) != null)
|
|
||||||
{
|
|
||||||
return new Settings(schema_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DiffView()
|
|
||||||
{
|
|
||||||
Object();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loaded()
|
|
||||||
{
|
|
||||||
d_loaded = true;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update_wrap()
|
|
||||||
{
|
|
||||||
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 {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update_tab_width()
|
|
||||||
{
|
|
||||||
if (!d_loaded)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_javascript.begin(@"update_tab_width($d_tab_width);", null, (obj, res) => {
|
|
||||||
try
|
|
||||||
{
|
|
||||||
run_javascript.end(res);
|
|
||||||
} catch {}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void update()
|
|
||||||
{
|
|
||||||
if (!d_loaded)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If both `d_diff` and `d_commit` are null, clear
|
|
||||||
// the diff content
|
|
||||||
if (d_diff == null && d_commit == null)
|
|
||||||
{
|
|
||||||
run_javascript.begin("update_diff();", d_cancellable, (obj, res) => {
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
run_javascript.end(res);
|
parent = i;
|
||||||
} catch {}
|
break;
|
||||||
});
|
|
||||||
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
var id = parents.get_id(i);
|
|
||||||
|
|
||||||
if (id.to_string() == d_parent)
|
|
||||||
{
|
|
||||||
parent = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_diff = d_commit.get_diff(options, parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d_diff != null)
|
d_diff = d_commit.get_diff(options, parent);
|
||||||
|
d_commit_details.commit = d_commit;
|
||||||
|
d_commit_details.show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d_commit_details.commit = null;
|
||||||
|
d_commit_details.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d_diff != null)
|
||||||
|
{
|
||||||
|
update_diff(d_diff, d_cancellable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private delegate void Anon();
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
Anon add_hunk = () => {
|
||||||
|
if (current_hunk != null)
|
||||||
{
|
{
|
||||||
run_javascript.begin("update_diff(%lu, %s);".printf(d_diffid, json_settings()), d_cancellable, (obj, res) => {
|
current_file.add_hunk(current_hunk, current_lines);
|
||||||
try
|
|
||||||
|
current_lines = null;
|
||||||
|
current_hunk = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Anon add_file = () => {
|
||||||
|
add_hunk();
|
||||||
|
|
||||||
|
if (current_file != null)
|
||||||
|
{
|
||||||
|
current_file.show();
|
||||||
|
d_grid_files.add(current_file);
|
||||||
|
|
||||||
|
current_file = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
diff.foreach(
|
||||||
|
(delta, progress) => {
|
||||||
|
if (cancellable != null && cancellable.is_cancelled())
|
||||||
{
|
{
|
||||||
run_javascript.end(res);
|
return 1;
|
||||||
} catch {}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void update_has_selection(bool hs)
|
add_file();
|
||||||
{
|
|
||||||
if (d_has_selection != hs)
|
|
||||||
{
|
|
||||||
d_has_selection = hs;
|
|
||||||
notify_property("has-selection");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void load_parent(string id)
|
current_file = new Gitg.DiffViewFile(delta);
|
||||||
{
|
return 0;
|
||||||
request_select_commit(id);
|
},
|
||||||
}
|
|
||||||
|
|
||||||
public void select_parent(string id)
|
(delta, binary) => {
|
||||||
{
|
// FIXME: do we want to handle binary data?
|
||||||
d_parent = id;
|
if (cancellable != null && cancellable.is_cancelled())
|
||||||
update();
|
{
|
||||||
}
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
public void open_url(string url)
|
return 0;
|
||||||
{
|
},
|
||||||
try
|
|
||||||
{
|
|
||||||
Gtk.show_uri(null, url, 0);
|
|
||||||
} catch {}
|
|
||||||
}
|
|
||||||
|
|
||||||
private PatchSet parse_patchset(Json.Node node)
|
(delta, hunk) => {
|
||||||
{
|
if (cancellable != null && cancellable.is_cancelled())
|
||||||
PatchSet ret = new PatchSet();
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
var elems = node.get_array();
|
add_hunk();
|
||||||
ret.filename = elems.get_element(0).get_string();
|
|
||||||
|
|
||||||
var ps = elems.get_element(1).get_array();
|
current_hunk = hunk;
|
||||||
|
current_lines = new Gee.ArrayList<Ggit.DiffLine>();
|
||||||
|
|
||||||
var l = ps.get_length();
|
return 0;
|
||||||
ret.patches = new PatchSet.Patch[l];
|
},
|
||||||
|
|
||||||
for (uint i = 0; i < l; i++)
|
(delta, hunk, line) => {
|
||||||
{
|
if (cancellable != null && cancellable.is_cancelled())
|
||||||
var p = ps.get_element(i).get_array();
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
ret.patches[i] = PatchSet.Patch() {
|
if ((delta.get_flags() & Ggit.DiffFlag.BINARY) == 0)
|
||||||
type = (PatchSet.Type)p.get_element(0).get_int(),
|
{
|
||||||
old_offset = (size_t)p.get_element(1).get_int(),
|
current_lines.add(line);
|
||||||
new_offset = (size_t)p.get_element(2).get_int(),
|
}
|
||||||
length = (size_t)p.get_element(3).get_int()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
} catch {}
|
||||||
|
|
||||||
public async PatchSet[] get_selection()
|
add_hunk();
|
||||||
{
|
add_file();
|
||||||
WebKit.JavascriptResult jsret;
|
}
|
||||||
|
|
||||||
try
|
public async PatchSet[] get_selection()
|
||||||
{
|
{
|
||||||
jsret = yield run_javascript("get_selection();", d_cancellable);
|
// TODO
|
||||||
}
|
return new PatchSet[] {};
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
stderr.printf("Error running get_selection(): %s\n", e.message);
|
|
||||||
return new PatchSet[] {};
|
|
||||||
}
|
|
||||||
|
|
||||||
var json = GitgJsUtils.get_json(jsret);
|
|
||||||
var parser = new Json.Parser();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
parser.load_from_data(json, -1);
|
|
||||||
}
|
|
||||||
catch (Error e)
|
|
||||||
{
|
|
||||||
stderr.printf("Error parsing json: %s\n", e.message);
|
|
||||||
return new PatchSet[] {};
|
|
||||||
}
|
|
||||||
|
|
||||||
var root = parser.get_root();
|
|
||||||
|
|
||||||
var elems = root.get_array();
|
|
||||||
var l = elems.get_length();
|
|
||||||
|
|
||||||
var ret = new PatchSet[l];
|
|
||||||
|
|
||||||
for (uint i = 0; i < l; i++)
|
|
||||||
{
|
|
||||||
ret[i] = parse_patchset(elems.get_element(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
m.add(opts);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
opts.show();
|
|
||||||
m.show();
|
|
||||||
|
|
||||||
opts.notify["visible"].connect(() => {
|
|
||||||
m.destroy();
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,17 @@ public void init() throws Error
|
||||||
|
|
||||||
factory.register(typeof(Ggit.Remote),
|
factory.register(typeof(Ggit.Remote),
|
||||||
typeof(Gitg.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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,39 +17,24 @@
|
||||||
* along with gitg. If not, see <http://www.gnu.org/licenses/>.
|
* 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 provider = new Gtk.CssProvider();
|
||||||
|
var f = File.new_for_uri("resource:///org/gnome/gitg/ui/" + id);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var ret = GitgExt.UI.from_builder(id, object);
|
provider.load_from_file(f);
|
||||||
|
}
|
||||||
if (ret == null)
|
catch (Error e)
|
||||||
{
|
{
|
||||||
return null;
|
warning("Error while loading resource: %s", e.message);
|
||||||
}
|
return null;
|
||||||
|
|
||||||
return (T?)ret[object];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Gtk.CssProvider? load_css(string id)
|
return provider;
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<gresources>
|
<gresources>
|
||||||
<gresource prefix="/org/gnome/gitg">
|
<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-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-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" preprocess="xml-stripblanks">ui/gitg-sidebar.ui</file>
|
||||||
|
|
||||||
|
<file compressed="true">ui/libgitg-style.css</file>
|
||||||
</gresource>
|
</gresource>
|
||||||
</gresources>
|
</gresources>
|
||||||
|
|
||||||
|
|
|
@ -1,703 +0,0 @@
|
||||||
function log(e)
|
|
||||||
{
|
|
||||||
self.postMessage({'log': e});
|
|
||||||
}
|
|
||||||
|
|
||||||
function html_escape(s)
|
|
||||||
{
|
|
||||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function Template(template, placeholders)
|
|
||||||
{
|
|
||||||
var components = [template];
|
|
||||||
|
|
||||||
for (var i = 0; i < placeholders.length; i++)
|
|
||||||
{
|
|
||||||
var name = placeholders[i];
|
|
||||||
var varspec = '\\$\\{' + name + '\\}';
|
|
||||||
var r = new RegExp('<!-- ' + varspec + ' -->|' + varspec, 'g');
|
|
||||||
|
|
||||||
var newcomp = [];
|
|
||||||
|
|
||||||
for (var j = 0; j < components.length; j += 2)
|
|
||||||
{
|
|
||||||
var parts = components[j].split(r);
|
|
||||||
|
|
||||||
for (var k = 0; k < parts.length; k++)
|
|
||||||
{
|
|
||||||
newcomp.push(parts[k]);
|
|
||||||
|
|
||||||
if (k != parts.length - 1)
|
|
||||||
{
|
|
||||||
newcomp.push(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (j < components.length - 1)
|
|
||||||
{
|
|
||||||
newcomp.push(components[j + 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
components = newcomp;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.components = components;
|
|
||||||
}
|
|
||||||
|
|
||||||
Template.prototype.execute = function(replacements) {
|
|
||||||
var ret = '';
|
|
||||||
|
|
||||||
for (var i = 0; i < this.components.length - 1; i += 2)
|
|
||||||
{
|
|
||||||
var name = this.components[i + 1];
|
|
||||||
ret += this.components[i] + replacements[name];
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret + this.components[this.components.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
const EDIT_INSERT = 0;
|
|
||||||
const EDIT_DELETE = 1;
|
|
||||||
const EDIT_SUBSTITUTE = 2;
|
|
||||||
const EDIT_KEEP = 3;
|
|
||||||
|
|
||||||
function min_dist(ins, del, sub)
|
|
||||||
{
|
|
||||||
if (ins <= del)
|
|
||||||
{
|
|
||||||
if (sub < ins)
|
|
||||||
{
|
|
||||||
return {distance: sub, direction: EDIT_SUBSTITUTE};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return {distance: ins, direction: EDIT_INSERT};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (del <= sub)
|
|
||||||
{
|
|
||||||
return {distance: del, direction: EDIT_DELETE};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return {distance: sub, direction: EDIT_SUBSTITUTE};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit_distance(a, b)
|
|
||||||
{
|
|
||||||
var nr = a.length + 1;
|
|
||||||
var nc = b.length + 1;
|
|
||||||
|
|
||||||
var d = new Uint16Array(nr * nc);
|
|
||||||
var e = new Int8Array(nr * nc);
|
|
||||||
|
|
||||||
for (var i = 0; i < nr; i++)
|
|
||||||
{
|
|
||||||
d[i] = i;
|
|
||||||
e[i] = EDIT_DELETE;
|
|
||||||
}
|
|
||||||
|
|
||||||
var p = 0;
|
|
||||||
|
|
||||||
for (var j = 0; j < nc; j++)
|
|
||||||
{
|
|
||||||
d[p] = j;
|
|
||||||
e[p] = EDIT_INSERT;
|
|
||||||
|
|
||||||
p += nr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start calculating distance at first element (row 1, column 1)
|
|
||||||
p = nr + 1;
|
|
||||||
|
|
||||||
for (var j = 0; j < b.length; j++)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < a.length; i++)
|
|
||||||
{
|
|
||||||
if (a[i] == b[j])
|
|
||||||
{
|
|
||||||
// zero cost substitute
|
|
||||||
d[p] = d[p - nr - 1];
|
|
||||||
e[p] = EDIT_KEEP;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var md = min_dist(d[p - nr] + 1, // insert
|
|
||||||
d[p - 1] + 1, // delete
|
|
||||||
d[p - nr - 1] + 2); // substitute
|
|
||||||
|
|
||||||
d[p] = md.distance;
|
|
||||||
e[p] = md.direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Advance one to skip first row
|
|
||||||
p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
var ret = [];
|
|
||||||
var pi = [nr, 1, nr + 1, nr + 1];
|
|
||||||
|
|
||||||
p = nr * nc - 1;
|
|
||||||
|
|
||||||
var cost = d[p];
|
|
||||||
|
|
||||||
// Walk backwards to determine shortest path
|
|
||||||
while (p > 0)
|
|
||||||
{
|
|
||||||
if (e[p] == EDIT_SUBSTITUTE)
|
|
||||||
{
|
|
||||||
ret.push(EDIT_INSERT);
|
|
||||||
ret.push(EDIT_DELETE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret.push(e[p]);
|
|
||||||
}
|
|
||||||
|
|
||||||
p -= pi[e[p]];
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.reverse();
|
|
||||||
return {moves: ret, cost: cost};
|
|
||||||
}
|
|
||||||
|
|
||||||
const LINE_CONTEXT = ' '.charCodeAt(0);
|
|
||||||
const LINE_ADDED = '+'.charCodeAt(0);
|
|
||||||
const LINE_REMOVED = '-'.charCodeAt(0);
|
|
||||||
const LINE_CONTEXT_EOFNL = '='.charCodeAt(0);
|
|
||||||
const LINE_CONTEXT_ADD_EOFNL = '>'.charCodeAt(0);
|
|
||||||
const LINE_CONTEXT_DEL_EOFNL = '<'.charCodeAt(0);
|
|
||||||
|
|
||||||
function split_words(lines)
|
|
||||||
{
|
|
||||||
var ret = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
{
|
|
||||||
ret.push('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
var c = lines[i].content;
|
|
||||||
|
|
||||||
if (lines[i].trailing_whitespace)
|
|
||||||
{
|
|
||||||
c += lines[i].trailing_whitespace;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Split on word boundaries, as well as underscores and tabs
|
|
||||||
var words = c.split(/\b|(?=[_\t])/);
|
|
||||||
|
|
||||||
if (words.length > 0 && words[0].length == 0)
|
|
||||||
{
|
|
||||||
words = words.slice(1, words.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (words.length > 0 && words[words.length - 1].length == 0)
|
|
||||||
{
|
|
||||||
words = words.slice(0, words.length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ret.concat(words);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret.push('\n');
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_content(content)
|
|
||||||
{
|
|
||||||
return html_escape(content);;
|
|
||||||
}
|
|
||||||
|
|
||||||
function make_content_cell(content, tws)
|
|
||||||
{
|
|
||||||
content = make_content(content);
|
|
||||||
|
|
||||||
var ws = '';
|
|
||||||
|
|
||||||
if (tws)
|
|
||||||
{
|
|
||||||
ws = make_content(tws);
|
|
||||||
ws = '<span class="trailing-whitespace">' + ws + '</span>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<td class="code">' + content + ws + '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function edit_type_to_cls(tp)
|
|
||||||
{
|
|
||||||
switch (tp)
|
|
||||||
{
|
|
||||||
case EDIT_DELETE:
|
|
||||||
return "removed";
|
|
||||||
case EDIT_INSERT:
|
|
||||||
return "added";
|
|
||||||
default:
|
|
||||||
return "context";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function lines_to_word_diff_rows(removed, added, ccontext)
|
|
||||||
{
|
|
||||||
// concat line contents and split on word boundaries
|
|
||||||
var remc = split_words(removed);
|
|
||||||
var addc = split_words(added);
|
|
||||||
|
|
||||||
var dist = edit_distance(remc, addc);
|
|
||||||
|
|
||||||
var row = '';
|
|
||||||
var rows = '';
|
|
||||||
|
|
||||||
var didinsert = false;
|
|
||||||
var didremove = false;
|
|
||||||
|
|
||||||
var dellines = 0;
|
|
||||||
var inslines = 0;
|
|
||||||
|
|
||||||
var delptr = 0;
|
|
||||||
var insptr = 0;
|
|
||||||
|
|
||||||
// Construct rows containing the word diff, based on moves
|
|
||||||
for (var i = 0; i < dist.moves.length; i++)
|
|
||||||
{
|
|
||||||
var word = '';
|
|
||||||
|
|
||||||
switch (dist.moves[i])
|
|
||||||
{
|
|
||||||
case EDIT_DELETE:
|
|
||||||
word = remc[delptr];
|
|
||||||
delptr++;
|
|
||||||
|
|
||||||
if (word == '\n')
|
|
||||||
{
|
|
||||||
dellines++;
|
|
||||||
ccontext.removed++;
|
|
||||||
}
|
|
||||||
|
|
||||||
didremove = true;
|
|
||||||
break;
|
|
||||||
case EDIT_INSERT:
|
|
||||||
word = addc[insptr];
|
|
||||||
insptr++;
|
|
||||||
|
|
||||||
if (word == '\n')
|
|
||||||
{
|
|
||||||
inslines++;
|
|
||||||
ccontext.added++;
|
|
||||||
}
|
|
||||||
|
|
||||||
didinsert = true;
|
|
||||||
break;
|
|
||||||
case EDIT_KEEP:
|
|
||||||
// Keep the same
|
|
||||||
word = remc[delptr];
|
|
||||||
|
|
||||||
if (word == '\n')
|
|
||||||
{
|
|
||||||
inslines++;
|
|
||||||
dellines++;
|
|
||||||
|
|
||||||
ccontext.added++;
|
|
||||||
ccontext.removed++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
didinsert = true;
|
|
||||||
didremove = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
delptr++;
|
|
||||||
insptr++;
|
|
||||||
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (word == '\n')
|
|
||||||
{
|
|
||||||
var tp = ' ';
|
|
||||||
var cold = '';
|
|
||||||
var cnew = '';
|
|
||||||
|
|
||||||
if (didinsert && didremove)
|
|
||||||
{
|
|
||||||
tp = '±';
|
|
||||||
|
|
||||||
cold = ccontext.old;
|
|
||||||
cnew = ccontext.new;
|
|
||||||
}
|
|
||||||
else if (didinsert)
|
|
||||||
{
|
|
||||||
tp = '+';
|
|
||||||
|
|
||||||
cnew = ccontext.new;
|
|
||||||
}
|
|
||||||
else if (didremove)
|
|
||||||
{
|
|
||||||
tp = '-';
|
|
||||||
|
|
||||||
cold = ccontext.old;
|
|
||||||
}
|
|
||||||
|
|
||||||
rows += '<tr class="' + edit_type_to_cls(dist.moves[i]) + '"> \
|
|
||||||
<td class="gutter old">' + cold + '</td> \
|
|
||||||
<td class="gutter new">' + cnew + '</td> \
|
|
||||||
<td class="gutter type">' + tp + '</td> \
|
|
||||||
<td class="code">' + row + '</td></tr>';
|
|
||||||
|
|
||||||
row = '';
|
|
||||||
|
|
||||||
didremove = false;
|
|
||||||
didinsert = false;
|
|
||||||
|
|
||||||
if (dist.moves[i] == EDIT_INSERT || dist.moves[i] == EDIT_KEEP)
|
|
||||||
{
|
|
||||||
ccontext.new++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dist.moves[i] == EDIT_DELETE || dist.moves[i] == EDIT_KEEP)
|
|
||||||
{
|
|
||||||
ccontext.old++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var content = make_content(word);
|
|
||||||
var cls = edit_type_to_cls(dist.moves[i]);
|
|
||||||
|
|
||||||
if (cls.length != 0)
|
|
||||||
{
|
|
||||||
row += '<span class="' + cls + '">' + content + '</span>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
row += content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (row.length != 0)
|
|
||||||
{
|
|
||||||
rows += '<tr class="' + edit_type_to_cls(dist.moves[dist.moves.length - 1]) + '"> \
|
|
||||||
<td class="gutter old">' + ccontext.old + '</td> \
|
|
||||||
<td class="gutter new">' + ccontext.new + '</td> \
|
|
||||||
<td class="gutter type"> </td> \
|
|
||||||
<td class="code">' + row + '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
return rows;
|
|
||||||
}
|
|
||||||
|
|
||||||
function line_to_row(l, ccontext)
|
|
||||||
{
|
|
||||||
var o = String.fromCharCode(l.type);
|
|
||||||
|
|
||||||
var row = '<tr data-offset="' + l.offset + '" data-length="' + l.length + '" class="';
|
|
||||||
|
|
||||||
switch (l.type)
|
|
||||||
{
|
|
||||||
case LINE_CONTEXT:
|
|
||||||
row += 'context"> \
|
|
||||||
<td class="gutter old">' + ccontext.old + '</td> \
|
|
||||||
<td class="gutter new">' + ccontext.new + '</td>';
|
|
||||||
|
|
||||||
ccontext.old++;
|
|
||||||
ccontext.new++;
|
|
||||||
break;
|
|
||||||
case LINE_ADDED:
|
|
||||||
row += 'added"> \
|
|
||||||
<td class="gutter old"></td> \
|
|
||||||
<td class="gutter new">' + ccontext.new + '</td>';
|
|
||||||
|
|
||||||
ccontext.new++;
|
|
||||||
ccontext.added++;
|
|
||||||
break;
|
|
||||||
case LINE_REMOVED:
|
|
||||||
row += 'removed"> \
|
|
||||||
<td class="gutter old">' + ccontext.old + '</td> \
|
|
||||||
<td class="gutter new"></td>';
|
|
||||||
|
|
||||||
ccontext.old++;
|
|
||||||
ccontext.removed++;
|
|
||||||
break;
|
|
||||||
case LINE_CONTEXT_EOFNL:
|
|
||||||
case LINE_CONTEXT_ADD_EOFNL:
|
|
||||||
case LINE_CONTEXT_DEL_EOFNL:
|
|
||||||
row += 'context"> \
|
|
||||||
<td class="gutter old"></td> \
|
|
||||||
<td class="gutter new"></td>';
|
|
||||||
l.content = l.content.substr(1, l.content.length);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
o = ' ';
|
|
||||||
row += '">';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o == ' ')
|
|
||||||
{
|
|
||||||
o = ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
row += '<td class="gutter type">' + o + '</td>';
|
|
||||||
row += make_content_cell(l.content, l.trailing_whitespace);
|
|
||||||
row += '</tr>';
|
|
||||||
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
function diff_file(file, lnstate, data)
|
|
||||||
{
|
|
||||||
var file_body = '';
|
|
||||||
|
|
||||||
var ccontext = {
|
|
||||||
added: 0,
|
|
||||||
removed: 0,
|
|
||||||
old: 0,
|
|
||||||
new: 0
|
|
||||||
};
|
|
||||||
|
|
||||||
for (var i = 0; i < file.hunks.length; ++i)
|
|
||||||
{
|
|
||||||
var h = file.hunks[i];
|
|
||||||
|
|
||||||
if (!h)
|
|
||||||
{
|
|
||||||
file_body += '<tr class="context"> \
|
|
||||||
<td class="gutter old">' + lnstate.gutterdots + '</td> \
|
|
||||||
<td class="gutter new">' + lnstate.gutterdots + '</td> \
|
|
||||||
<td class="gutter type"> </td> \
|
|
||||||
<td></td> \
|
|
||||||
</tr>';
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ccontext.old = h.range.old.start;
|
|
||||||
ccontext.new = h.range.new.start;
|
|
||||||
|
|
||||||
var hunk_header = '<span class="hunk_stats">@@ -' + h.range.old.start + ',' + h.range.old.lines + ' +' + h.range.new.start + ',' + h.range.new.lines + ' @@</span>';
|
|
||||||
|
|
||||||
hunk_header += ' <span class="hunk_context">' + html_escape(h.header) + '</span>';
|
|
||||||
|
|
||||||
file_body += '<tr class="hunk_header"> \
|
|
||||||
<td class="gutter old">' + lnstate.gutterdots + '</td> \
|
|
||||||
<td class="gutter new">' + lnstate.gutterdots + '</td> \
|
|
||||||
<td class="gutter type"> </td> \
|
|
||||||
<td class="hunk_header">' + hunk_header + '</td> \
|
|
||||||
</tr>';
|
|
||||||
|
|
||||||
var j = 0;
|
|
||||||
|
|
||||||
while (j < h.lines.length)
|
|
||||||
{
|
|
||||||
var l = h.lines[j];
|
|
||||||
var process = 1;
|
|
||||||
|
|
||||||
if (data.settings.changes_inline && (l.type == LINE_ADDED || l.type == LINE_REMOVED))
|
|
||||||
{
|
|
||||||
// Obtain block of added/removed or removed/added
|
|
||||||
var fj = j;
|
|
||||||
|
|
||||||
while (fj < h.lines.length && h.lines[fj].type == l.type)
|
|
||||||
{
|
|
||||||
fj++;
|
|
||||||
}
|
|
||||||
|
|
||||||
var lj = fj;
|
|
||||||
|
|
||||||
if (lj < h.lines.length && (h.lines[lj].type == LINE_ADDED || h.lines[lj].type == LINE_REMOVED))
|
|
||||||
{
|
|
||||||
var ctp = h.lines[lj].type;
|
|
||||||
|
|
||||||
while (lj < h.lines.length && h.lines[lj].type == ctp)
|
|
||||||
{
|
|
||||||
lj++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lj - fj > 0)
|
|
||||||
{
|
|
||||||
// word diff of block
|
|
||||||
process = 0;
|
|
||||||
|
|
||||||
var flines = h.lines.slice(j, fj);
|
|
||||||
var llines = h.lines.slice(fj, lj);
|
|
||||||
|
|
||||||
var ladded = (l.type == LINE_ADDED ? flines : llines);
|
|
||||||
var lremoved = (l.type == LINE_REMOVED ? flines : llines);
|
|
||||||
|
|
||||||
var wdiff = lines_to_word_diff_rows(lremoved, ladded, ccontext);
|
|
||||||
|
|
||||||
if (wdiff == null)
|
|
||||||
{
|
|
||||||
process = lj - j;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file_body += wdiff;
|
|
||||||
|
|
||||||
for (var k = 0; k < lj - j; k++)
|
|
||||||
{
|
|
||||||
lnstate.tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
j = lj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Safe to process directly added/removed lines here, so
|
|
||||||
// we don't recheck for a possible block
|
|
||||||
process = fj - j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var k = j; k < j + process; k++)
|
|
||||||
{
|
|
||||||
file_body += line_to_row(h.lines[k], ccontext);
|
|
||||||
lnstate.tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
j += process;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var file_path = '';
|
|
||||||
var file_stats = '';
|
|
||||||
var file_classes = '';
|
|
||||||
|
|
||||||
if (file.file)
|
|
||||||
{
|
|
||||||
if (file.similarity > 0)
|
|
||||||
{
|
|
||||||
file_path = file.file.new.path + ' ← ' +file.file.old.path;
|
|
||||||
}
|
|
||||||
else if (file.file.new.path)
|
|
||||||
{
|
|
||||||
file_path = file.file.new.path;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file_path = file.file.old.path;
|
|
||||||
}
|
|
||||||
|
|
||||||
var total = ccontext.added + ccontext.removed;
|
|
||||||
var addedp = Math.floor(ccontext.added / total * 100);
|
|
||||||
var removedp = 100 - addedp;
|
|
||||||
|
|
||||||
file_stats = '<span class="file_stats"><span class="number">' + (ccontext.added + ccontext.removed) + '</span><span class="bar"><span class="added" style="width: ' + addedp + '%;"></span><span class="removed" style="width: ' + removedp + '%;"></span></span></span>';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
file_classes = 'background';
|
|
||||||
}
|
|
||||||
|
|
||||||
var repls = {
|
|
||||||
'FILE_PATH': file_path,
|
|
||||||
'FILE_BODY': file_body,
|
|
||||||
'FILE_STATS': file_stats,
|
|
||||||
'FILE_FILENAME': file_path,
|
|
||||||
'FILE_CLASSES': file_classes
|
|
||||||
};
|
|
||||||
|
|
||||||
return lnstate.template.execute(repls);
|
|
||||||
}
|
|
||||||
|
|
||||||
function diff_files(files, lines, maxlines, data)
|
|
||||||
{
|
|
||||||
var placeholders = [
|
|
||||||
'FILE_PATH',
|
|
||||||
'FILE_BODY',
|
|
||||||
'FILE_STATS',
|
|
||||||
'FILE_FILENAME',
|
|
||||||
'FILE_CLASSES'
|
|
||||||
];
|
|
||||||
|
|
||||||
var template = new Template(data.file_template, placeholders);
|
|
||||||
|
|
||||||
var lnstate = {
|
|
||||||
lines: lines,
|
|
||||||
maxlines: maxlines,
|
|
||||||
gutterdots: new Array(maxlines.toString().length + 1).join('.'),
|
|
||||||
processed: 0,
|
|
||||||
nexttick: 0,
|
|
||||||
tickfreq: 0.01,
|
|
||||||
template: template,
|
|
||||||
};
|
|
||||||
|
|
||||||
lnstate.tick = function() {
|
|
||||||
lnstate.processed++;
|
|
||||||
|
|
||||||
var proc = lnstate.processed / lnstate.lines;
|
|
||||||
|
|
||||||
if (proc >= lnstate.nexttick)
|
|
||||||
{
|
|
||||||
self.postMessage({tick: proc});
|
|
||||||
|
|
||||||
while (proc >= lnstate.nexttick)
|
|
||||||
{
|
|
||||||
lnstate.nexttick += lnstate.tickfreq;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// special empty background filler
|
|
||||||
var f = diff_file({hunks: [null]}, lnstate, data);
|
|
||||||
|
|
||||||
for (var i = 0; i < files.length; ++i)
|
|
||||||
{
|
|
||||||
f += diff_file(files[i], lnstate, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
function handle_error(data, message) {
|
|
||||||
if (!message)
|
|
||||||
{
|
|
||||||
message = 'unknown internal error';
|
|
||||||
}
|
|
||||||
|
|
||||||
var msg = 'Internal error while loading diff: ' + message;
|
|
||||||
|
|
||||||
self.postMessage({url: data.url, diff_html: '<div class="error"><p>' + html_escape(msg) + '</p><p>This usually indicates a bug in gitg. Please consider filing a bug report at <a href="https://bugzilla.gnome.org/browse.cgi?product=gitg" onclick=\"javascript:return open_url(this);\">https://bugzilla.gnome.org/browse.cgi?product=gitg</a></p></div>'});
|
|
||||||
}
|
|
||||||
|
|
||||||
self.onmessage = function(event) {
|
|
||||||
var data = event.data;
|
|
||||||
|
|
||||||
// Make request to get the diff formatted in json
|
|
||||||
var r = new XMLHttpRequest();
|
|
||||||
|
|
||||||
r.onerror = function(e) {
|
|
||||||
handle_error(data, e.target.responseText);
|
|
||||||
};
|
|
||||||
|
|
||||||
r.onload = function(e) {
|
|
||||||
var j = JSON.parse(r.responseText);
|
|
||||||
|
|
||||||
if (j.error !== undefined)
|
|
||||||
{
|
|
||||||
handle_error(data, j.error);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var html = diff_files(j.diff, j.lines, j.maxlines, data);
|
|
||||||
self.postMessage({url: data.url, diff_html: html});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
r.open("GET", data.url);
|
|
||||||
r.send();
|
|
||||||
};
|
|
||||||
|
|
||||||
/* vi:ts=4 */
|
|
|
@ -1,359 +0,0 @@
|
||||||
body, html {
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
min-height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#templates {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff {
|
|
||||||
font-family: monospace;
|
|
||||||
-webkit-tab-size: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file {
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file.background tr.file_header {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file.background {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: -1;
|
|
||||||
opacity: 0.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file.background table.file {
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.author-info {
|
|
||||||
min-height: 50px;
|
|
||||||
padding-top: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
img.avatar {
|
|
||||||
float: left;
|
|
||||||
margin-right: 10px;
|
|
||||||
border-radius: 10px 10px 10px 10px;
|
|
||||||
min-width: 60px;
|
|
||||||
min-height: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .parents .title {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .parents ul {
|
|
||||||
list-style: none;
|
|
||||||
margin-top: 6px;
|
|
||||||
margin-left: 12px;
|
|
||||||
padding-left: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit {
|
|
||||||
padding: 10px 10px 3px 10px;
|
|
||||||
font-family: sans-serif;
|
|
||||||
background: #f3f3f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .message {
|
|
||||||
margin-top: 15px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td.gutter {
|
|
||||||
padding-left: 6px;
|
|
||||||
padding-right: 6px;
|
|
||||||
background-color: #ececec;
|
|
||||||
color: #aaa;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td.code {
|
|
||||||
white-space: pre;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.tab {
|
|
||||||
overflow: hidden;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.trailing-whitespace {
|
|
||||||
background-color: #cc3333;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table.wrapped td.code {
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.context td:last-child,
|
|
||||||
div#diff div.file table td:last-child span.context {
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
div#diff div.file table tr.added td:last-child,
|
|
||||||
div#diff div.file table td:last-child span.added {
|
|
||||||
background-color: #ddffdd;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.added.selected td:last-child {
|
|
||||||
background-color: #a8cfd6;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.removed.selected td:last-child {
|
|
||||||
background-color: #b8bed6;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.removed td:last-child,
|
|
||||||
div#diff div.file table td:last-child span.removed {
|
|
||||||
background-color: #ffdddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.hunk_header td {
|
|
||||||
padding-top: 6px;
|
|
||||||
padding-bottom: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.file_header td {
|
|
||||||
border-top: 1px solid #ccc;
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
background: #d3d7cf;
|
|
||||||
vertical-align: middle;
|
|
||||||
transition: background-color 200ms, color 200ms;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.file_header td:hover {
|
|
||||||
background: #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.expander {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
text-align: center;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 3px;
|
|
||||||
padding-right: 6px;
|
|
||||||
margin-left: 6px;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
tbody.collapsed > :not(.file_header) {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tbody.collapsed tr.file_header td {
|
|
||||||
border: 0;
|
|
||||||
background-color: #f3f3f3;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff_content div.file tbody.collapsed.after-uncollapsed tr.file_header td {
|
|
||||||
border-top: 1px solid #ccc;
|
|
||||||
padding-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff_content div.file tbody.collapsed.before-uncollapsed tr.file_header td {
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
padding-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats {
|
|
||||||
width: 75px;
|
|
||||||
background-color: #ececec;
|
|
||||||
padding: 3px;
|
|
||||||
border-radius: 5px;
|
|
||||||
box-shadow: 1px 1px #ccc inset;
|
|
||||||
margin: 5px 8px 5px 3px;
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tbody.collapsed span.file_stats {
|
|
||||||
margin-top: 1px;
|
|
||||||
margin-bottom: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats .number, span.file_stats .bar {
|
|
||||||
display: table-cell;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats .bar {
|
|
||||||
width: 100%;
|
|
||||||
padding: 0px 0px 0px 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats .added, span.file_stats .removed {
|
|
||||||
height: 5px;
|
|
||||||
float: left;
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats .added {
|
|
||||||
background-color: #33cc33;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.file_stats .removed {
|
|
||||||
background-color: #cc3333;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.file_header + tr.hunk_header td.hunk_header {
|
|
||||||
border-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.hunk_header td.hunk_header {
|
|
||||||
color: #aaa;
|
|
||||||
background-color: #ececec;
|
|
||||||
border-top: 1px solid #d3d7cf;
|
|
||||||
border-bottom: 1px solid #d3d7cf;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.hunk_header.selected td.hunk_header {
|
|
||||||
color: #aaa;
|
|
||||||
background-color: #ececff;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td {
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td.gutter {
|
|
||||||
-webkit-user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td.gutter.type {
|
|
||||||
border-right: 3px solid #d3d7cf;
|
|
||||||
padding: 0px 3px 0px 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table tr.hunk_header td.gutter.type {
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
div#diff div.file table td.gutter.old {
|
|
||||||
border-right: 1px solid #d3d7cf;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .date,
|
|
||||||
div.commit .sha1,
|
|
||||||
div.commit .expander-all {
|
|
||||||
color: #888a85;
|
|
||||||
font-size: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .committer {
|
|
||||||
font-size: 0.8em;
|
|
||||||
display: inline-block;
|
|
||||||
margin-top: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .committer .date {
|
|
||||||
font-size: 1em;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .sha1 {
|
|
||||||
font-family: monospace;
|
|
||||||
text-align: right;
|
|
||||||
display: inline-block;
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .footer {
|
|
||||||
margin-top: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .expander-all {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .message {
|
|
||||||
white-space: pre-wrap;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .note_message {
|
|
||||||
margin-left: 5px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .parent-chooser {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.commit .parent-chooser select {
|
|
||||||
margin-left: 6px;
|
|
||||||
padding: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #3465a4;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.loading {
|
|
||||||
margin: 30px;
|
|
||||||
border: 1px solid #d3d7cf;
|
|
||||||
background: -webkit-gradient(linear, left top, left bottom, from(#eeeeec), to(#d3d7cf));
|
|
||||||
font-size: 1.2em;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #333;
|
|
||||||
text-align: center;
|
|
||||||
padding: 30px;
|
|
||||||
font-family: sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
span.hunk_stats, span.file_path, span.hunk_context {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
.diff_actions {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.diff_actions button {
|
|
||||||
padding: 3px 6px 3px 6px;
|
|
||||||
margin-right: 3px;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
#diff_header {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#diff_content div.error {
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid #aaa;
|
|
||||||
background-color: #ffdddd;
|
|
||||||
margin: 12px;
|
|
||||||
font-family: initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
#diff_content div.error p:first-child {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#diff_content div.error p:last-child {
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* vi:ts=2:et */
|
|
|
@ -1,63 +0,0 @@
|
||||||
<!DOCTYPE>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" href="diff-view.css" type="text/css" media="screen" charset="utf-8" />
|
|
||||||
<script type="text/javascript" src="jquery-2.0.3.min.js"></script>
|
|
||||||
<script type="text/javascript" src="diff-view.js"></script>
|
|
||||||
|
|
||||||
<style id="dynamic_styles">
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="templates">
|
|
||||||
<!-- Diff template -->
|
|
||||||
<div class="file ${FILE_CLASSES}" data-filename="${FILE_FILENAME}">
|
|
||||||
<table class="file">
|
|
||||||
<colgroup>
|
|
||||||
<col width="0">
|
|
||||||
<col width="0">
|
|
||||||
<col width="0">
|
|
||||||
<col width="100%">
|
|
||||||
</colgroup>
|
|
||||||
<tbody>
|
|
||||||
<tr class="file_header">
|
|
||||||
<td colspan="4">
|
|
||||||
<!-- BLACK DOWN-POINTING TRIANGLE -->
|
|
||||||
<span class="expander">▼</span><!-- ${FILE_STATS} --><span class="file_path"><!-- ${FILE_PATH} --></span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<!-- ${FILE_BODY} -->
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="diff">
|
|
||||||
<div id="diff_header">
|
|
||||||
<div class="commit">
|
|
||||||
<div class="parent-chooser" data-id="parent_chooser">
|
|
||||||
</div>
|
|
||||||
<img class="avatar" data-id="avatar" src="gitg-diff:/icon/avatar-default-symbolic?size=60"/>
|
|
||||||
<div class="author-info">
|
|
||||||
<span class="author" data-id="author"></span><br/>
|
|
||||||
<span class="date" data-id="date"></span><br/>
|
|
||||||
<div class="author committer" data-id="committed-by"></div>
|
|
||||||
</div>
|
|
||||||
<p class="message" data-id="message"></p>
|
|
||||||
<p data-id="notes_container">
|
|
||||||
<span class="notes" data-id="notes"></span><br/>
|
|
||||||
<span class="note_message" data-id="note_message"></span>
|
|
||||||
</p>
|
|
||||||
<p class="parents" data-id="parents">
|
|
||||||
</p>
|
|
||||||
<div class="footer">
|
|
||||||
<span class="expander-all" data-id="expander-all">Expand all</span>
|
|
||||||
<span class="sha1" data-id="sha1"></span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="diff_content"></div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
<html>
|
|
||||||
|
|
||||||
<!-- vi:ts=2:et >
|
|
|
@ -1,778 +0,0 @@
|
||||||
var current_diff;
|
|
||||||
|
|
||||||
// Extract query parameters
|
|
||||||
var params = function(query) {
|
|
||||||
var search = /([^&=]+)=?([^&]*)/g,
|
|
||||||
pl = /\+/g,
|
|
||||||
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
|
|
||||||
ret = {};
|
|
||||||
|
|
||||||
while (match = search.exec(query))
|
|
||||||
{
|
|
||||||
ret[decode(match[1])] = decode(match[2]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}(document.location.search.substring(1));
|
|
||||||
|
|
||||||
var default_settings = {
|
|
||||||
wrap: true,
|
|
||||||
tab_width: 4,
|
|
||||||
debug: false,
|
|
||||||
staged: false,
|
|
||||||
unstaged: false,
|
|
||||||
show_parents: false,
|
|
||||||
use_gravatar: true,
|
|
||||||
default_collapse_all: true,
|
|
||||||
strings: {
|
|
||||||
stage: 'stage',
|
|
||||||
unstage: 'unstage',
|
|
||||||
loading_diff: 'Loading diff...',
|
|
||||||
notes: 'Notes:',
|
|
||||||
parents: 'Parents:',
|
|
||||||
diff_against: 'Diff against:',
|
|
||||||
committed_by: 'Committed by:',
|
|
||||||
expand_all: 'Expand all',
|
|
||||||
collapse_all: 'Collapse all'
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var avatar_cache = {};
|
|
||||||
var settings;
|
|
||||||
|
|
||||||
if ('settings' in params)
|
|
||||||
{
|
|
||||||
settings = $.extend(true, {}, default_settings, JSON.parse(params.settings));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
settings = default_settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
var escapeDiv = document.createElement('div');
|
|
||||||
var escapeElement = document.createTextNode('');
|
|
||||||
escapeDiv.appendChild(escapeElement);
|
|
||||||
|
|
||||||
function html_escape(str)
|
|
||||||
{
|
|
||||||
escapeElement.data = str;
|
|
||||||
return escapeDiv.innerHTML;
|
|
||||||
}
|
|
||||||
|
|
||||||
var commit_elements = null;
|
|
||||||
|
|
||||||
function get_commit_elements(content)
|
|
||||||
{
|
|
||||||
if (commit_elements != null)
|
|
||||||
{
|
|
||||||
return commit_elements;
|
|
||||||
}
|
|
||||||
|
|
||||||
var elems = content.find('[data-id]');
|
|
||||||
|
|
||||||
commit_elements = {};
|
|
||||||
|
|
||||||
for (var i = 0; i < elems.length; i++)
|
|
||||||
{
|
|
||||||
var elem = $(elems[i]);
|
|
||||||
var name = elem.attr('data-id');
|
|
||||||
|
|
||||||
commit_elements[name] = elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
return commit_elements;
|
|
||||||
}
|
|
||||||
|
|
||||||
var avatarLoader;
|
|
||||||
|
|
||||||
function write_avatar(avatar, commit)
|
|
||||||
{
|
|
||||||
var h = commit.author.email_md5;
|
|
||||||
var avc;
|
|
||||||
|
|
||||||
if (avatarLoader)
|
|
||||||
{
|
|
||||||
avatarLoader.cancelled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (h in avatar_cache && settings.use_gravatar)
|
|
||||||
{
|
|
||||||
avc = avatar_cache[h];
|
|
||||||
|
|
||||||
if (avc != null && avatar.attr('src') != avc)
|
|
||||||
{
|
|
||||||
avatar.attr('src', avc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var avc = 'gitg-diff:/icon/avatar-default-symbolic?size=60';
|
|
||||||
avatar.attr('src', avc);
|
|
||||||
|
|
||||||
if (settings.use_gravatar)
|
|
||||||
{
|
|
||||||
avatarLoader = {
|
|
||||||
image: $('<img/>'),
|
|
||||||
cancelled: false
|
|
||||||
};
|
|
||||||
|
|
||||||
var gravatar = 'http://www.gravatar.com/avatar/' + h + '?d=404&s=60';
|
|
||||||
|
|
||||||
avatarLoader.image.on('load', function () {
|
|
||||||
if (this.cancelled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
avatar_cache[h] = gravatar;
|
|
||||||
avatar.attr('src', gravatar);
|
|
||||||
|
|
||||||
avatarLoader = null;
|
|
||||||
}.bind(avatarLoader));
|
|
||||||
|
|
||||||
avatarLoader.image.on('error', function () {
|
|
||||||
if (this.cancelled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
avatar_cache[h] = avc;
|
|
||||||
avatarLoader = null;
|
|
||||||
}.bind(avatarLoader));
|
|
||||||
|
|
||||||
avatarLoader.image.attr('src', gravatar);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function open_url(target)
|
|
||||||
{
|
|
||||||
xhr_get('internal', {'action': 'open-url', 'url': target.getAttribute("href")});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function prettify_message(message)
|
|
||||||
{
|
|
||||||
var lines = message.split(/\n/);
|
|
||||||
var ret = '';
|
|
||||||
var isempty = false;
|
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++)
|
|
||||||
{
|
|
||||||
var l = lines[i];
|
|
||||||
l = l.trimRight();
|
|
||||||
|
|
||||||
if (isempty && l.length != 0)
|
|
||||||
{
|
|
||||||
ret += '\n\n';
|
|
||||||
}
|
|
||||||
else if (l.match(/^[^a-zA-Z_]/))
|
|
||||||
{
|
|
||||||
ret += '\n';
|
|
||||||
}
|
|
||||||
else if (l.length != 0 && ret.length != 0)
|
|
||||||
{
|
|
||||||
ret += ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
ret += l;
|
|
||||||
isempty = (l.length == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var escaped = html_escape(ret);
|
|
||||||
|
|
||||||
escaped = ret.replace(/(https?:[^\s]*[^.])/g, "<a href=\"$1\" onclick=\"javascript:return open_url(this);\">$1</a>");
|
|
||||||
|
|
||||||
return escaped;
|
|
||||||
}
|
|
||||||
|
|
||||||
function author_to_html(author, prefix)
|
|
||||||
{
|
|
||||||
var name = $('<span/>', {'class': 'author name'}).text(author.name);
|
|
||||||
var a = $('<a/>', {href: 'mailto:' + author.email}).text(author.email);
|
|
||||||
|
|
||||||
var ret = $('<span/>');
|
|
||||||
|
|
||||||
if (prefix)
|
|
||||||
{
|
|
||||||
ret.append($('<span/>').text(prefix + ' '));
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret.append(name).append(' <').append(a).append('>');
|
|
||||||
}
|
|
||||||
|
|
||||||
function write_commit(content, commit)
|
|
||||||
{
|
|
||||||
var elems = get_commit_elements(content);
|
|
||||||
|
|
||||||
// Author
|
|
||||||
elems.author.html(author_to_html(commit.author));
|
|
||||||
|
|
||||||
// Committer
|
|
||||||
if (commit.author.name !== commit.committer.name ||
|
|
||||||
commit.author.email !== commit.committer.email) {
|
|
||||||
var elem = author_to_html(commit.committer, settings.strings.committed_by);
|
|
||||||
elem.append($('<br>')).append($('<span class="date"/>').text(commit.committer.time));
|
|
||||||
|
|
||||||
elems['committed-by'].html(elem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elems['committed-by'].html(' <br> ');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Date
|
|
||||||
elems.date.text(commit.author.time);
|
|
||||||
|
|
||||||
// Message
|
|
||||||
elems.message.html(prettify_message(commit.message));
|
|
||||||
|
|
||||||
// Notes
|
|
||||||
if (commit.hasOwnProperty('note'))
|
|
||||||
{
|
|
||||||
elems.notes.text(settings.strings.notes);
|
|
||||||
elems.note_message.text(commit.note);
|
|
||||||
elems.notes_container.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elems.notes_container.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commit.parents.length > 1)
|
|
||||||
{
|
|
||||||
var span = $('<span/>').text(settings.strings.diff_against);
|
|
||||||
var chooser = $('<select/>');
|
|
||||||
|
|
||||||
for (var i = 0; i < commit.parents.length; i++)
|
|
||||||
{
|
|
||||||
var parent = commit.parents[i];
|
|
||||||
var elem = $('<option/>', {
|
|
||||||
value: parent.id
|
|
||||||
}).text(parent.id.slice(0, 6));
|
|
||||||
|
|
||||||
if (parent.id === settings.parent)
|
|
||||||
{
|
|
||||||
elem.attr('selected', 'selected');
|
|
||||||
}
|
|
||||||
|
|
||||||
chooser.append(elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
chooser.on('change', function() {
|
|
||||||
xhr_get('internal', {'action': 'select-parent', 'value': chooser.val()});
|
|
||||||
});
|
|
||||||
|
|
||||||
elems.parent_chooser.html([span, chooser]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elems.parent_chooser.html('');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (commit.parents.length > 1 && settings.show_parents)
|
|
||||||
{
|
|
||||||
var d = $('<div/>');
|
|
||||||
|
|
||||||
d.append($('<div/>', {'class': 'title'}).text(settings.strings.parents));
|
|
||||||
|
|
||||||
var ul = $('<ul/>');
|
|
||||||
|
|
||||||
for (var i = 0; i < commit.parents.length; i++)
|
|
||||||
{
|
|
||||||
var parent = commit.parents[i];
|
|
||||||
var li = $('<li/>');
|
|
||||||
|
|
||||||
var a = $('<a/>', {'href': '#'}).text(parent.id.slice(0, 6) + ': ' + parent.subject);
|
|
||||||
a.on('click', (function(id, e) {
|
|
||||||
|
|
||||||
xhr_get('internal', {'action': 'load-parent', 'value': id});
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
}).bind(this, parent.id));
|
|
||||||
|
|
||||||
li.append(a);
|
|
||||||
ul.append(li);
|
|
||||||
}
|
|
||||||
|
|
||||||
d.append(ul);
|
|
||||||
|
|
||||||
elems.parents.html(d);
|
|
||||||
elems.parents.show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
elems.parents.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sha1
|
|
||||||
elems.sha1.text(commit.id);
|
|
||||||
|
|
||||||
write_avatar(elems.avatar, commit);
|
|
||||||
}
|
|
||||||
|
|
||||||
var html_builder_worker = 0;
|
|
||||||
var html_builder_tick = 0;
|
|
||||||
|
|
||||||
function expand_collapse()
|
|
||||||
{
|
|
||||||
var expander = $(this);
|
|
||||||
|
|
||||||
// If expanded, will be true
|
|
||||||
var toExpand = expander.text() == "\u25B6";
|
|
||||||
|
|
||||||
if (toExpand)
|
|
||||||
{
|
|
||||||
// next step to close it
|
|
||||||
// BLACK DOWN-POINTING TRIANGLE
|
|
||||||
expander.text("\u25BC");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// next step is to open it
|
|
||||||
// BLACK RIGHT-POINTING TRIANGLE
|
|
||||||
expander.text("\u25B6");
|
|
||||||
}
|
|
||||||
|
|
||||||
expander.closest('tbody').toggleClass("collapsed");
|
|
||||||
collapsed_changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
function collapsed_changed()
|
|
||||||
{
|
|
||||||
var all = $("#diff_content div.file tbody");
|
|
||||||
var prevCollapsed = false;
|
|
||||||
var allUncollapsed = true;
|
|
||||||
|
|
||||||
all.each(function(i, tbody) {
|
|
||||||
tbody = $(tbody);
|
|
||||||
|
|
||||||
var nextCollapsed = false;
|
|
||||||
|
|
||||||
var beforeCollapsed = true;
|
|
||||||
var afterCollapsed = false;
|
|
||||||
|
|
||||||
if (tbody.hasClass("collapsed"))
|
|
||||||
{
|
|
||||||
if (i < all.length - 1)
|
|
||||||
{
|
|
||||||
nextCollapsed = $(all[i + 1]).hasClass("collapsed");
|
|
||||||
}
|
|
||||||
|
|
||||||
afterCollapsed = prevCollapsed;
|
|
||||||
beforeCollapsed = nextCollapsed;
|
|
||||||
|
|
||||||
prevCollapsed = true;
|
|
||||||
allUncollapsed = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
prevCollapsed = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!beforeCollapsed)
|
|
||||||
{
|
|
||||||
tbody.addClass("before-uncollapsed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tbody.removeClass("before-uncollapsed");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!afterCollapsed)
|
|
||||||
{
|
|
||||||
tbody.addClass("after-uncollapsed");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tbody.removeClass("after-uncollapsed");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
var expanderAll = $("#diff .expander-all");
|
|
||||||
expanderAll.text(allUncollapsed ? settings.strings.collapse_all : settings.strings.expand_all)
|
|
||||||
}
|
|
||||||
|
|
||||||
function next_element(elem)
|
|
||||||
{
|
|
||||||
elem = elem.nextSibling;
|
|
||||||
|
|
||||||
while (elem != null && elem.nodeType != Node.ELEMENT_NODE)
|
|
||||||
{
|
|
||||||
elem = elem.nextSibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function has_class(e, cls)
|
|
||||||
{
|
|
||||||
return e.classList.contains(cls);
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_has_selection()
|
|
||||||
{
|
|
||||||
var selection = document.querySelectorAll('tr.added.selected, tr.removed.selected');
|
|
||||||
var hs = (selection.length != 0);
|
|
||||||
|
|
||||||
var v = hs ? "yes" : "no";
|
|
||||||
xhr_get('internal', {action: 'selection-changed', value: v});
|
|
||||||
}
|
|
||||||
|
|
||||||
function prepare_patchset(filediv)
|
|
||||||
{
|
|
||||||
var elem = filediv.querySelector('tr.file_header');
|
|
||||||
|
|
||||||
elem = next_element(elem);
|
|
||||||
|
|
||||||
var patches = [];
|
|
||||||
var doffset = 0;
|
|
||||||
|
|
||||||
var a = "a".charCodeAt(0);
|
|
||||||
var r = "r".charCodeAt(0);
|
|
||||||
|
|
||||||
var last = null;
|
|
||||||
|
|
||||||
while (elem != null)
|
|
||||||
{
|
|
||||||
var e = elem;
|
|
||||||
elem = next_element(elem);
|
|
||||||
|
|
||||||
var added = has_class(e, 'added');
|
|
||||||
var removed = has_class(e, 'removed');
|
|
||||||
|
|
||||||
if (!added && !removed)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var selected = has_class(e, 'selected');
|
|
||||||
var offset = parseInt(e.getAttribute('data-offset'));
|
|
||||||
var length = parseInt(e.getAttribute('data-length'));
|
|
||||||
|
|
||||||
if (selected)
|
|
||||||
{
|
|
||||||
var tp = added ? a : r;
|
|
||||||
|
|
||||||
if (last != null && last[0] == tp && last[2] + last[3] == offset)
|
|
||||||
{
|
|
||||||
// Contiguous block, just add the length
|
|
||||||
last[3] += length;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var o = {old: offset, new: offset};
|
|
||||||
|
|
||||||
if (added)
|
|
||||||
{
|
|
||||||
o.old -= doffset;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
o.new += doffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
// [sign, old_offset, new_offset, length]
|
|
||||||
last = [tp, o.old, o.new, length];
|
|
||||||
patches.push(last);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keep track of the total offset difference between old and new
|
|
||||||
doffset += added ? length : -length;
|
|
||||||
}
|
|
||||||
|
|
||||||
var filename = filediv.getAttribute('data-filename');
|
|
||||||
return [filename, patches];
|
|
||||||
}
|
|
||||||
|
|
||||||
function get_selection()
|
|
||||||
{
|
|
||||||
var files = document.querySelectorAll('#diff_content div.file');
|
|
||||||
var ret = [];
|
|
||||||
|
|
||||||
for (var i = 0; i < files.length; i++)
|
|
||||||
{
|
|
||||||
if (!has_class(files[i], 'background'))
|
|
||||||
{
|
|
||||||
ret.push(prepare_patchset(files[i]));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
function stage_unstage_hunk()
|
|
||||||
{
|
|
||||||
var elem = next_element(this);
|
|
||||||
|
|
||||||
var hasunsel = false;
|
|
||||||
var lines = [];
|
|
||||||
|
|
||||||
while (elem != null && !(has_class(elem, 'file_header') || has_class(elem, 'hunk_header')))
|
|
||||||
{
|
|
||||||
if ((has_class(elem, 'added') || has_class(elem, 'removed')))
|
|
||||||
{
|
|
||||||
lines.push(elem);
|
|
||||||
|
|
||||||
if (!has_class(elem, 'selected'))
|
|
||||||
{
|
|
||||||
hasunsel = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
elem = next_element(elem);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < lines.length; i++)
|
|
||||||
{
|
|
||||||
if (hasunsel)
|
|
||||||
{
|
|
||||||
lines[i].classList.add('selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lines[i].classList.remove('selected');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update_has_selection();
|
|
||||||
}
|
|
||||||
|
|
||||||
function stage_unstage_line()
|
|
||||||
{
|
|
||||||
if (has_class(this, 'selected'))
|
|
||||||
{
|
|
||||||
this.classList.remove('selected');
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.classList.add('selected');
|
|
||||||
}
|
|
||||||
|
|
||||||
update_has_selection();
|
|
||||||
}
|
|
||||||
|
|
||||||
function xhr_get(action, data, onload)
|
|
||||||
{
|
|
||||||
var r = new XMLHttpRequest();
|
|
||||||
|
|
||||||
if (onload)
|
|
||||||
{
|
|
||||||
r.onload = function(e) { onload(r.responseText); }
|
|
||||||
}
|
|
||||||
|
|
||||||
t = (new Date()).getTime();
|
|
||||||
d = '?_t=' + t + '&viewid=' + params.viewid + "&diffid=" + current_diff;
|
|
||||||
|
|
||||||
for (var k in data)
|
|
||||||
{
|
|
||||||
d += '&' + encodeURIComponent(k) + '=' + encodeURIComponent(data[k]);
|
|
||||||
}
|
|
||||||
|
|
||||||
r.open("GET", "gitg-diff:/" + action + "/" + d);
|
|
||||||
r.send();
|
|
||||||
}
|
|
||||||
|
|
||||||
var tab_width_rule = null;
|
|
||||||
|
|
||||||
function update_tab_width(width)
|
|
||||||
{
|
|
||||||
settings.tab_width = width;
|
|
||||||
|
|
||||||
if (tab_width_rule == null)
|
|
||||||
{
|
|
||||||
var sheet = document.getElementById('dynamic_styles').sheet;
|
|
||||||
sheet.addRule('div#diff div.file table td.code', 'tab-size: ' + width, 0);
|
|
||||||
tab_width_rule = sheet.rules[sheet.rules.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
tab_width_rule.style.tabSize = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
var wrap_rule = null;
|
|
||||||
|
|
||||||
function update_wrap(wrap)
|
|
||||||
{
|
|
||||||
settings.wrap = wrap;
|
|
||||||
|
|
||||||
if (wrap_rule == null)
|
|
||||||
{
|
|
||||||
var sheet = document.getElementById('dynamic_styles').sheet;
|
|
||||||
sheet.addRule('div#diff div.file table td.code', 'white-space: ' + (wrap ? 'pre-wrap' : 'pre'), 0);
|
|
||||||
wrap_rule = sheet.rules[sheet.rules.length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
wrap_rule.style.whiteSpace = wrap ? 'pre-wrap' : 'pre';
|
|
||||||
}
|
|
||||||
|
|
||||||
function expand_collapse_all()
|
|
||||||
{
|
|
||||||
var collapse = ($(this).text() === settings.strings.collapse_all);
|
|
||||||
|
|
||||||
var allbodies = document.querySelectorAll("#diff_content div.file:not(.background) table.file tbody");
|
|
||||||
|
|
||||||
for (var i = 0; i < allbodies.length; i++)
|
|
||||||
{
|
|
||||||
var tbody = $(allbodies[i]);
|
|
||||||
var isCollapsed = tbody.hasClass("collapsed");
|
|
||||||
|
|
||||||
if (isCollapsed !== collapse)
|
|
||||||
{
|
|
||||||
expand_collapse.call(tbody.find(".expander"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$(this).text(collapse ? settings.strings.expand_all : settings.strings.collapse_all);
|
|
||||||
}
|
|
||||||
|
|
||||||
function default_collapse_all()
|
|
||||||
{
|
|
||||||
var expanders = document.querySelectorAll("#diff_content div.file:not(.background) .expander");
|
|
||||||
|
|
||||||
// Collapse by default if more than one file
|
|
||||||
if (expanders && expanders.length > 1)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < expanders.length; i++)
|
|
||||||
{
|
|
||||||
expand_collapse.call(expanders[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_diff(id, lsettings)
|
|
||||||
{
|
|
||||||
if (html_builder_worker)
|
|
||||||
{
|
|
||||||
html_builder_worker.terminate();
|
|
||||||
}
|
|
||||||
|
|
||||||
var content = $('#diff_content');
|
|
||||||
|
|
||||||
if (typeof id == 'undefined')
|
|
||||||
{
|
|
||||||
content.empty();
|
|
||||||
update_has_selection();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
current_diff = id;
|
|
||||||
|
|
||||||
if (typeof lsettings != 'undefined')
|
|
||||||
{
|
|
||||||
settings = $.extend(true, {}, default_settings, lsettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
workeruri = 'diff-view-html-builder.js';
|
|
||||||
|
|
||||||
if (settings.debug)
|
|
||||||
{
|
|
||||||
var t = (new Date()).getTime();
|
|
||||||
workeruri += '?t' + t;
|
|
||||||
}
|
|
||||||
|
|
||||||
update_tab_width(settings.tab_width);
|
|
||||||
update_wrap(settings.wrap);
|
|
||||||
|
|
||||||
html_builder_worker = new Worker(workeruri);
|
|
||||||
html_builder_tick = 0;
|
|
||||||
|
|
||||||
html_builder_progress_timeout = setTimeout(function (){
|
|
||||||
var eta = 200 / html_builder_tick - 200;
|
|
||||||
|
|
||||||
if (eta > 1000)
|
|
||||||
{
|
|
||||||
// Show the progress
|
|
||||||
content.html(' \
|
|
||||||
<div class="loading"> \
|
|
||||||
' + settings.strings.loading_diff + ' \
|
|
||||||
</div> \
|
|
||||||
');
|
|
||||||
|
|
||||||
update_has_selection();
|
|
||||||
}
|
|
||||||
|
|
||||||
html_builder_progress_timeout = 0;
|
|
||||||
}, 200);
|
|
||||||
|
|
||||||
html_builder_worker.onmessage = function (event) {
|
|
||||||
if (event.data.log)
|
|
||||||
{
|
|
||||||
console.log(event.data.log);
|
|
||||||
}
|
|
||||||
else if (event.data.tick)
|
|
||||||
{
|
|
||||||
html_builder_tick = event.data.tick;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
html_builder_worker.terminate();
|
|
||||||
html_builder_worker = 0;
|
|
||||||
|
|
||||||
if (html_builder_progress_timeout)
|
|
||||||
{
|
|
||||||
clearTimeout(html_builder_progress_timeout);
|
|
||||||
html_builder_progress_timeout = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
content.html(event.data.diff_html);
|
|
||||||
update_has_selection();
|
|
||||||
|
|
||||||
if (settings.default_collapse_all)
|
|
||||||
{
|
|
||||||
default_collapse_all();
|
|
||||||
}
|
|
||||||
|
|
||||||
collapsed_changed();
|
|
||||||
|
|
||||||
$("#diff_content div.file tr.file_header td").click(function() {
|
|
||||||
expand_collapse.call($(this).find(".expander"));
|
|
||||||
});
|
|
||||||
|
|
||||||
if (settings.staged || settings.unstaged)
|
|
||||||
{
|
|
||||||
$("tr.hunk_header").click(stage_unstage_hunk);
|
|
||||||
$("tr.added, tr.removed").click(stage_unstage_line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var t = (new Date()).getTime();
|
|
||||||
|
|
||||||
var file_template = $('#templates div.file')[0].outerHTML;
|
|
||||||
|
|
||||||
// Load the diff asynchronously
|
|
||||||
html_builder_worker.postMessage({
|
|
||||||
url: "gitg-diff:/diff/?t=" + t + "&viewid=" + params.viewid + "&diffid=" + id + "&format=diff_only",
|
|
||||||
settings: settings,
|
|
||||||
file_template: file_template,
|
|
||||||
});
|
|
||||||
|
|
||||||
xhr_get("diff", {format: "commit_only"}, function(r) {
|
|
||||||
if (!r)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var j = JSON.parse(r);
|
|
||||||
|
|
||||||
if ('commit' in j)
|
|
||||||
{
|
|
||||||
write_commit($('#diff_header .commit'), j.commit);
|
|
||||||
$('#diff_header').show();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$('#diff_header').hide();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addEventListener('DOMContentLoaded', function () {
|
|
||||||
var expanderAll = $("#diff .expander-all");
|
|
||||||
expanderAll.click(expand_collapse_all);
|
|
||||||
|
|
||||||
xhr_get('internal', {action: 'loaded'});
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
// vi:ts=4
|
|
File diff suppressed because one or more lines are too long
208
libgitg/resources/ui/gitg-diff-view-commit-details.ui
Normal file
208
libgitg/resources/ui/gitg-diff-view-commit-details.ui
Normal file
|
@ -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 &lt;<a href="email@example.com">email@example.com</a>&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 &lt;<a href="email@example.com">email@example.com</a>&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>
|
55
libgitg/resources/ui/gitg-diff-view-file.ui
Normal file
55
libgitg/resources/ui/gitg-diff-view-file.ui
Normal file
|
@ -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>
|
59
libgitg/resources/ui/gitg-diff-view-hunk.ui
Normal file
59
libgitg/resources/ui/gitg-diff-view-hunk.ui
Normal file
|
@ -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>
|
|
@ -106,31 +106,6 @@
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</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>
|
<child>
|
||||||
<object class="GtkLabel" id="label_context1">
|
<object class="GtkLabel" id="label_context1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
38
libgitg/resources/ui/gitg-diff-view.ui
Normal file
38
libgitg/resources/ui/gitg-diff-view.ui
Normal file
|
@ -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>
|
76
libgitg/resources/ui/libgitg-style.css
Normal file
76
libgitg/resources/ui/libgitg-style.css
Normal file
|
@ -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;
|
||||||
|
}
|
|
@ -87,22 +87,6 @@ namespace GitgDiff
|
||||||
|
|
||||||
history.selection_changed.connect(on_selection_changed);
|
history.selection_changed.connect(on_selection_changed);
|
||||||
on_selection_changed(history);
|
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
|
public string id
|
||||||
|
|
|
@ -29,7 +29,7 @@ namespace GitgFiles
|
||||||
|
|
||||||
private TreeStore d_model;
|
private TreeStore d_model;
|
||||||
private Gtk.Paned d_paned;
|
private Gtk.Paned d_paned;
|
||||||
private GtkSource.View d_source;
|
private Gtk.SourceView d_source;
|
||||||
private Settings? d_fontsettings;
|
private Settings? d_fontsettings;
|
||||||
private Settings? d_stylesettings;
|
private Settings? d_stylesettings;
|
||||||
|
|
||||||
|
@ -93,12 +93,12 @@ namespace GitgFiles
|
||||||
private void update_style()
|
private void update_style()
|
||||||
{
|
{
|
||||||
var scheme = d_stylesettings.get_string("scheme");
|
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);
|
var s = manager.get_scheme(scheme);
|
||||||
|
|
||||||
if (s != null)
|
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);
|
buf.set_style_scheme(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ namespace GitgFiles
|
||||||
tv.get_selection().changed.connect(selection_changed);
|
tv.get_selection().changed.connect(selection_changed);
|
||||||
|
|
||||||
d_scrolled_files = ret["scrolled_window_files"] as Gtk.ScrolledWindow;
|
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_paned = ret["paned_files"] as Gtk.Paned;
|
||||||
d_scrolled = ret["scrolled_window_file"] as Gtk.ScrolledWindow;
|
d_scrolled = ret["scrolled_window_file"] as Gtk.ScrolledWindow;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ namespace GitgFiles
|
||||||
Gtk.TreeModel mod;
|
Gtk.TreeModel mod;
|
||||||
Gtk.TreeIter iter;
|
Gtk.TreeIter iter;
|
||||||
|
|
||||||
var buf = d_source.get_buffer() as GtkSource.Buffer;
|
var buf = d_source.get_buffer() as Gtk.SourceBuffer;
|
||||||
buf.set_text("");
|
buf.set_text("");
|
||||||
|
|
||||||
if (!selection.get_selected(out mod, out iter) || d_model.get_isdir(iter))
|
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"))
|
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.set_text((string)content);
|
||||||
buf.language = manager.guess_language(fname, ct);
|
buf.language = manager.guess_language(fname, ct);
|
||||||
|
|
|
@ -107,41 +107,23 @@ class TestDiffView
|
||||||
|
|
||||||
var wnd = new Gtk.Window();
|
var wnd = new Gtk.Window();
|
||||||
wnd.set_default_size(800, 600);
|
wnd.set_default_size(800, 600);
|
||||||
|
|
||||||
var sw = new Gtk.ScrolledWindow(null, null);
|
var sw = new Gtk.ScrolledWindow(null, null);
|
||||||
|
sw.show();
|
||||||
|
|
||||||
var v = new Gitg.DiffView();
|
var v = new Gitg.DiffView();
|
||||||
|
v.show();
|
||||||
sw.add(v);
|
sw.add(v);
|
||||||
|
|
||||||
v.commit = commit;
|
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) => {
|
wnd.delete_event.connect((w, ev) => {
|
||||||
Gtk.main_quit();
|
Gtk.main_quit();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
wnd.add(sw);
|
wnd.add(sw);
|
||||||
wnd.show_all();
|
wnd.show();
|
||||||
|
|
||||||
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");
|
|
||||||
|
|
||||||
Gtk.main();
|
Gtk.main();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -17,7 +17,6 @@ tests_gitg_test_gitg_VALAFLAGS = \
|
||||||
--pkg gtk+-3.0 \
|
--pkg gtk+-3.0 \
|
||||||
--pkg gee-0.8 \
|
--pkg gee-0.8 \
|
||||||
--pkg libsoup-2.4 \
|
--pkg libsoup-2.4 \
|
||||||
--pkg $(WEBKIT_PKGCONFIG) \
|
|
||||||
--pkg config \
|
--pkg config \
|
||||||
$(GITG_VALAFLAGS) \
|
$(GITG_VALAFLAGS) \
|
||||||
--vapidir $(top_srcdir)/tests/support \
|
--vapidir $(top_srcdir)/tests/support \
|
||||||
|
|
|
@ -17,7 +17,6 @@ tests_libgitg_test_libgitg_VALAFLAGS = \
|
||||||
--pkg gtk+-3.0 \
|
--pkg gtk+-3.0 \
|
||||||
--pkg gee-0.8 \
|
--pkg gee-0.8 \
|
||||||
--pkg libsoup-2.4 \
|
--pkg libsoup-2.4 \
|
||||||
--pkg $(WEBKIT_PKGCONFIG) \
|
|
||||||
--pkg config \
|
--pkg config \
|
||||||
$(GITG_VALAFLAGS) \
|
$(GITG_VALAFLAGS) \
|
||||||
--vapidir $(top_srcdir)/tests/support \
|
--vapidir $(top_srcdir)/tests/support \
|
||||||
|
|
|
@ -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_")]
|
[CCode (cprefix = "Gtk", gir_namespace = "GtkSource", gir_version = "3.0", lower_case_cprefix = "gtk_")]
|
||||||
namespace GtkSource {
|
namespace Gtk {
|
||||||
namespace CompletionCapability {
|
namespace SourceUtils {
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", cname = "GTK_SOURCE_COMPLETION_CAPABILITY_AUTOMATIC")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h")]
|
||||||
public const string AUTOMATIC;
|
public static string escape_search_text (string text);
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", cname = "GTK_SOURCE_COMPLETION_CAPABILITY_INTERACTIVE")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h")]
|
||||||
public const string INTERACTIVE;
|
public static string unescape_search_text (string text);
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_buffer_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_buffer_get_type ()")]
|
||||||
[GIR (name = "Buffer")]
|
[GIR (name = "Buffer")]
|
||||||
public class Buffer : Gtk.TextBuffer {
|
public class SourceBuffer : Gtk.TextBuffer {
|
||||||
[CCode (has_construct_function = false)]
|
[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 bool backward_iter_to_source_mark (Gtk.TextIter iter, string? category);
|
||||||
public void begin_not_undoable_action ();
|
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 end_not_undoable_action ();
|
||||||
public void ensure_highlight (Gtk.TextIter start, Gtk.TextIter end);
|
public void ensure_highlight (Gtk.TextIter start, Gtk.TextIter end);
|
||||||
public bool forward_iter_to_source_mark (Gtk.TextIter iter, string? category);
|
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 string[] get_context_classes_at_iter (Gtk.TextIter iter);
|
||||||
public bool get_highlight_matching_brackets ();
|
public bool get_highlight_matching_brackets ();
|
||||||
public bool get_highlight_syntax ();
|
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 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 Gtk.SourceMark> 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 GLib.SList<weak Gtk.SourceMark> get_source_marks_at_line (int line, string? category);
|
||||||
public unowned GtkSource.StyleScheme get_style_scheme ();
|
public unowned Gtk.SourceStyleScheme get_style_scheme ();
|
||||||
public unowned GtkSource.UndoManager get_undo_manager ();
|
public unowned Gtk.SourceUndoManager? get_undo_manager ();
|
||||||
public bool iter_backward_to_context_class_toggle (Gtk.TextIter iter, string context_class);
|
public bool iter_backward_to_context_class_toggle (ref Gtk.TextIter iter, string context_class);
|
||||||
public bool iter_forward_to_context_class_toggle (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 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 remove_source_marks (Gtk.TextIter start, Gtk.TextIter end, string? category);
|
||||||
public void set_highlight_matching_brackets (bool highlight);
|
public void set_highlight_matching_brackets (bool highlight);
|
||||||
public void set_highlight_syntax (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_max_undo_levels (int max_undo_levels);
|
||||||
public void set_style_scheme (GtkSource.StyleScheme? scheme);
|
public void set_style_scheme (Gtk.SourceStyleScheme? scheme);
|
||||||
public void set_undo_manager (GtkSource.UndoManager? manager);
|
public void set_undo_manager (Gtk.SourceUndoManager? manager);
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
public Buffer.with_language (GtkSource.Language language);
|
public SourceBuffer.with_language (Gtk.SourceLanguage language);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public bool can_redo { get; }
|
public bool can_redo { get; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public bool can_undo { get; }
|
public bool can_undo { get; }
|
||||||
public bool highlight_matching_brackets { get; set; }
|
public bool highlight_matching_brackets { get; set; }
|
||||||
public bool highlight_syntax { 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 int max_undo_levels { get; set; }
|
||||||
public GtkSource.StyleScheme style_scheme { get; set; }
|
public Gtk.SourceStyleScheme style_scheme { get; set; }
|
||||||
public GtkSource.UndoManager undo_manager { get; set construct; }
|
public Gtk.SourceUndoManager undo_manager { get; set construct; }
|
||||||
public virtual signal void bracket_matched (Gtk.TextIter iter, GtkSource.BracketMatchType state);
|
public virtual signal void bracket_matched (Gtk.TextIter iter, Gtk.SourceBracketMatchType state);
|
||||||
public signal void highlight_updated (Gtk.TextIter object, Gtk.TextIter p0);
|
public signal void highlight_updated (Gtk.TextIter start, Gtk.TextIter end);
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
public virtual signal void redo ();
|
public virtual signal void redo ();
|
||||||
public signal void source_mark_updated (Gtk.TextMark object);
|
public signal void source_mark_updated (Gtk.TextMark mark);
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
public virtual signal void undo ();
|
public virtual signal void undo ();
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_get_type ()")]
|
||||||
[GIR (name = "Completion")]
|
[GIR (name = "Completion")]
|
||||||
public class Completion : GLib.Object {
|
public class SourceCompletion : GLib.Object, Gtk.Buildable {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected Completion ();
|
protected SourceCompletion ();
|
||||||
public bool add_provider (GtkSource.CompletionProvider provider) throws GLib.Error;
|
public bool add_provider (Gtk.SourceCompletionProvider provider) throws GLib.Error;
|
||||||
public void block_interactive ();
|
public void block_interactive ();
|
||||||
public GtkSource.CompletionContext create_context (Gtk.TextIter? position);
|
public unowned Gtk.SourceCompletionContext create_context (Gtk.TextIter? position);
|
||||||
public unowned GtkSource.CompletionInfo get_info_window ();
|
public unowned Gtk.SourceCompletionInfo get_info_window ();
|
||||||
public unowned GLib.List<GtkSource.CompletionProvider> get_providers ();
|
public unowned GLib.List<Gtk.SourceCompletionProvider> get_providers ();
|
||||||
public unowned GtkSource.View get_view ();
|
public unowned Gtk.SourceView get_view ();
|
||||||
|
[Deprecated (since = "3.8")]
|
||||||
public void move_window (Gtk.TextIter iter);
|
public void move_window (Gtk.TextIter iter);
|
||||||
[NoWrapper]
|
[NoWrapper]
|
||||||
public virtual bool proposal_activated (GtkSource.CompletionProvider provider, GtkSource.CompletionProposal proposal);
|
public virtual bool proposal_activated (Gtk.SourceCompletionProvider provider, Gtk.SourceCompletionProposal proposal);
|
||||||
public bool remove_provider (GtkSource.CompletionProvider provider) throws GLib.Error;
|
public bool remove_provider (Gtk.SourceCompletionProvider provider) throws GLib.Error;
|
||||||
[CCode (cname = "gtk_source_completion_show")]
|
[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 ();
|
public void unblock_interactive ();
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public uint accelerators { get; set construct; }
|
public uint accelerators { get; set construct; }
|
||||||
|
@ -93,50 +99,54 @@ namespace GtkSource {
|
||||||
public bool show_headers { get; set construct; }
|
public bool show_headers { get; set construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public bool show_icons { get; set construct; }
|
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 ();
|
public virtual signal void activate_proposal ();
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
public virtual signal void hide ();
|
public virtual signal void hide ();
|
||||||
public virtual signal void move_cursor (Gtk.ScrollStep step, int num);
|
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 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 ();
|
public virtual signal void show ();
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_context_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_context_get_type ()")]
|
||||||
[GIR (name = "CompletionContext")]
|
[GIR (name = "CompletionContext")]
|
||||||
public class CompletionContext : GLib.InitiallyUnowned {
|
public class SourceCompletionContext : GLib.InitiallyUnowned {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected CompletionContext ();
|
protected SourceCompletionContext ();
|
||||||
public void add_proposals (GtkSource.CompletionProvider provider, GLib.List<GtkSource.CompletionProposal> proposals, bool finished);
|
public void add_proposals (Gtk.SourceCompletionProvider provider, GLib.List<Gtk.SourceCompletionProposal>? proposals, bool finished);
|
||||||
public GtkSource.CompletionActivation get_activation ();
|
public Gtk.SourceCompletionActivation get_activation ();
|
||||||
public Gtk.TextIter get_iter ();
|
public bool get_iter (out Gtk.TextIter iter);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public GtkSource.CompletionActivation activation { get; set; }
|
public Gtk.SourceCompletionActivation activation { get; set construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public GtkSource.Completion completion { owned get; construct; }
|
public Gtk.SourceCompletion completion { owned get; construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public Gtk.TextIter iter { get; set; }
|
public Gtk.TextIter iter { get; set; }
|
||||||
public virtual signal void cancelled ();
|
public virtual signal void cancelled ();
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_info_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_info_get_type ()")]
|
||||||
[GIR (name = "CompletionInfo")]
|
[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)]
|
[CCode (has_construct_function = false)]
|
||||||
public CompletionInfo ();
|
public SourceCompletionInfo ();
|
||||||
|
[Deprecated (since = "3.8")]
|
||||||
public unowned Gtk.Widget get_widget ();
|
public unowned Gtk.Widget get_widget ();
|
||||||
public void move_to_iter (Gtk.TextView view, Gtk.TextIter? iter);
|
public void move_to_iter (Gtk.TextView view, Gtk.TextIter? iter);
|
||||||
|
[Deprecated (since = "3.8")]
|
||||||
public void set_widget (Gtk.Widget? widget);
|
public void set_widget (Gtk.Widget? widget);
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public virtual signal void before_show ();
|
public virtual signal void before_show ();
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_item_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_item_get_type ()")]
|
||||||
[GIR (name = "CompletionItem")]
|
[GIR (name = "CompletionItem")]
|
||||||
public class CompletionItem : GLib.Object, GtkSource.CompletionProposal {
|
public class SourceCompletionItem : GLib.Object, Gtk.SourceCompletionProposal {
|
||||||
[CCode (has_construct_function = false)]
|
[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)]
|
[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)]
|
[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]
|
[NoAccessorMethod]
|
||||||
public Gdk.Pixbuf icon { owned get; set; }
|
public Gdk.Pixbuf icon { owned get; set; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
@ -150,12 +160,14 @@ namespace GtkSource {
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_words_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_words_get_type ()")]
|
||||||
[GIR (name = "CompletionWords")]
|
[GIR (name = "CompletionWords")]
|
||||||
public class CompletionWords : GLib.Object, GtkSource.CompletionProvider {
|
public class SourceCompletionWords : GLib.Object, Gtk.SourceCompletionProvider {
|
||||||
[CCode (has_construct_function = false)]
|
[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 register (Gtk.TextBuffer buffer);
|
||||||
public void unregister (Gtk.TextBuffer buffer);
|
public void unregister (Gtk.TextBuffer buffer);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
public Gtk.SourceCompletionActivation activation { get; set construct; }
|
||||||
|
[NoAccessorMethod]
|
||||||
public Gdk.Pixbuf icon { owned get; set construct; }
|
public Gdk.Pixbuf icon { owned get; set construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public int interactive_delay { get; set construct; }
|
public int interactive_delay { get; set construct; }
|
||||||
|
@ -170,42 +182,128 @@ namespace GtkSource {
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public uint scan_batch_size { get; set construct; }
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_get_type ()")]
|
||||||
[GIR (name = "Gutter")]
|
[GIR (name = "Gutter")]
|
||||||
public class Gutter : GLib.Object {
|
public class SourceGutter : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected Gutter ();
|
protected SourceGutter ();
|
||||||
|
[Deprecated (since = "3.12")]
|
||||||
public void get_padding (int xpad, int ypad);
|
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 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 queue_draw ();
|
||||||
public void remove (GtkSource.GutterRenderer renderer);
|
public void remove (Gtk.SourceGutterRenderer renderer);
|
||||||
public void reorder (GtkSource.GutterRenderer renderer, int position);
|
public void reorder (Gtk.SourceGutterRenderer renderer, int position);
|
||||||
|
[Deprecated (since = "3.12")]
|
||||||
public void set_padding (int xpad, int ypad);
|
public void set_padding (int xpad, int ypad);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public GtkSource.View view { owned get; construct; }
|
public Gtk.SourceView view { owned get; construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public Gtk.TextWindowType window_type { get; construct; }
|
public Gtk.TextWindowType window_type { get; construct; }
|
||||||
|
[Deprecated (since = "3.12")]
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public int xpad { get; set construct; }
|
public int xpad { get; set construct; }
|
||||||
|
[Deprecated (since = "3.12")]
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public int ypad { get; set construct; }
|
public int ypad { get; set construct; }
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_get_type ()")]
|
||||||
[GIR (name = "GutterRenderer")]
|
[GIR (name = "GutterRenderer")]
|
||||||
public abstract class GutterRenderer : GLib.InitiallyUnowned {
|
public abstract class SourceGutterRenderer : GLib.InitiallyUnowned {
|
||||||
[CCode (has_construct_function = false)]
|
[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);
|
public virtual void begin (Cairo.Context cr, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.TextIter start, Gtk.TextIter end);
|
||||||
[NoWrapper]
|
[NoWrapper]
|
||||||
public virtual void change_buffer (Gtk.TextBuffer old_buffer);
|
public virtual void change_buffer (Gtk.TextBuffer? old_buffer);
|
||||||
[NoWrapper]
|
[NoWrapper]
|
||||||
public virtual void change_view (Gtk.TextView old_view);
|
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 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 virtual void end ();
|
||||||
public void get_alignment (out float xalign, out float yalign);
|
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 bool get_background (out Gdk.RGBA color);
|
||||||
public void get_padding (out int xpad, out int ypad);
|
public void get_padding (out int xpad, out int ypad);
|
||||||
public int get_size ();
|
public int get_size ();
|
||||||
|
@ -213,12 +311,12 @@ namespace GtkSource {
|
||||||
public bool get_visible ();
|
public bool get_visible ();
|
||||||
public Gtk.TextWindowType get_window_type ();
|
public Gtk.TextWindowType get_window_type ();
|
||||||
public void set_alignment (float xalign, float yalign);
|
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_background (Gdk.RGBA? color);
|
||||||
public void set_padding (int xpad, int ypad);
|
public void set_padding (int xpad, int ypad);
|
||||||
public void set_size (int size);
|
public void set_size (int size);
|
||||||
public void set_visible (bool visible);
|
public void set_visible (bool visible);
|
||||||
public GtkSource.GutterRendererAlignmentMode alignment_mode { get; set construct; }
|
public Gtk.SourceGutterRendererAlignmentMode alignment_mode { get; set construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public Gdk.RGBA background_rgba { get; set; }
|
public Gdk.RGBA background_rgba { get; set; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
@ -240,7 +338,7 @@ namespace GtkSource {
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
public virtual signal bool query_activatable (Gtk.TextIter iter, Cairo.RectangleInt area, Gdk.Event event);
|
public virtual signal bool query_activatable (Gtk.TextIter iter, Cairo.RectangleInt area, Gdk.Event event);
|
||||||
[HasEmitter]
|
[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]
|
[HasEmitter]
|
||||||
public virtual signal bool query_tooltip (Gtk.TextIter iter, Cairo.RectangleInt area, int x, int y, Gtk.Tooltip tooltip);
|
public virtual signal bool query_tooltip (Gtk.TextIter iter, Cairo.RectangleInt area, int x, int y, Gtk.Tooltip tooltip);
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
|
@ -248,29 +346,32 @@ namespace GtkSource {
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_pixbuf_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_pixbuf_get_type ()")]
|
||||||
[GIR (name = "GutterRendererPixbuf")]
|
[GIR (name = "GutterRendererPixbuf")]
|
||||||
public class GutterRendererPixbuf : GtkSource.GutterRenderer {
|
public class SourceGutterRendererPixbuf : Gtk.SourceGutterRenderer {
|
||||||
[CCode (has_construct_function = false, type = "GtkGutterRenderer*")]
|
[CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
|
||||||
public GutterRendererPixbuf ();
|
public SourceGutterRendererPixbuf ();
|
||||||
public unowned GLib.Icon get_gicon ();
|
public unowned GLib.Icon get_gicon ();
|
||||||
public unowned string get_icon_name ();
|
public unowned string get_icon_name ();
|
||||||
public unowned Gdk.Pixbuf get_pixbuf ();
|
public unowned Gdk.Pixbuf get_pixbuf ();
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public unowned string get_stock_id ();
|
public unowned string get_stock_id ();
|
||||||
public void set_gicon (GLib.Icon icon);
|
public void set_gicon (GLib.Icon? icon);
|
||||||
public void set_icon_name (string icon_name);
|
public void set_icon_name (string? icon_name);
|
||||||
public void set_pixbuf (Gdk.Pixbuf pixbuf);
|
public void set_pixbuf (Gdk.Pixbuf? pixbuf);
|
||||||
public void set_stock_id (string stock_id);
|
[Deprecated (since = "3.10")]
|
||||||
|
public void set_stock_id (string? stock_id);
|
||||||
public GLib.Icon gicon { get; set; }
|
public GLib.Icon gicon { get; set; }
|
||||||
public string icon_name { get; set; }
|
public string icon_name { get; set; }
|
||||||
public Gdk.Pixbuf pixbuf { get; set; }
|
public Gdk.Pixbuf pixbuf { get; set; }
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public string stock_id { get; set; }
|
public string stock_id { get; set; }
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_text_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_gutter_renderer_text_get_type ()")]
|
||||||
[GIR (name = "GutterRendererText")]
|
[GIR (name = "GutterRendererText")]
|
||||||
public class GutterRendererText : GtkSource.GutterRenderer {
|
public class SourceGutterRendererText : Gtk.SourceGutterRenderer {
|
||||||
[CCode (has_construct_function = false, type = "GtkGutterRenderer*")]
|
[CCode (has_construct_function = false, type = "GtkSourceGutterRenderer*")]
|
||||||
public GutterRendererText ();
|
public SourceGutterRendererText ();
|
||||||
public void measure (string text, int width, int height);
|
public void measure (string text, out int width, out int height);
|
||||||
public void measure_markup (string markup, int width, 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_markup (string markup, int length);
|
||||||
public void set_text (string text, int length);
|
public void set_text (string text, int length);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
@ -280,9 +381,9 @@ namespace GtkSource {
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_get_type ()")]
|
||||||
[GIR (name = "Language")]
|
[GIR (name = "Language")]
|
||||||
public class Language : GLib.Object {
|
public class SourceLanguage : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected Language ();
|
protected SourceLanguage ();
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[CCode (array_length = false, array_null_terminated = true)]
|
||||||
public string[] get_globs ();
|
public string[] get_globs ();
|
||||||
public bool get_hidden ();
|
public bool get_hidden ();
|
||||||
|
@ -303,16 +404,16 @@ namespace GtkSource {
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_manager_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_language_manager_get_type ()")]
|
||||||
[GIR (name = "LanguageManager")]
|
[GIR (name = "LanguageManager")]
|
||||||
public class LanguageManager : GLib.Object {
|
public class SourceLanguageManager : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
public LanguageManager ();
|
public SourceLanguageManager ();
|
||||||
public static unowned GtkSource.LanguageManager get_default ();
|
public static unowned Gtk.SourceLanguageManager get_default ();
|
||||||
public unowned GtkSource.Language get_language (string id);
|
public unowned Gtk.SourceLanguage? get_language (string id);
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[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)]
|
[CCode (array_length = false, array_null_terminated = true)]
|
||||||
public unowned string[] get_search_path ();
|
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);
|
public void set_search_path ([CCode (array_length = false, array_null_terminated = true)] string[]? dirs);
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[CCode (array_length = false, array_null_terminated = true)]
|
||||||
public string[] language_ids { get; }
|
public string[] language_ids { get; }
|
||||||
|
@ -321,52 +422,55 @@ namespace GtkSource {
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_get_type ()")]
|
||||||
[GIR (name = "Mark")]
|
[GIR (name = "Mark")]
|
||||||
public class Mark : Gtk.TextMark {
|
public class SourceMark : Gtk.TextMark {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
public Mark (string name, string category);
|
public SourceMark (string name, string category);
|
||||||
public unowned string get_category ();
|
public unowned string get_category ();
|
||||||
public unowned GtkSource.Mark next (string? category);
|
public unowned Gtk.SourceMark? next (string? category);
|
||||||
public unowned GtkSource.Mark prev (string category);
|
public unowned Gtk.SourceMark? prev (string category);
|
||||||
public string category { get; construct; }
|
public string category { get; construct; }
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_attributes_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_mark_attributes_get_type ()")]
|
||||||
[GIR (name = "MarkAttributes")]
|
[GIR (name = "MarkAttributes")]
|
||||||
public class MarkAttributes : GLib.Object {
|
public class SourceMarkAttributes : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
public MarkAttributes ();
|
public SourceMarkAttributes ();
|
||||||
public bool get_background (out Gdk.RGBA background);
|
public bool get_background (out Gdk.RGBA background);
|
||||||
public unowned GLib.Icon get_gicon ();
|
public unowned GLib.Icon get_gicon ();
|
||||||
public unowned string get_icon_name ();
|
public unowned string get_icon_name ();
|
||||||
public unowned Gdk.Pixbuf get_pixbuf ();
|
public unowned Gdk.Pixbuf get_pixbuf ();
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public unowned string get_stock_id ();
|
public unowned string get_stock_id ();
|
||||||
public string get_tooltip_markup (GtkSource.Mark mark);
|
public string get_tooltip_markup (Gtk.SourceMark mark);
|
||||||
public string get_tooltip_text (GtkSource.Mark mark);
|
public string get_tooltip_text (Gtk.SourceMark mark);
|
||||||
public unowned Gdk.Pixbuf render_icon (Gtk.Widget widget, int size);
|
public unowned Gdk.Pixbuf render_icon (Gtk.Widget widget, int size);
|
||||||
public void set_background (Gdk.RGBA background);
|
public void set_background (Gdk.RGBA background);
|
||||||
public void set_gicon (GLib.Icon gicon);
|
public void set_gicon (GLib.Icon gicon);
|
||||||
public void set_icon_name (string icon_name);
|
public void set_icon_name (string icon_name);
|
||||||
public void set_pixbuf (Gdk.Pixbuf pixbuf);
|
public void set_pixbuf (Gdk.Pixbuf pixbuf);
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public void set_stock_id (string stock_id);
|
public void set_stock_id (string stock_id);
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public Gdk.RGBA background { get; set; }
|
public Gdk.RGBA background { get; set; }
|
||||||
public GLib.Icon gicon { get; set; }
|
public GLib.Icon gicon { get; set; }
|
||||||
public string icon_name { get; set; }
|
public string icon_name { get; set; }
|
||||||
public Gdk.Pixbuf pixbuf { get; set; }
|
public Gdk.Pixbuf pixbuf { get; set; }
|
||||||
|
[Deprecated (since = "3.10")]
|
||||||
public string stock_id { get; set; }
|
public string stock_id { get; set; }
|
||||||
public signal string query_tooltip_markup (GtkSource.Mark mark);
|
public signal string query_tooltip_markup (Gtk.SourceMark mark);
|
||||||
public signal string query_tooltip_text (GtkSource.Mark mark);
|
public signal string query_tooltip_text (Gtk.SourceMark mark);
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_print_compositor_get_type ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_print_compositor_get_type ()")]
|
||||||
[GIR (name = "PrintCompositor")]
|
[GIR (name = "PrintCompositor")]
|
||||||
public class PrintCompositor : GLib.Object {
|
public class SourcePrintCompositor : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[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);
|
public void draw_page (Gtk.PrintContext context, int page_nr);
|
||||||
[CCode (has_construct_function = false)]
|
[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 string get_body_font_name ();
|
||||||
public double get_bottom_margin (Gtk.Unit unit);
|
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_footer_font_name ();
|
||||||
public string get_header_font_name ();
|
public string get_header_font_name ();
|
||||||
public bool get_highlight_syntax ();
|
public bool get_highlight_syntax ();
|
||||||
|
@ -399,7 +503,7 @@ namespace GtkSource {
|
||||||
public void set_top_margin (double margin, Gtk.Unit unit);
|
public void set_top_margin (double margin, Gtk.Unit unit);
|
||||||
public void set_wrap_mode (Gtk.WrapMode wrap_mode);
|
public void set_wrap_mode (Gtk.WrapMode wrap_mode);
|
||||||
public string body_font_name { owned get; set; }
|
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 footer_font_name { owned get; set; }
|
||||||
public string header_font_name { owned get; set; }
|
public string header_font_name { owned get; set; }
|
||||||
public bool highlight_syntax { get; set; }
|
public bool highlight_syntax { get; set; }
|
||||||
|
@ -411,12 +515,61 @@ namespace GtkSource {
|
||||||
public uint tab_width { get; set; }
|
public uint tab_width { get; set; }
|
||||||
public Gtk.WrapMode wrap_mode { 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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_get_type ()")]
|
||||||
[GIR (name = "Style")]
|
[GIR (name = "Style")]
|
||||||
public class Style : GLib.Object {
|
public class SourceStyle : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected Style ();
|
protected SourceStyle ();
|
||||||
public GtkSource.Style copy ();
|
public Gtk.SourceStyle copy ();
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public string background { owned get; construct; }
|
public string background { owned get; construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
@ -438,6 +591,10 @@ namespace GtkSource {
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public bool line_background_set { get; construct; }
|
public bool line_background_set { get; construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
|
public string scale { owned get; construct; }
|
||||||
|
[NoAccessorMethod]
|
||||||
|
public bool scale_set { get; construct; }
|
||||||
|
[NoAccessorMethod]
|
||||||
public bool strikethrough { get; construct; }
|
public bool strikethrough { get; construct; }
|
||||||
[NoAccessorMethod]
|
[NoAccessorMethod]
|
||||||
public bool strikethrough_set { get; construct; }
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_get_type ()")]
|
||||||
[GIR (name = "StyleScheme")]
|
[GIR (name = "StyleScheme")]
|
||||||
public class StyleScheme : GLib.Object {
|
public class SourceStyleScheme : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
protected StyleScheme ();
|
protected SourceStyleScheme ();
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[CCode (array_length = false, array_null_terminated = true)]
|
||||||
public unowned string[] get_authors ();
|
public unowned string[]? get_authors ();
|
||||||
public unowned string get_description ();
|
public unowned string? get_description ();
|
||||||
public unowned string get_filename ();
|
public unowned string? get_filename ();
|
||||||
public unowned string get_id ();
|
public unowned string get_id ();
|
||||||
public unowned string get_name ();
|
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 description { get; }
|
||||||
public string filename { get; }
|
public string filename { get; }
|
||||||
public string id { get; construct; }
|
public string id { get; construct; }
|
||||||
public string name { get; }
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_style_scheme_manager_get_type ()")]
|
||||||
[GIR (name = "StyleSchemeManager")]
|
[GIR (name = "StyleSchemeManager")]
|
||||||
public class StyleSchemeManager : GLib.Object {
|
public class SourceStyleSchemeManager : GLib.Object {
|
||||||
[CCode (has_construct_function = false)]
|
[CCode (has_construct_function = false)]
|
||||||
public StyleSchemeManager ();
|
public SourceStyleSchemeManager ();
|
||||||
public void append_search_path (string path);
|
public void append_search_path (string path);
|
||||||
public void force_rescan ();
|
public void force_rescan ();
|
||||||
public static unowned GtkSource.StyleSchemeManager get_default ();
|
public static unowned Gtk.SourceStyleSchemeManager get_default ();
|
||||||
public unowned GtkSource.StyleScheme get_scheme (string scheme_id);
|
public unowned Gtk.SourceStyleScheme get_scheme (string scheme_id);
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[CCode (array_length = false, array_null_terminated = true)]
|
||||||
public unowned string[] get_scheme_ids ();
|
public unowned string[] get_scheme_ids ();
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
[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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_view_get_type ()")]
|
||||||
[GIR (name = "View")]
|
[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*")]
|
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
||||||
public View ();
|
public SourceView ();
|
||||||
public bool get_auto_indent ();
|
public bool get_auto_indent ();
|
||||||
public unowned GtkSource.Completion get_completion ();
|
public Gtk.SourceBackgroundPatternType get_background_pattern ();
|
||||||
public GtkSource.DrawSpacesFlags get_draw_spaces ();
|
public unowned Gtk.SourceCompletion get_completion ();
|
||||||
public unowned GtkSource.Gutter get_gutter (Gtk.TextWindowType window_type);
|
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_highlight_current_line ();
|
||||||
public bool get_indent_on_tab ();
|
public bool get_indent_on_tab ();
|
||||||
public int get_indent_width ();
|
public int get_indent_width ();
|
||||||
public bool get_insert_spaces_instead_of_tabs ();
|
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 uint get_right_margin_position ();
|
||||||
public bool get_show_line_marks ();
|
public bool get_show_line_marks ();
|
||||||
public bool get_show_line_numbers ();
|
public bool get_show_line_numbers ();
|
||||||
public bool get_show_right_margin ();
|
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_tab_width ();
|
||||||
public uint get_visual_column (Gtk.TextIter iter);
|
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_auto_indent (bool enable);
|
||||||
public void set_draw_spaces (GtkSource.DrawSpacesFlags flags);
|
public void set_background_pattern (Gtk.SourceBackgroundPatternType background_pattern);
|
||||||
public void set_highlight_current_line (bool hl);
|
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_on_tab (bool enable);
|
||||||
public void set_indent_width (int width);
|
public void set_indent_width (int width);
|
||||||
public void set_insert_spaces_instead_of_tabs (bool enable);
|
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_right_margin_position (uint pos);
|
||||||
public void set_show_line_marks (bool show);
|
public void set_show_line_marks (bool show);
|
||||||
public void set_show_line_numbers (bool show);
|
public void set_show_line_numbers (bool show);
|
||||||
public void set_show_right_margin (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 set_tab_width (uint width);
|
||||||
|
public void unindent_lines (Gtk.TextIter start, Gtk.TextIter end);
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
[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 bool auto_indent { get; set; }
|
||||||
public GtkSource.Completion completion { get; }
|
public Gtk.SourceBackgroundPatternType background_pattern { get; set; }
|
||||||
public GtkSource.DrawSpacesFlags draw_spaces { get; set; }
|
public Gtk.SourceCompletion completion { get; }
|
||||||
|
public Gtk.SourceDrawSpacesFlags draw_spaces { get; set; }
|
||||||
public bool highlight_current_line { get; set; }
|
public bool highlight_current_line { get; set; }
|
||||||
public bool indent_on_tab { get; set; }
|
public bool indent_on_tab { get; set; }
|
||||||
public int indent_width { 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_marks { get; set; }
|
||||||
public bool show_line_numbers { get; set; }
|
public bool show_line_numbers { get; set; }
|
||||||
public bool show_right_margin { 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 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 line_mark_activated (Gtk.TextIter iter, Gdk.Event event);
|
||||||
public virtual signal void move_lines (bool copy, int step);
|
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 move_words (int step);
|
||||||
public virtual signal void redo ();
|
public virtual signal void redo ();
|
||||||
public virtual signal void show_completion ();
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_proposal_get_type ()")]
|
||||||
[GIR (name = "CompletionProposal")]
|
[GIR (name = "CompletionProposal")]
|
||||||
public interface CompletionProposal : GLib.Object {
|
public interface SourceCompletionProposal : GLib.Object {
|
||||||
public virtual bool equal (GtkSource.CompletionProposal other);
|
public virtual bool equal (Gtk.SourceCompletionProposal other);
|
||||||
public virtual unowned Gdk.Pixbuf get_icon ();
|
public virtual unowned Gdk.Pixbuf get_icon ();
|
||||||
public abstract string get_info ();
|
public abstract string get_info ();
|
||||||
public abstract string get_label ();
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_completion_provider_get_type ()")]
|
||||||
[GIR (name = "CompletionProvider")]
|
[GIR (name = "CompletionProvider")]
|
||||||
public interface CompletionProvider : GLib.Object {
|
public interface SourceCompletionProvider : GLib.Object {
|
||||||
public virtual bool activate_proposal (GtkSource.CompletionProposal proposal, Gtk.TextIter iter);
|
public virtual bool activate_proposal (Gtk.SourceCompletionProposal proposal, Gtk.TextIter iter);
|
||||||
public virtual GtkSource.CompletionActivation get_activation ();
|
public virtual Gtk.SourceCompletionActivation get_activation ();
|
||||||
public virtual unowned Gdk.Pixbuf? get_icon ();
|
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 int get_interactive_delay ();
|
||||||
public virtual string get_name ();
|
public virtual string get_name ();
|
||||||
public virtual int get_priority ();
|
public virtual int get_priority ();
|
||||||
public virtual bool get_start_iter (GtkSource.CompletionContext context, GtkSource.CompletionProposal proposal, Gtk.TextIter iter);
|
public virtual bool get_start_iter (Gtk.SourceCompletionContext context, Gtk.SourceCompletionProposal proposal, out Gtk.TextIter iter);
|
||||||
public virtual bool match (GtkSource.CompletionContext context);
|
public virtual bool match (Gtk.SourceCompletionContext context);
|
||||||
public virtual void populate (GtkSource.CompletionContext context);
|
public virtual void populate (Gtk.SourceCompletionContext context);
|
||||||
public virtual void update_info (GtkSource.CompletionProposal proposal, GtkSource.CompletionInfo info);
|
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 ()")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", type_id = "gtk_source_undo_manager_get_type ()")]
|
||||||
[GIR (name = "UndoManager")]
|
[GIR (name = "UndoManager")]
|
||||||
public interface UndoManager : GLib.Object {
|
public interface SourceUndoManager : GLib.Object {
|
||||||
public abstract void begin_not_undoable_action ();
|
public abstract void begin_not_undoable_action ();
|
||||||
public abstract bool can_redo ();
|
public abstract bool can_redo ();
|
||||||
public abstract bool can_undo ();
|
public abstract bool can_undo ();
|
||||||
|
@ -581,26 +766,46 @@ namespace GtkSource {
|
||||||
[HasEmitter]
|
[HasEmitter]
|
||||||
public virtual signal void can_undo_changed ();
|
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")]
|
[GIR (name = "BracketMatchType")]
|
||||||
public enum BracketMatchType {
|
public enum SourceBracketMatchType {
|
||||||
NONE,
|
NONE,
|
||||||
OUT_OF_RANGE,
|
OUT_OF_RANGE,
|
||||||
NOT_FOUND,
|
NOT_FOUND,
|
||||||
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]
|
[Flags]
|
||||||
[GIR (name = "CompletionActivation")]
|
[GIR (name = "CompletionActivation")]
|
||||||
public enum CompletionActivation {
|
public enum SourceCompletionActivation {
|
||||||
NONE,
|
NONE,
|
||||||
INTERACTIVE,
|
INTERACTIVE,
|
||||||
USER_REQUESTED
|
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]
|
[Flags]
|
||||||
[GIR (name = "DrawSpacesFlags")]
|
[GIR (name = "DrawSpacesFlags")]
|
||||||
public enum DrawSpacesFlags {
|
public enum SourceDrawSpacesFlags {
|
||||||
SPACE,
|
SPACE,
|
||||||
TAB,
|
TAB,
|
||||||
NEWLINE,
|
NEWLINE,
|
||||||
|
@ -610,42 +815,75 @@ namespace GtkSource {
|
||||||
TRAILING,
|
TRAILING,
|
||||||
ALL
|
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")]
|
[GIR (name = "GutterRendererAlignmentMode")]
|
||||||
public enum GutterRendererAlignmentMode {
|
public enum SourceGutterRendererAlignmentMode {
|
||||||
CELL,
|
CELL,
|
||||||
FIRST,
|
FIRST,
|
||||||
LAST
|
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]
|
[Flags]
|
||||||
[GIR (name = "GutterRendererState")]
|
[GIR (name = "GutterRendererState")]
|
||||||
public enum GutterRendererState {
|
public enum SourceGutterRendererState {
|
||||||
NORMAL,
|
NORMAL,
|
||||||
CURSOR,
|
CURSOR,
|
||||||
PRELIT,
|
PRELIT,
|
||||||
SELECTED
|
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")]
|
[GIR (name = "SmartHomeEndType")]
|
||||||
public enum SmartHomeEndType {
|
public enum SourceSmartHomeEndType {
|
||||||
DISABLED,
|
DISABLED,
|
||||||
BEFORE,
|
BEFORE,
|
||||||
AFTER,
|
AFTER,
|
||||||
ALWAYS
|
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")]
|
[GIR (name = "ViewGutterPosition")]
|
||||||
public enum ViewGutterPosition {
|
public enum SourceViewGutterPosition {
|
||||||
LINES,
|
LINES,
|
||||||
MARKS
|
MARKS
|
||||||
}
|
}
|
||||||
[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ERROR_")]
|
[CCode (cheader_filename = "gtksourceview/gtksource.h", cprefix = "GTK_SOURCE_COMPLETION_ERROR_")]
|
||||||
[GIR (name = "CompletionError")]
|
[GIR (name = "CompletionError")]
|
||||||
public errordomain CompletionError {
|
public errordomain SourceCompletionError {
|
||||||
ALREADY_BOUND,
|
ALREADY_BOUND,
|
||||||
NOT_BOUND;
|
NOT_BOUND;
|
||||||
[CCode (cname = "gtk_source_completion_error_quark")]
|
[CCode (cname = "gtk_source_completion_error_quark")]
|
||||||
public static GLib.Quark uark ();
|
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 ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
atk
|
|
||||||
gio-2.0
|
|
||||||
cairo
|
|
||||||
pango
|
|
||||||
gdk-pixbuf-2.0
|
|
||||||
gdk-3.0
|
|
||||||
gtk+-3.0
|
|
||||||
libsoup-2.4
|
|
|
@ -1,734 +0,0 @@
|
||||||
/* webkit2gtk-3.0.vapi generated by vapigen, do not modify. */
|
|
||||||
|
|
||||||
[CCode (cprefix = "WebKit", gir_namespace = "WebKit2", gir_version = "3.0", lower_case_cprefix = "webkit_")]
|
|
||||||
namespace WebKit {
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_back_forward_list_get_type ()")]
|
|
||||||
public class BackForwardList : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected BackForwardList ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_back_item ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_back_list ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_back_list_with_limit (uint limit);
|
|
||||||
public unowned WebKit.BackForwardListItem get_current_item ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_forward_item ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_forward_list ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_forward_list_with_limit (uint limit);
|
|
||||||
public uint get_length ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_nth_item (int index);
|
|
||||||
public signal void changed (WebKit.BackForwardListItem? item_added, void* items_removed);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_back_forward_list_item_get_type ()")]
|
|
||||||
public class BackForwardListItem : GLib.InitiallyUnowned {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected BackForwardListItem ();
|
|
||||||
public unowned string get_original_uri ();
|
|
||||||
public unowned string get_title ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_context_menu_get_type ()")]
|
|
||||||
public class ContextMenu : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenu ();
|
|
||||||
public void append (WebKit.ContextMenuItem item);
|
|
||||||
public unowned WebKit.ContextMenuItem first ();
|
|
||||||
public unowned WebKit.ContextMenuItem get_item_at_position (uint position);
|
|
||||||
public unowned GLib.List<WebKit.ContextMenuItem> get_items ();
|
|
||||||
public uint get_n_items ();
|
|
||||||
public void insert (WebKit.ContextMenuItem item, int position);
|
|
||||||
public unowned WebKit.ContextMenuItem last ();
|
|
||||||
public void move_item (WebKit.ContextMenuItem item, int position);
|
|
||||||
public void prepend (WebKit.ContextMenuItem item);
|
|
||||||
public void remove (WebKit.ContextMenuItem item);
|
|
||||||
public void remove_all ();
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenu.with_items (GLib.List<WebKit.ContextMenuItem> items);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_context_menu_item_get_type ()")]
|
|
||||||
public class ContextMenuItem : GLib.InitiallyUnowned {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem (Gtk.Action action);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.from_stock_action (WebKit.ContextMenuAction action);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.from_stock_action_with_label (WebKit.ContextMenuAction action, string label);
|
|
||||||
public unowned Gtk.Action get_action ();
|
|
||||||
public WebKit.ContextMenuAction get_stock_action ();
|
|
||||||
public unowned WebKit.ContextMenu get_submenu ();
|
|
||||||
public bool is_separator ();
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.separator ();
|
|
||||||
public void set_submenu (WebKit.ContextMenu? submenu);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.with_submenu (string label, WebKit.ContextMenu submenu);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_cookie_manager_get_type ()")]
|
|
||||||
public class CookieManager : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected CookieManager ();
|
|
||||||
public void delete_all_cookies ();
|
|
||||||
public void delete_cookies_for_domain (string domain);
|
|
||||||
public async WebKit.CookieAcceptPolicy get_accept_policy (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public async string[] get_domains_with_cookies (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public void set_accept_policy (WebKit.CookieAcceptPolicy policy);
|
|
||||||
public void set_persistent_storage (string filename, WebKit.CookiePersistentStorage storage);
|
|
||||||
public signal void changed ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_download_get_type ()")]
|
|
||||||
public class Download : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected Download ();
|
|
||||||
public void cancel ();
|
|
||||||
public unowned string get_destination ();
|
|
||||||
public double get_elapsed_time ();
|
|
||||||
public double get_estimated_progress ();
|
|
||||||
public uint64 get_received_data_length ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public void set_destination (string uri);
|
|
||||||
public string destination { get; }
|
|
||||||
public double estimated_progress { get; }
|
|
||||||
public WebKit.URIResponse response { get; }
|
|
||||||
public signal bool created_destination (string destination);
|
|
||||||
public virtual signal bool decide_destination (string suggested_filename);
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
public signal void received_data (uint64 data_length);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_file_chooser_request_get_type ()")]
|
|
||||||
public class FileChooserRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FileChooserRequest ();
|
|
||||||
public void cancel ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_mime_types ();
|
|
||||||
public unowned Gtk.FileFilter get_mime_types_filter ();
|
|
||||||
public bool get_select_multiple ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_selected_files ();
|
|
||||||
public void select_files ([CCode (array_length = false, array_null_terminated = true)] string[] files);
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public Gtk.FileFilter filter { owned get; }
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public string[] mime_types { get; }
|
|
||||||
public bool select_multiple { get; }
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public string[] selected_files { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_find_controller_get_type ()")]
|
|
||||||
public class FindController : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FindController ();
|
|
||||||
public void count_matches (string search_text, uint32 find_options, uint max_match_count);
|
|
||||||
public uint get_max_match_count ();
|
|
||||||
public uint32 get_options ();
|
|
||||||
public unowned string get_search_text ();
|
|
||||||
public unowned WebKit.WebView get_web_view ();
|
|
||||||
public void search (string search_text, uint32 find_options, uint max_match_count);
|
|
||||||
public void search_finish ();
|
|
||||||
public void search_next ();
|
|
||||||
public void search_previous ();
|
|
||||||
public uint max_match_count { get; }
|
|
||||||
public WebKit.FindOptions options { get; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public string text { owned get; }
|
|
||||||
public WebKit.WebView web_view { get; construct; }
|
|
||||||
public signal void counted_matches (uint match_count);
|
|
||||||
public signal void failed_to_find_text ();
|
|
||||||
public signal void found_text (uint match_count);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_form_submission_request_get_type ()")]
|
|
||||||
public class FormSubmissionRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FormSubmissionRequest ();
|
|
||||||
public unowned GLib.HashTable<void*,void*> get_text_fields ();
|
|
||||||
public void submit ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_geolocation_permission_request_get_type ()")]
|
|
||||||
public class GeolocationPermissionRequest : GLib.Object, WebKit.PermissionRequest {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected GeolocationPermissionRequest ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_hit_test_result_get_type ()")]
|
|
||||||
public class HitTestResult : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected HitTestResult ();
|
|
||||||
public bool context_is_editable ();
|
|
||||||
public bool context_is_image ();
|
|
||||||
public bool context_is_link ();
|
|
||||||
public bool context_is_media ();
|
|
||||||
public uint get_context ();
|
|
||||||
public unowned string get_image_uri ();
|
|
||||||
public unowned string get_link_label ();
|
|
||||||
public unowned string get_link_title ();
|
|
||||||
public unowned string get_link_uri ();
|
|
||||||
public unowned string get_media_uri ();
|
|
||||||
public uint context { get; construct; }
|
|
||||||
public string image_uri { get; construct; }
|
|
||||||
public string link_label { get; construct; }
|
|
||||||
public string link_title { get; construct; }
|
|
||||||
public string link_uri { get; construct; }
|
|
||||||
public string media_uri { get; construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_javascript_result_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class JavascriptResult {
|
|
||||||
public WebKit.JavascriptResult @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_mime_info_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class MimeInfo {
|
|
||||||
public unowned string get_description ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_extensions ();
|
|
||||||
public unowned string get_mime_type ();
|
|
||||||
public WebKit.MimeInfo @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_navigation_policy_decision_get_type ()")]
|
|
||||||
public class NavigationPolicyDecision : WebKit.PolicyDecision {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected NavigationPolicyDecision ();
|
|
||||||
public unowned string get_frame_name ();
|
|
||||||
public uint get_modifiers ();
|
|
||||||
public uint get_mouse_button ();
|
|
||||||
public WebKit.NavigationType get_navigation_type ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public string frame_name { get; }
|
|
||||||
public uint modifiers { get; }
|
|
||||||
public uint mouse_button { get; }
|
|
||||||
public WebKit.NavigationType navigation_type { get; }
|
|
||||||
public WebKit.URIRequest request { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_plugin_get_type ()")]
|
|
||||||
public class Plugin : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected Plugin ();
|
|
||||||
public unowned string get_description ();
|
|
||||||
public unowned GLib.List<WebKit.MimeInfo> get_mime_info_list ();
|
|
||||||
public unowned string get_name ();
|
|
||||||
public unowned string get_path ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_policy_decision_get_type ()")]
|
|
||||||
public abstract class PolicyDecision : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected PolicyDecision ();
|
|
||||||
public void download ();
|
|
||||||
public void ignore ();
|
|
||||||
public void use ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_print_operation_get_type ()")]
|
|
||||||
public class PrintOperation : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public PrintOperation (WebKit.WebView web_view);
|
|
||||||
public unowned Gtk.PageSetup get_page_setup ();
|
|
||||||
public unowned Gtk.PrintSettings get_print_settings ();
|
|
||||||
public void print ();
|
|
||||||
public WebKit.PrintOperationResponse run_dialog (Gtk.Window? parent);
|
|
||||||
public void set_page_setup (Gtk.PageSetup page_setup);
|
|
||||||
public void set_print_settings (Gtk.PrintSettings print_settings);
|
|
||||||
public Gtk.PageSetup page_setup { get; set; }
|
|
||||||
public Gtk.PrintSettings print_settings { get; set; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public WebKit.WebView web_view { owned get; construct; }
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_response_policy_decision_get_type ()")]
|
|
||||||
public class ResponsePolicyDecision : WebKit.PolicyDecision {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected ResponsePolicyDecision ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public WebKit.URIRequest request { get; }
|
|
||||||
public WebKit.URIRequest response { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_script_dialog_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class ScriptDialog {
|
|
||||||
public void confirm_set_confirmed (bool confirmed);
|
|
||||||
public WebKit.ScriptDialogType get_dialog_type ();
|
|
||||||
public unowned string get_message ();
|
|
||||||
public unowned string prompt_get_default_text ();
|
|
||||||
public void prompt_set_text (string text);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_settings_get_type ()")]
|
|
||||||
public class Settings : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public Settings ();
|
|
||||||
public bool get_allow_modal_dialogs ();
|
|
||||||
public bool get_auto_load_images ();
|
|
||||||
public unowned string get_cursive_font_family ();
|
|
||||||
public unowned string get_default_charset ();
|
|
||||||
public unowned string get_default_font_family ();
|
|
||||||
public uint32 get_default_font_size ();
|
|
||||||
public uint32 get_default_monospace_font_size ();
|
|
||||||
public bool get_draw_compositing_indicators ();
|
|
||||||
public bool get_enable_caret_browsing ();
|
|
||||||
public bool get_enable_developer_extras ();
|
|
||||||
public bool get_enable_dns_prefetching ();
|
|
||||||
public bool get_enable_frame_flattening ();
|
|
||||||
public bool get_enable_fullscreen ();
|
|
||||||
public bool get_enable_html5_database ();
|
|
||||||
public bool get_enable_html5_local_storage ();
|
|
||||||
public bool get_enable_hyperlink_auditing ();
|
|
||||||
public bool get_enable_java ();
|
|
||||||
public bool get_enable_javascript ();
|
|
||||||
public bool get_enable_offline_web_application_cache ();
|
|
||||||
public bool get_enable_page_cache ();
|
|
||||||
public bool get_enable_plugins ();
|
|
||||||
public bool get_enable_private_browsing ();
|
|
||||||
public bool get_enable_resizable_text_areas ();
|
|
||||||
public bool get_enable_site_specific_quirks ();
|
|
||||||
public bool get_enable_tabs_to_links ();
|
|
||||||
public bool get_enable_webaudio ();
|
|
||||||
public bool get_enable_webgl ();
|
|
||||||
public bool get_enable_xss_auditor ();
|
|
||||||
public unowned string get_fantasy_font_family ();
|
|
||||||
public bool get_javascript_can_access_clipboard ();
|
|
||||||
public bool get_javascript_can_open_windows_automatically ();
|
|
||||||
public bool get_load_icons_ignoring_image_load_setting ();
|
|
||||||
public bool get_media_playback_allows_inline ();
|
|
||||||
public bool get_media_playback_requires_user_gesture ();
|
|
||||||
public uint32 get_minimum_font_size ();
|
|
||||||
public unowned string get_monospace_font_family ();
|
|
||||||
public unowned string get_pictograph_font_family ();
|
|
||||||
public bool get_print_backgrounds ();
|
|
||||||
public unowned string get_sans_serif_font_family ();
|
|
||||||
public unowned string get_serif_font_family ();
|
|
||||||
public bool get_zoom_text_only ();
|
|
||||||
public void set_allow_modal_dialogs (bool allowed);
|
|
||||||
public void set_auto_load_images (bool enabled);
|
|
||||||
public void set_cursive_font_family (string cursive_font_family);
|
|
||||||
public void set_default_charset (string default_charset);
|
|
||||||
public void set_default_font_family (string default_font_family);
|
|
||||||
public void set_default_font_size (uint32 font_size);
|
|
||||||
public void set_default_monospace_font_size (uint32 font_size);
|
|
||||||
public void set_draw_compositing_indicators (bool enabled);
|
|
||||||
public void set_enable_caret_browsing (bool enabled);
|
|
||||||
public void set_enable_developer_extras (bool enabled);
|
|
||||||
public void set_enable_dns_prefetching (bool enabled);
|
|
||||||
public void set_enable_frame_flattening (bool enabled);
|
|
||||||
public void set_enable_fullscreen (bool enabled);
|
|
||||||
public void set_enable_html5_database (bool enabled);
|
|
||||||
public void set_enable_html5_local_storage (bool enabled);
|
|
||||||
public void set_enable_hyperlink_auditing (bool enabled);
|
|
||||||
public void set_enable_java (bool enabled);
|
|
||||||
public void set_enable_javascript (bool enabled);
|
|
||||||
public void set_enable_offline_web_application_cache (bool enabled);
|
|
||||||
public void set_enable_page_cache (bool enabled);
|
|
||||||
public void set_enable_plugins (bool enabled);
|
|
||||||
public void set_enable_private_browsing (bool enabled);
|
|
||||||
public void set_enable_resizable_text_areas (bool enabled);
|
|
||||||
public void set_enable_site_specific_quirks (bool enabled);
|
|
||||||
public void set_enable_tabs_to_links (bool enabled);
|
|
||||||
public void set_enable_webaudio (bool enabled);
|
|
||||||
public void set_enable_webgl (bool enabled);
|
|
||||||
public void set_enable_xss_auditor (bool enabled);
|
|
||||||
public void set_fantasy_font_family (string fantasy_font_family);
|
|
||||||
public void set_javascript_can_access_clipboard (bool enabled);
|
|
||||||
public void set_javascript_can_open_windows_automatically (bool enabled);
|
|
||||||
public void set_load_icons_ignoring_image_load_setting (bool enabled);
|
|
||||||
public void set_media_playback_allows_inline (bool enabled);
|
|
||||||
public void set_media_playback_requires_user_gesture (bool enabled);
|
|
||||||
public void set_minimum_font_size (uint32 font_size);
|
|
||||||
public void set_monospace_font_family (string monospace_font_family);
|
|
||||||
public void set_pictograph_font_family (string pictograph_font_family);
|
|
||||||
public void set_print_backgrounds (bool print_backgrounds);
|
|
||||||
public void set_sans_serif_font_family (string sans_serif_font_family);
|
|
||||||
public void set_serif_font_family (string serif_font_family);
|
|
||||||
public void set_zoom_text_only (bool zoom_text_only);
|
|
||||||
public bool allow_modal_dialogs { get; set construct; }
|
|
||||||
public bool auto_load_images { get; set construct; }
|
|
||||||
public string cursive_font_family { get; set construct; }
|
|
||||||
public string default_charset { get; set construct; }
|
|
||||||
public string default_font_family { get; set construct; }
|
|
||||||
public uint default_font_size { get; set construct; }
|
|
||||||
public uint default_monospace_font_size { get; set construct; }
|
|
||||||
public bool draw_compositing_indicators { get; set construct; }
|
|
||||||
public bool enable_caret_browsing { get; set construct; }
|
|
||||||
public bool enable_developer_extras { get; set construct; }
|
|
||||||
public bool enable_dns_prefetching { get; set construct; }
|
|
||||||
public bool enable_frame_flattening { get; set construct; }
|
|
||||||
public bool enable_fullscreen { get; set construct; }
|
|
||||||
public bool enable_html5_database { get; set construct; }
|
|
||||||
public bool enable_html5_local_storage { get; set construct; }
|
|
||||||
public bool enable_hyperlink_auditing { get; set construct; }
|
|
||||||
public bool enable_java { get; set construct; }
|
|
||||||
public bool enable_javascript { get; set construct; }
|
|
||||||
public bool enable_offline_web_application_cache { get; set construct; }
|
|
||||||
public bool enable_page_cache { get; set construct; }
|
|
||||||
public bool enable_plugins { get; set construct; }
|
|
||||||
public bool enable_private_browsing { get; set construct; }
|
|
||||||
public bool enable_resizable_text_areas { get; set construct; }
|
|
||||||
public bool enable_site_specific_quirks { get; set construct; }
|
|
||||||
public bool enable_tabs_to_links { get; set construct; }
|
|
||||||
public bool enable_webaudio { get; set construct; }
|
|
||||||
public bool enable_webgl { get; set construct; }
|
|
||||||
public bool enable_write_console_messages_to_stdout { get; set construct; }
|
|
||||||
public bool enable_xss_auditor { get; set construct; }
|
|
||||||
public string fantasy_font_family { get; set construct; }
|
|
||||||
public bool javascript_can_access_clipboard { get; set construct; }
|
|
||||||
public bool javascript_can_open_windows_automatically { get; set construct; }
|
|
||||||
public bool load_icons_ignoring_image_load_setting { get; set construct; }
|
|
||||||
public bool media_playback_allows_inline { get; set construct; }
|
|
||||||
public bool media_playback_requires_user_gesture { get; set construct; }
|
|
||||||
public uint minimum_font_size { get; set construct; }
|
|
||||||
public string monospace_font_family { get; set construct; }
|
|
||||||
public string pictograph_font_family { get; set construct; }
|
|
||||||
public bool print_backgrounds { get; set construct; }
|
|
||||||
public string sans_serif_font_family { get; set construct; }
|
|
||||||
public string serif_font_family { get; set construct; }
|
|
||||||
public bool zoom_text_only { get; set construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_request_get_type ()")]
|
|
||||||
public class URIRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public URIRequest (string uri);
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public string uri { get; construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_response_get_type ()")]
|
|
||||||
public class URIResponse : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected URIResponse ();
|
|
||||||
public uint64 get_content_length ();
|
|
||||||
public bool get_https_status (out unowned GLib.TlsCertificate certificate, out GLib.TlsCertificateFlags errors);
|
|
||||||
public unowned string get_mime_type ();
|
|
||||||
public uint get_status_code ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public uint64 content_length { get; }
|
|
||||||
public string mime_type { get; }
|
|
||||||
public uint status_code { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_scheme_request_get_type ()")]
|
|
||||||
public class URISchemeRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected URISchemeRequest ();
|
|
||||||
public void finish (GLib.InputStream stream, int64 stream_length, string? mime_type);
|
|
||||||
public void finish_error (GLib.Error error);
|
|
||||||
public unowned string get_path ();
|
|
||||||
public unowned string get_scheme ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_context_get_type ()")]
|
|
||||||
public class WebContext : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebContext ();
|
|
||||||
public void clear_cache ();
|
|
||||||
public WebKit.Download download_uri (string uri);
|
|
||||||
public WebKit.CacheModel get_cache_model ();
|
|
||||||
public unowned WebKit.CookieManager get_cookie_manager ();
|
|
||||||
public static unowned WebKit.WebContext get_default ();
|
|
||||||
public async GLib.List<WebKit.Plugin> get_plugins (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public bool get_spell_checking_enabled ();
|
|
||||||
public unowned string get_spell_checking_languages ();
|
|
||||||
public void register_uri_scheme (string scheme, owned WebKit.URISchemeRequestCallback callback);
|
|
||||||
public void set_additional_plugins_directory (string directory);
|
|
||||||
public void set_cache_model (WebKit.CacheModel cache_model);
|
|
||||||
public void set_spell_checking_enabled (bool enabled);
|
|
||||||
public void set_spell_checking_languages (string languages);
|
|
||||||
public signal void download_started (WebKit.Download download);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_inspector_get_type ()")]
|
|
||||||
public class WebInspector : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebInspector ();
|
|
||||||
public void close ();
|
|
||||||
public uint get_attached_height ();
|
|
||||||
public unowned string get_inspected_uri ();
|
|
||||||
public unowned WebKit.WebViewBase get_web_view ();
|
|
||||||
public bool is_attached ();
|
|
||||||
public void show ();
|
|
||||||
public uint attached_height { get; }
|
|
||||||
public string inspected_uri { get; }
|
|
||||||
[HasEmitter]
|
|
||||||
public signal bool attach ();
|
|
||||||
public signal bool bring_to_front ();
|
|
||||||
public signal void closed ();
|
|
||||||
[HasEmitter]
|
|
||||||
public signal bool detach ();
|
|
||||||
public signal bool open_window ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_resource_get_type ()")]
|
|
||||||
public class WebResource : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebResource ();
|
|
||||||
public async uint8 get_data (GLib.Cancellable? cancellable, out size_t length) throws GLib.Error;
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public WebKit.URIResponse response { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
public signal void received_data (uint64 data_length);
|
|
||||||
public signal void sent_request (WebKit.URIRequest request, WebKit.URIResponse redirected_response);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_view_get_type ()")]
|
|
||||||
public class WebView : WebKit.WebViewBase, Atk.Implementor, Gtk.Buildable {
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView ();
|
|
||||||
public async bool can_execute_editing_command (string command, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public bool can_go_back ();
|
|
||||||
public bool can_go_forward ();
|
|
||||||
public bool can_show_mime_type (string mime_type);
|
|
||||||
public void execute_editing_command (string command);
|
|
||||||
public unowned WebKit.BackForwardList get_back_forward_list ();
|
|
||||||
public unowned WebKit.WebContext get_context ();
|
|
||||||
public unowned string get_custom_charset ();
|
|
||||||
public double get_estimated_load_progress ();
|
|
||||||
public unowned WebKit.FindController get_find_controller ();
|
|
||||||
public unowned WebKit.WebInspector get_inspector ();
|
|
||||||
public unowned WebKit.WebResource get_main_resource ();
|
|
||||||
public unowned WebKit.Settings get_settings ();
|
|
||||||
public GLib.List<weak WebKit.WebResource> get_subresources ();
|
|
||||||
public unowned string get_title ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public unowned WebKit.WindowProperties get_window_properties ();
|
|
||||||
public double get_zoom_level ();
|
|
||||||
public void go_back ();
|
|
||||||
public void go_forward ();
|
|
||||||
public void go_to_back_forward_list_item (WebKit.BackForwardListItem list_item);
|
|
||||||
public void load_html (string content, string? base_uri);
|
|
||||||
public void load_plain_text (string plain_text);
|
|
||||||
public void load_request (WebKit.URIRequest request);
|
|
||||||
public void load_uri (string uri);
|
|
||||||
public void reload ();
|
|
||||||
public void reload_bypass_cache ();
|
|
||||||
public void replace_content (string content, string content_uri, string? base_uri);
|
|
||||||
public async WebKit.JavascriptResult run_javascript (string script, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public void set_custom_charset (string? charset);
|
|
||||||
public void set_settings (WebKit.Settings settings);
|
|
||||||
public void set_zoom_level (double zoom_level);
|
|
||||||
public void stop_loading ();
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView.with_context (WebKit.WebContext context);
|
|
||||||
public double estimated_load_progress { get; }
|
|
||||||
public string title { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public WebKit.WebContext web_context { owned get; construct; }
|
|
||||||
public double zoom_level { get; set; }
|
|
||||||
public virtual signal void close ();
|
|
||||||
public virtual signal bool context_menu (WebKit.ContextMenu context_menu, Gdk.Event event, WebKit.HitTestResult hit_test_result);
|
|
||||||
public virtual signal void context_menu_dismissed ();
|
|
||||||
public signal Gtk.Widget create ();
|
|
||||||
public virtual signal bool decide_policy (WebKit.PolicyDecision decision, WebKit.PolicyDecisionType type);
|
|
||||||
public virtual signal bool enter_fullscreen ();
|
|
||||||
public virtual signal bool leave_fullscreen ();
|
|
||||||
public virtual signal void load_changed (WebKit.LoadEvent load_event);
|
|
||||||
public virtual signal bool load_failed (WebKit.LoadEvent load_event, string failing_uri, void* error);
|
|
||||||
public virtual signal void mouse_target_changed (WebKit.HitTestResult hit_test_result, uint modifiers);
|
|
||||||
public virtual signal bool permission_request (WebKit.PermissionRequest permission_request);
|
|
||||||
public virtual signal bool print_requested (WebKit.PrintOperation print_operation);
|
|
||||||
public virtual signal void ready_to_show ();
|
|
||||||
public virtual signal void resource_load_started (WebKit.WebResource resource, WebKit.URIRequest request);
|
|
||||||
public virtual signal void run_as_modal ();
|
|
||||||
public virtual signal bool run_file_chooser (WebKit.FileChooserRequest request);
|
|
||||||
public virtual signal bool script_dialog (WebKit.ScriptDialog dialog);
|
|
||||||
public virtual signal void submit_form (WebKit.FormSubmissionRequest request);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_view_base_get_type ()")]
|
|
||||||
public class WebViewBase : Gtk.Container, Atk.Implementor, Gtk.Buildable {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebViewBase ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_window_properties_get_type ()")]
|
|
||||||
public class WindowProperties : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WindowProperties ();
|
|
||||||
public bool get_fullscreen ();
|
|
||||||
public Gdk.Rectangle get_geometry ();
|
|
||||||
public bool get_locationbar_visible ();
|
|
||||||
public bool get_menubar_visible ();
|
|
||||||
public bool get_resizable ();
|
|
||||||
public bool get_scrollbars_visible ();
|
|
||||||
public bool get_statusbar_visible ();
|
|
||||||
public bool get_toolbar_visible ();
|
|
||||||
public bool fullscreen { get; construct; }
|
|
||||||
public Cairo.RectangleInt geometry { get; construct; }
|
|
||||||
public bool locationbar_visible { get; construct; }
|
|
||||||
public bool menubar_visible { get; construct; }
|
|
||||||
public bool resizable { get; construct; }
|
|
||||||
public bool scrollbars_visible { get; construct; }
|
|
||||||
public bool statusbar_visible { get; construct; }
|
|
||||||
public bool toolbar_visible { get; construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_permission_request_get_type ()")]
|
|
||||||
public interface PermissionRequest : GLib.Object {
|
|
||||||
public abstract void allow ();
|
|
||||||
public abstract void deny ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_CACHE_MODEL_")]
|
|
||||||
public enum CacheModel {
|
|
||||||
DOCUMENT_VIEWER,
|
|
||||||
WEB_BROWSER,
|
|
||||||
DOCUMENT_BROWSER
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_CONTEXT_MENU_ACTION_")]
|
|
||||||
public enum ContextMenuAction {
|
|
||||||
NO_ACTION,
|
|
||||||
OPEN_LINK,
|
|
||||||
OPEN_LINK_IN_NEW_WINDOW,
|
|
||||||
DOWNLOAD_LINK_TO_DISK,
|
|
||||||
COPY_LINK_TO_CLIPBOARD,
|
|
||||||
OPEN_IMAGE_IN_NEW_WINDOW,
|
|
||||||
DOWNLOAD_IMAGE_TO_DISK,
|
|
||||||
COPY_IMAGE_TO_CLIPBOARD,
|
|
||||||
COPY_IMAGE_URL_TO_CLIPBOARD,
|
|
||||||
OPEN_FRAME_IN_NEW_WINDOW,
|
|
||||||
GO_BACK,
|
|
||||||
GO_FORWARD,
|
|
||||||
STOP,
|
|
||||||
RELOAD,
|
|
||||||
COPY,
|
|
||||||
CUT,
|
|
||||||
PASTE,
|
|
||||||
DELETE,
|
|
||||||
SELECT_ALL,
|
|
||||||
INPUT_METHODS,
|
|
||||||
UNICODE,
|
|
||||||
SPELLING_GUESS,
|
|
||||||
NO_GUESSES_FOUND,
|
|
||||||
IGNORE_SPELLING,
|
|
||||||
LEARN_SPELLING,
|
|
||||||
IGNORE_GRAMMAR,
|
|
||||||
FONT_MENU,
|
|
||||||
BOLD,
|
|
||||||
ITALIC,
|
|
||||||
UNDERLINE,
|
|
||||||
OUTLINE,
|
|
||||||
INSPECT_ELEMENT,
|
|
||||||
OPEN_VIDEO_IN_NEW_WINDOW,
|
|
||||||
OPEN_AUDIO_IN_NEW_WINDOW,
|
|
||||||
COPY_VIDEO_LINK_TO_CLIPBOARD,
|
|
||||||
COPY_AUDIO_LINK_TO_CLIPBOARD,
|
|
||||||
TOGGLE_MEDIA_CONTROLS,
|
|
||||||
TOGGLE_MEDIA_LOOP,
|
|
||||||
ENTER_VIDEO_FULLSCREEN,
|
|
||||||
MEDIA_PLAY,
|
|
||||||
MEDIA_PAUSE,
|
|
||||||
MEDIA_MUTE,
|
|
||||||
CUSTOM
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_COOKIE_POLICY_ACCEPT_")]
|
|
||||||
public enum CookieAcceptPolicy {
|
|
||||||
ALWAYS,
|
|
||||||
NEVER,
|
|
||||||
NO_THIRD_PARTY
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_COOKIE_PERSISTENT_STORAGE_")]
|
|
||||||
public enum CookiePersistentStorage {
|
|
||||||
TEXT,
|
|
||||||
SQLITE
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_DOWNLOAD_ERROR_")]
|
|
||||||
public enum DownloadError {
|
|
||||||
NETWORK,
|
|
||||||
CANCELLED_BY_USER,
|
|
||||||
DESTINATION;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_FIND_OPTIONS_")]
|
|
||||||
[Flags]
|
|
||||||
public enum FindOptions {
|
|
||||||
NONE,
|
|
||||||
CASE_INSENSITIVE,
|
|
||||||
AT_WORD_STARTS,
|
|
||||||
TREAT_MEDIAL_CAPITAL_AS_WORD_START,
|
|
||||||
BACKWARDS,
|
|
||||||
WRAP_AROUND
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_HIT_TEST_RESULT_CONTEXT_")]
|
|
||||||
[Flags]
|
|
||||||
public enum HitTestResultContext {
|
|
||||||
DOCUMENT,
|
|
||||||
LINK,
|
|
||||||
IMAGE,
|
|
||||||
MEDIA,
|
|
||||||
EDITABLE
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_JAVASCRIPT_ERROR_SCRIPT_")]
|
|
||||||
public enum JavascriptError {
|
|
||||||
FAILED;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_LOAD_")]
|
|
||||||
public enum LoadEvent {
|
|
||||||
STARTED,
|
|
||||||
REDIRECTED,
|
|
||||||
COMMITTED,
|
|
||||||
FINISHED
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_NAVIGATION_TYPE_")]
|
|
||||||
public enum NavigationType {
|
|
||||||
LINK_CLICKED,
|
|
||||||
FORM_SUBMITTED,
|
|
||||||
BACK_FORWARD,
|
|
||||||
RELOAD,
|
|
||||||
FORM_RESUBMITTED,
|
|
||||||
OTHER
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_NETWORK_ERROR_")]
|
|
||||||
public enum NetworkError {
|
|
||||||
FAILED,
|
|
||||||
TRANSPORT,
|
|
||||||
UNKNOWN_PROTOCOL,
|
|
||||||
CANCELLED,
|
|
||||||
FILE_DOES_NOT_EXIST;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PLUGIN_ERROR_")]
|
|
||||||
public enum PluginError {
|
|
||||||
FAILED,
|
|
||||||
CANNOT_FIND_PLUGIN,
|
|
||||||
CANNOT_LOAD_PLUGIN,
|
|
||||||
JAVA_UNAVAILABLE,
|
|
||||||
CONNECTION_CANCELLED,
|
|
||||||
WILL_HANDLE_LOAD;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_POLICY_DECISION_TYPE_")]
|
|
||||||
public enum PolicyDecisionType {
|
|
||||||
NAVIGATION_ACTION,
|
|
||||||
NEW_WINDOW_ACTION,
|
|
||||||
RESPONSE
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_POLICY_ERROR_")]
|
|
||||||
public enum PolicyError {
|
|
||||||
FAILED,
|
|
||||||
CANNOT_SHOW_MIME_TYPE,
|
|
||||||
CANNOT_SHOW_URI,
|
|
||||||
FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE,
|
|
||||||
CANNOT_USE_RESTRICTED_PORT;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PRINT_ERROR_")]
|
|
||||||
public enum PrintError {
|
|
||||||
GENERAL,
|
|
||||||
PRINTER_NOT_FOUND,
|
|
||||||
INVALID_PAGE_RANGE;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PRINT_OPERATION_RESPONSE_")]
|
|
||||||
public enum PrintOperationResponse {
|
|
||||||
PRINT,
|
|
||||||
CANCEL
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SCRIPT_DIALOG_")]
|
|
||||||
public enum ScriptDialogType {
|
|
||||||
ALERT,
|
|
||||||
CONFIRM,
|
|
||||||
PROMPT
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", instance_pos = 1.9)]
|
|
||||||
public delegate void URISchemeRequestCallback (WebKit.URISchemeRequest request);
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_COPY")]
|
|
||||||
public const string EDITING_COMMAND_COPY;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_CUT")]
|
|
||||||
public const string EDITING_COMMAND_CUT;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_PASTE")]
|
|
||||||
public const string EDITING_COMMAND_PASTE;
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
atk
|
|
||||||
gio-2.0
|
|
||||||
cairo
|
|
||||||
pango
|
|
||||||
gdk-pixbuf-2.0
|
|
||||||
gdk-3.0
|
|
||||||
gtk+-3.0
|
|
||||||
libsoup-2.4
|
|
|
@ -1,998 +0,0 @@
|
||||||
/* webkit2gtk-4.0.vapi generated by vapigen, do not modify. */
|
|
||||||
|
|
||||||
[CCode (cprefix = "WebKit", gir_namespace = "WebKit2", gir_version = "4.0", lower_case_cprefix = "webkit_")]
|
|
||||||
namespace WebKit {
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_authentication_request_get_type ()")]
|
|
||||||
public class AuthenticationRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected AuthenticationRequest ();
|
|
||||||
public void authenticate (WebKit.Credential? credential);
|
|
||||||
public bool can_save_credentials ();
|
|
||||||
public void cancel ();
|
|
||||||
public unowned string get_host ();
|
|
||||||
public uint get_port ();
|
|
||||||
public WebKit.Credential get_proposed_credential ();
|
|
||||||
public unowned string get_realm ();
|
|
||||||
public WebKit.AuthenticationScheme get_scheme ();
|
|
||||||
public bool is_for_proxy ();
|
|
||||||
public bool is_retry ();
|
|
||||||
public signal void cancelled ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_back_forward_list_get_type ()")]
|
|
||||||
public class BackForwardList : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected BackForwardList ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_back_item ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_back_list ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_back_list_with_limit (uint limit);
|
|
||||||
public unowned WebKit.BackForwardListItem get_current_item ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_forward_item ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_forward_list ();
|
|
||||||
public GLib.List<weak WebKit.BackForwardListItem> get_forward_list_with_limit (uint limit);
|
|
||||||
public uint get_length ();
|
|
||||||
public unowned WebKit.BackForwardListItem get_nth_item (int index);
|
|
||||||
public signal void changed (WebKit.BackForwardListItem? item_added, void* items_removed);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_back_forward_list_item_get_type ()")]
|
|
||||||
public class BackForwardListItem : GLib.InitiallyUnowned {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected BackForwardListItem ();
|
|
||||||
public unowned string get_original_uri ();
|
|
||||||
public unowned string get_title ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_context_menu_get_type ()")]
|
|
||||||
public class ContextMenu : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenu ();
|
|
||||||
public void append (WebKit.ContextMenuItem item);
|
|
||||||
public unowned WebKit.ContextMenuItem first ();
|
|
||||||
public unowned WebKit.ContextMenuItem get_item_at_position (uint position);
|
|
||||||
public unowned GLib.List<WebKit.ContextMenuItem> get_items ();
|
|
||||||
public uint get_n_items ();
|
|
||||||
public void insert (WebKit.ContextMenuItem item, int position);
|
|
||||||
public unowned WebKit.ContextMenuItem last ();
|
|
||||||
public void move_item (WebKit.ContextMenuItem item, int position);
|
|
||||||
public void prepend (WebKit.ContextMenuItem item);
|
|
||||||
public void remove (WebKit.ContextMenuItem item);
|
|
||||||
public void remove_all ();
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenu.with_items (GLib.List<WebKit.ContextMenuItem> items);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_context_menu_item_get_type ()")]
|
|
||||||
public class ContextMenuItem : GLib.InitiallyUnowned {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem (Gtk.Action action);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.from_stock_action (WebKit.ContextMenuAction action);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.from_stock_action_with_label (WebKit.ContextMenuAction action, string label);
|
|
||||||
public unowned Gtk.Action get_action ();
|
|
||||||
public WebKit.ContextMenuAction get_stock_action ();
|
|
||||||
public unowned WebKit.ContextMenu get_submenu ();
|
|
||||||
public bool is_separator ();
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.separator ();
|
|
||||||
public void set_submenu (WebKit.ContextMenu? submenu);
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public ContextMenuItem.with_submenu (string label, WebKit.ContextMenu submenu);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_cookie_manager_get_type ()")]
|
|
||||||
public class CookieManager : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected CookieManager ();
|
|
||||||
public void delete_all_cookies ();
|
|
||||||
public void delete_cookies_for_domain (string domain);
|
|
||||||
public async WebKit.CookieAcceptPolicy get_accept_policy (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public async string[] get_domains_with_cookies (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public void set_accept_policy (WebKit.CookieAcceptPolicy policy);
|
|
||||||
public void set_persistent_storage (string filename, WebKit.CookiePersistentStorage storage);
|
|
||||||
public signal void changed ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_credential_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class Credential {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public Credential (string username, string password, WebKit.CredentialPersistence persistence);
|
|
||||||
public WebKit.Credential copy ();
|
|
||||||
public void free ();
|
|
||||||
public unowned string get_password ();
|
|
||||||
public WebKit.CredentialPersistence get_persistence ();
|
|
||||||
public unowned string get_username ();
|
|
||||||
public bool has_password ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_download_get_type ()")]
|
|
||||||
public class Download : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected Download ();
|
|
||||||
public void cancel ();
|
|
||||||
public unowned string get_destination ();
|
|
||||||
public double get_elapsed_time ();
|
|
||||||
public double get_estimated_progress ();
|
|
||||||
public uint64 get_received_data_length ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public unowned WebKit.WebView get_web_view ();
|
|
||||||
public void set_destination (string uri);
|
|
||||||
public string destination { get; }
|
|
||||||
public double estimated_progress { get; }
|
|
||||||
public WebKit.URIResponse response { get; }
|
|
||||||
public signal void created_destination (string destination);
|
|
||||||
public virtual signal bool decide_destination (string suggested_filename);
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
public signal void received_data (uint64 data_length);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_favicon_database_get_type ()")]
|
|
||||||
public class FaviconDatabase : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FaviconDatabase ();
|
|
||||||
public void clear ();
|
|
||||||
public async Cairo.Surface get_favicon (string page_uri, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public string get_favicon_uri (string page_uri);
|
|
||||||
public signal void favicon_changed (string page_uri, string favicon_uri);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_file_chooser_request_get_type ()")]
|
|
||||||
public class FileChooserRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FileChooserRequest ();
|
|
||||||
public void cancel ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_mime_types ();
|
|
||||||
public unowned Gtk.FileFilter get_mime_types_filter ();
|
|
||||||
public bool get_select_multiple ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_selected_files ();
|
|
||||||
public void select_files ([CCode (array_length = false, array_null_terminated = true)] string[] files);
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public Gtk.FileFilter filter { owned get; }
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public string[] mime_types { get; }
|
|
||||||
public bool select_multiple { get; }
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public string[] selected_files { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_find_controller_get_type ()")]
|
|
||||||
public class FindController : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FindController ();
|
|
||||||
public void count_matches (string search_text, uint32 find_options, uint max_match_count);
|
|
||||||
public uint get_max_match_count ();
|
|
||||||
public uint32 get_options ();
|
|
||||||
public unowned string get_search_text ();
|
|
||||||
public unowned WebKit.WebView get_web_view ();
|
|
||||||
public void search (string search_text, uint32 find_options, uint max_match_count);
|
|
||||||
public void search_finish ();
|
|
||||||
public void search_next ();
|
|
||||||
public void search_previous ();
|
|
||||||
public uint max_match_count { get; }
|
|
||||||
public WebKit.FindOptions options { get; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public string text { owned get; }
|
|
||||||
public WebKit.WebView web_view { get; construct; }
|
|
||||||
public signal void counted_matches (uint match_count);
|
|
||||||
public signal void failed_to_find_text ();
|
|
||||||
public signal void found_text (uint match_count);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_form_submission_request_get_type ()")]
|
|
||||||
public class FormSubmissionRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected FormSubmissionRequest ();
|
|
||||||
public unowned GLib.HashTable<void*,void*> get_text_fields ();
|
|
||||||
public void submit ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_geolocation_permission_request_get_type ()")]
|
|
||||||
public class GeolocationPermissionRequest : GLib.Object, WebKit.PermissionRequest {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected GeolocationPermissionRequest ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_hit_test_result_get_type ()")]
|
|
||||||
public class HitTestResult : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected HitTestResult ();
|
|
||||||
public bool context_is_editable ();
|
|
||||||
public bool context_is_image ();
|
|
||||||
public bool context_is_link ();
|
|
||||||
public bool context_is_media ();
|
|
||||||
public bool context_is_scrollbar ();
|
|
||||||
public uint get_context ();
|
|
||||||
public unowned string get_image_uri ();
|
|
||||||
public unowned string get_link_label ();
|
|
||||||
public unowned string get_link_title ();
|
|
||||||
public unowned string get_link_uri ();
|
|
||||||
public unowned string get_media_uri ();
|
|
||||||
public uint context { get; construct; }
|
|
||||||
public string image_uri { get; construct; }
|
|
||||||
public string link_label { get; construct; }
|
|
||||||
public string link_title { get; construct; }
|
|
||||||
public string link_uri { get; construct; }
|
|
||||||
public string media_uri { get; construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", ref_function = "webkit_javascript_result_ref", type_id = "webkit_javascript_result_get_type ()", unref_function = "webkit_javascript_result_unref")]
|
|
||||||
[Compact]
|
|
||||||
public class JavascriptResult {
|
|
||||||
public WebKit.JavascriptResult @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", ref_function = "webkit_mime_info_ref", type_id = "webkit_mime_info_get_type ()", unref_function = "webkit_mime_info_unref")]
|
|
||||||
[Compact]
|
|
||||||
public class MimeInfo {
|
|
||||||
public unowned string get_description ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_extensions ();
|
|
||||||
public unowned string get_mime_type ();
|
|
||||||
public WebKit.MimeInfo @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_navigation_action_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class NavigationAction {
|
|
||||||
public WebKit.NavigationAction copy ();
|
|
||||||
public void free ();
|
|
||||||
public uint get_modifiers ();
|
|
||||||
public uint get_mouse_button ();
|
|
||||||
public WebKit.NavigationType get_navigation_type ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public bool is_user_gesture ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_navigation_policy_decision_get_type ()")]
|
|
||||||
public class NavigationPolicyDecision : WebKit.PolicyDecision {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected NavigationPolicyDecision ();
|
|
||||||
public unowned string get_frame_name ();
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public uint get_modifiers ();
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public uint get_mouse_button ();
|
|
||||||
public unowned WebKit.NavigationAction get_navigation_action ();
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public WebKit.NavigationType get_navigation_type ();
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public string frame_name { get; }
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public uint modifiers { get; }
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public uint mouse_button { get; }
|
|
||||||
public WebKit.NavigationAction navigation_action { get; }
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public WebKit.NavigationType navigation_type { get; }
|
|
||||||
[Deprecated (since = "2.6")]
|
|
||||||
public WebKit.URIRequest request { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_plugin_get_type ()")]
|
|
||||||
public class Plugin : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected Plugin ();
|
|
||||||
public unowned string get_description ();
|
|
||||||
public unowned GLib.List<WebKit.MimeInfo> get_mime_info_list ();
|
|
||||||
public unowned string get_name ();
|
|
||||||
public unowned string get_path ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_policy_decision_get_type ()")]
|
|
||||||
public abstract class PolicyDecision : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected PolicyDecision ();
|
|
||||||
public void download ();
|
|
||||||
public void ignore ();
|
|
||||||
public void use ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_print_operation_get_type ()")]
|
|
||||||
public class PrintOperation : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public PrintOperation (WebKit.WebView web_view);
|
|
||||||
public unowned Gtk.PageSetup get_page_setup ();
|
|
||||||
public unowned Gtk.PrintSettings get_print_settings ();
|
|
||||||
public void print ();
|
|
||||||
public WebKit.PrintOperationResponse run_dialog (Gtk.Window? parent);
|
|
||||||
public void set_page_setup (Gtk.PageSetup page_setup);
|
|
||||||
public void set_print_settings (Gtk.PrintSettings print_settings);
|
|
||||||
public Gtk.PageSetup page_setup { get; set; }
|
|
||||||
public Gtk.PrintSettings print_settings { get; set; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public WebKit.WebView web_view { owned get; construct; }
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_response_policy_decision_get_type ()")]
|
|
||||||
public class ResponsePolicyDecision : WebKit.PolicyDecision {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected ResponsePolicyDecision ();
|
|
||||||
public unowned WebKit.URIRequest get_request ();
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public bool is_mime_type_supported ();
|
|
||||||
public WebKit.URIRequest request { get; }
|
|
||||||
public WebKit.URIResponse response { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "webkit_script_dialog_get_type ()")]
|
|
||||||
[Compact]
|
|
||||||
public class ScriptDialog {
|
|
||||||
public void confirm_set_confirmed (bool confirmed);
|
|
||||||
public WebKit.ScriptDialogType get_dialog_type ();
|
|
||||||
public unowned string get_message ();
|
|
||||||
public unowned string prompt_get_default_text ();
|
|
||||||
public void prompt_set_text (string text);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_security_manager_get_type ()")]
|
|
||||||
public class SecurityManager : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected SecurityManager ();
|
|
||||||
public void register_uri_scheme_as_cors_enabled (string scheme);
|
|
||||||
public void register_uri_scheme_as_display_isolated (string scheme);
|
|
||||||
public void register_uri_scheme_as_empty_document (string scheme);
|
|
||||||
public void register_uri_scheme_as_local (string scheme);
|
|
||||||
public void register_uri_scheme_as_no_access (string scheme);
|
|
||||||
public void register_uri_scheme_as_secure (string scheme);
|
|
||||||
public bool uri_scheme_is_cors_enabled (string scheme);
|
|
||||||
public bool uri_scheme_is_display_isolated (string scheme);
|
|
||||||
public bool uri_scheme_is_empty_document (string scheme);
|
|
||||||
public bool uri_scheme_is_local (string scheme);
|
|
||||||
public bool uri_scheme_is_no_access (string scheme);
|
|
||||||
public bool uri_scheme_is_secure (string scheme);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_settings_get_type ()")]
|
|
||||||
public class Settings : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public Settings ();
|
|
||||||
public bool get_allow_modal_dialogs ();
|
|
||||||
public bool get_auto_load_images ();
|
|
||||||
public unowned string get_cursive_font_family ();
|
|
||||||
public unowned string get_default_charset ();
|
|
||||||
public unowned string get_default_font_family ();
|
|
||||||
public uint32 get_default_font_size ();
|
|
||||||
public uint32 get_default_monospace_font_size ();
|
|
||||||
public bool get_draw_compositing_indicators ();
|
|
||||||
public bool get_enable_accelerated_2d_canvas ();
|
|
||||||
public bool get_enable_caret_browsing ();
|
|
||||||
public bool get_enable_developer_extras ();
|
|
||||||
public bool get_enable_dns_prefetching ();
|
|
||||||
public bool get_enable_frame_flattening ();
|
|
||||||
public bool get_enable_fullscreen ();
|
|
||||||
public bool get_enable_html5_database ();
|
|
||||||
public bool get_enable_html5_local_storage ();
|
|
||||||
public bool get_enable_hyperlink_auditing ();
|
|
||||||
public bool get_enable_java ();
|
|
||||||
public bool get_enable_javascript ();
|
|
||||||
public bool get_enable_media_stream ();
|
|
||||||
public bool get_enable_mediasource ();
|
|
||||||
public bool get_enable_offline_web_application_cache ();
|
|
||||||
public bool get_enable_page_cache ();
|
|
||||||
public bool get_enable_plugins ();
|
|
||||||
public bool get_enable_private_browsing ();
|
|
||||||
public bool get_enable_resizable_text_areas ();
|
|
||||||
public bool get_enable_site_specific_quirks ();
|
|
||||||
public bool get_enable_smooth_scrolling ();
|
|
||||||
public bool get_enable_spatial_navigation ();
|
|
||||||
public bool get_enable_tabs_to_links ();
|
|
||||||
public bool get_enable_webaudio ();
|
|
||||||
public bool get_enable_webgl ();
|
|
||||||
public bool get_enable_write_console_messages_to_stdout ();
|
|
||||||
public bool get_enable_xss_auditor ();
|
|
||||||
public unowned string get_fantasy_font_family ();
|
|
||||||
public bool get_javascript_can_access_clipboard ();
|
|
||||||
public bool get_javascript_can_open_windows_automatically ();
|
|
||||||
public bool get_load_icons_ignoring_image_load_setting ();
|
|
||||||
public bool get_media_playback_allows_inline ();
|
|
||||||
public bool get_media_playback_requires_user_gesture ();
|
|
||||||
public uint32 get_minimum_font_size ();
|
|
||||||
public unowned string get_monospace_font_family ();
|
|
||||||
public unowned string get_pictograph_font_family ();
|
|
||||||
public bool get_print_backgrounds ();
|
|
||||||
public unowned string get_sans_serif_font_family ();
|
|
||||||
public unowned string get_serif_font_family ();
|
|
||||||
public unowned string get_user_agent ();
|
|
||||||
public bool get_zoom_text_only ();
|
|
||||||
public void set_allow_modal_dialogs (bool allowed);
|
|
||||||
public void set_auto_load_images (bool enabled);
|
|
||||||
public void set_cursive_font_family (string cursive_font_family);
|
|
||||||
public void set_default_charset (string default_charset);
|
|
||||||
public void set_default_font_family (string default_font_family);
|
|
||||||
public void set_default_font_size (uint32 font_size);
|
|
||||||
public void set_default_monospace_font_size (uint32 font_size);
|
|
||||||
public void set_draw_compositing_indicators (bool enabled);
|
|
||||||
public void set_enable_accelerated_2d_canvas (bool enabled);
|
|
||||||
public void set_enable_caret_browsing (bool enabled);
|
|
||||||
public void set_enable_developer_extras (bool enabled);
|
|
||||||
public void set_enable_dns_prefetching (bool enabled);
|
|
||||||
public void set_enable_frame_flattening (bool enabled);
|
|
||||||
public void set_enable_fullscreen (bool enabled);
|
|
||||||
public void set_enable_html5_database (bool enabled);
|
|
||||||
public void set_enable_html5_local_storage (bool enabled);
|
|
||||||
public void set_enable_hyperlink_auditing (bool enabled);
|
|
||||||
public void set_enable_java (bool enabled);
|
|
||||||
public void set_enable_javascript (bool enabled);
|
|
||||||
public void set_enable_media_stream (bool enabled);
|
|
||||||
public void set_enable_mediasource (bool enabled);
|
|
||||||
public void set_enable_offline_web_application_cache (bool enabled);
|
|
||||||
public void set_enable_page_cache (bool enabled);
|
|
||||||
public void set_enable_plugins (bool enabled);
|
|
||||||
public void set_enable_private_browsing (bool enabled);
|
|
||||||
public void set_enable_resizable_text_areas (bool enabled);
|
|
||||||
public void set_enable_site_specific_quirks (bool enabled);
|
|
||||||
public void set_enable_smooth_scrolling (bool enabled);
|
|
||||||
public void set_enable_spatial_navigation (bool enabled);
|
|
||||||
public void set_enable_tabs_to_links (bool enabled);
|
|
||||||
public void set_enable_webaudio (bool enabled);
|
|
||||||
public void set_enable_webgl (bool enabled);
|
|
||||||
public void set_enable_write_console_messages_to_stdout (bool enabled);
|
|
||||||
public void set_enable_xss_auditor (bool enabled);
|
|
||||||
public void set_fantasy_font_family (string fantasy_font_family);
|
|
||||||
public void set_javascript_can_access_clipboard (bool enabled);
|
|
||||||
public void set_javascript_can_open_windows_automatically (bool enabled);
|
|
||||||
public void set_load_icons_ignoring_image_load_setting (bool enabled);
|
|
||||||
public void set_media_playback_allows_inline (bool enabled);
|
|
||||||
public void set_media_playback_requires_user_gesture (bool enabled);
|
|
||||||
public void set_minimum_font_size (uint32 font_size);
|
|
||||||
public void set_monospace_font_family (string monospace_font_family);
|
|
||||||
public void set_pictograph_font_family (string pictograph_font_family);
|
|
||||||
public void set_print_backgrounds (bool print_backgrounds);
|
|
||||||
public void set_sans_serif_font_family (string sans_serif_font_family);
|
|
||||||
public void set_serif_font_family (string serif_font_family);
|
|
||||||
public void set_user_agent (string? user_agent);
|
|
||||||
public void set_user_agent_with_application_details (string? application_name, string? application_version);
|
|
||||||
public void set_zoom_text_only (bool zoom_text_only);
|
|
||||||
public bool allow_modal_dialogs { get; set construct; }
|
|
||||||
public bool auto_load_images { get; set construct; }
|
|
||||||
public string cursive_font_family { get; set construct; }
|
|
||||||
public string default_charset { get; set construct; }
|
|
||||||
public string default_font_family { get; set construct; }
|
|
||||||
public uint default_font_size { get; set construct; }
|
|
||||||
public uint default_monospace_font_size { get; set construct; }
|
|
||||||
public bool draw_compositing_indicators { get; set construct; }
|
|
||||||
public bool enable_accelerated_2d_canvas { get; set construct; }
|
|
||||||
public bool enable_caret_browsing { get; set construct; }
|
|
||||||
public bool enable_developer_extras { get; set construct; }
|
|
||||||
public bool enable_dns_prefetching { get; set construct; }
|
|
||||||
public bool enable_frame_flattening { get; set construct; }
|
|
||||||
public bool enable_fullscreen { get; set construct; }
|
|
||||||
public bool enable_html5_database { get; set construct; }
|
|
||||||
public bool enable_html5_local_storage { get; set construct; }
|
|
||||||
public bool enable_hyperlink_auditing { get; set construct; }
|
|
||||||
public bool enable_java { get; set construct; }
|
|
||||||
public bool enable_javascript { get; set construct; }
|
|
||||||
public bool enable_media_stream { get; set construct; }
|
|
||||||
public bool enable_mediasource { get; set construct; }
|
|
||||||
public bool enable_offline_web_application_cache { get; set construct; }
|
|
||||||
public bool enable_page_cache { get; set construct; }
|
|
||||||
public bool enable_plugins { get; set construct; }
|
|
||||||
public bool enable_private_browsing { get; set construct; }
|
|
||||||
public bool enable_resizable_text_areas { get; set construct; }
|
|
||||||
public bool enable_site_specific_quirks { get; set construct; }
|
|
||||||
public bool enable_smooth_scrolling { get; set construct; }
|
|
||||||
public bool enable_spatial_navigation { get; set construct; }
|
|
||||||
public bool enable_tabs_to_links { get; set construct; }
|
|
||||||
public bool enable_webaudio { get; set construct; }
|
|
||||||
public bool enable_webgl { get; set construct; }
|
|
||||||
public bool enable_write_console_messages_to_stdout { get; set construct; }
|
|
||||||
public bool enable_xss_auditor { get; set construct; }
|
|
||||||
public string fantasy_font_family { get; set construct; }
|
|
||||||
public bool javascript_can_access_clipboard { get; set construct; }
|
|
||||||
public bool javascript_can_open_windows_automatically { get; set construct; }
|
|
||||||
public bool load_icons_ignoring_image_load_setting { get; set construct; }
|
|
||||||
public bool media_playback_allows_inline { get; set construct; }
|
|
||||||
public bool media_playback_requires_user_gesture { get; set construct; }
|
|
||||||
public uint minimum_font_size { get; set construct; }
|
|
||||||
public string monospace_font_family { get; set construct; }
|
|
||||||
public string pictograph_font_family { get; set construct; }
|
|
||||||
public bool print_backgrounds { get; set construct; }
|
|
||||||
public string sans_serif_font_family { get; set construct; }
|
|
||||||
public string serif_font_family { get; set construct; }
|
|
||||||
public string user_agent { get; set construct; }
|
|
||||||
public bool zoom_text_only { get; set construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_request_get_type ()")]
|
|
||||||
public class URIRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public URIRequest (string uri);
|
|
||||||
public unowned Soup.MessageHeaders get_http_headers ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public void set_uri (string uri);
|
|
||||||
public string uri { get; set construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_response_get_type ()")]
|
|
||||||
public class URIResponse : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected URIResponse ();
|
|
||||||
public uint64 get_content_length ();
|
|
||||||
public unowned string get_mime_type ();
|
|
||||||
public uint get_status_code ();
|
|
||||||
public unowned string get_suggested_filename ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public uint64 content_length { get; }
|
|
||||||
public string mime_type { get; }
|
|
||||||
public uint status_code { get; }
|
|
||||||
public string suggested_filename { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_uri_scheme_request_get_type ()")]
|
|
||||||
public class URISchemeRequest : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected URISchemeRequest ();
|
|
||||||
public void finish (GLib.InputStream stream, int64 stream_length, string? mime_type);
|
|
||||||
public void finish_error (GLib.Error error);
|
|
||||||
public unowned string get_path ();
|
|
||||||
public unowned string get_scheme ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public unowned WebKit.WebView get_web_view ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_user_content_manager_get_type ()")]
|
|
||||||
public class UserContentManager : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public UserContentManager ();
|
|
||||||
public void add_script (WebKit.UserScript script);
|
|
||||||
public void add_style_sheet (WebKit.UserStyleSheet stylesheet);
|
|
||||||
public void remove_all_scripts ();
|
|
||||||
public void remove_all_style_sheets ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", ref_function = "webkit_user_script_ref", type_id = "webkit_user_script_get_type ()", unref_function = "webkit_user_script_unref")]
|
|
||||||
[Compact]
|
|
||||||
public class UserScript {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public UserScript (string source, WebKit.UserContentInjectedFrames injected_frames, WebKit.UserScriptInjectionTime injection_time, [CCode (array_length = false, array_null_terminated = true)] string[]? whitelist, [CCode (array_length = false, array_null_terminated = true)] string[]? blacklist);
|
|
||||||
public WebKit.UserScript @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", ref_function = "webkit_user_style_sheet_ref", type_id = "webkit_user_style_sheet_get_type ()", unref_function = "webkit_user_style_sheet_unref")]
|
|
||||||
[Compact]
|
|
||||||
public class UserStyleSheet {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
public UserStyleSheet (string source, WebKit.UserContentInjectedFrames injected_frames, WebKit.UserStyleLevel level, [CCode (array_length = false, array_null_terminated = true)] string[]? whitelist, [CCode (array_length = false, array_null_terminated = true)] string[]? blacklist);
|
|
||||||
public WebKit.UserStyleSheet @ref ();
|
|
||||||
public void unref ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_context_get_type ()")]
|
|
||||||
public class WebContext : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebContext ();
|
|
||||||
public void allow_tls_certificate_for_host (GLib.TlsCertificate certificate, string host);
|
|
||||||
public void clear_cache ();
|
|
||||||
public WebKit.Download download_uri (string uri);
|
|
||||||
public WebKit.CacheModel get_cache_model ();
|
|
||||||
public unowned WebKit.CookieManager get_cookie_manager ();
|
|
||||||
public static unowned WebKit.WebContext get_default ();
|
|
||||||
public unowned WebKit.FaviconDatabase get_favicon_database ();
|
|
||||||
public unowned string get_favicon_database_directory ();
|
|
||||||
public async GLib.List<WebKit.Plugin> get_plugins (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public WebKit.ProcessModel get_process_model ();
|
|
||||||
public unowned WebKit.SecurityManager get_security_manager ();
|
|
||||||
public bool get_spell_checking_enabled ();
|
|
||||||
[CCode (array_length = false, array_null_terminated = true)]
|
|
||||||
public unowned string[] get_spell_checking_languages ();
|
|
||||||
public WebKit.TLSErrorsPolicy get_tls_errors_policy ();
|
|
||||||
public void prefetch_dns (string hostname);
|
|
||||||
public void register_uri_scheme (string scheme, owned WebKit.URISchemeRequestCallback callback);
|
|
||||||
public void set_additional_plugins_directory (string directory);
|
|
||||||
public void set_cache_model (WebKit.CacheModel cache_model);
|
|
||||||
public void set_disk_cache_directory (string directory);
|
|
||||||
public void set_favicon_database_directory (string? path);
|
|
||||||
public void set_preferred_languages ([CCode (array_length = false, array_null_terminated = true)] string[]? languages);
|
|
||||||
public void set_process_model (WebKit.ProcessModel process_model);
|
|
||||||
public void set_spell_checking_enabled (bool enabled);
|
|
||||||
public void set_spell_checking_languages ([CCode (array_length = false, array_null_terminated = true)] string[] languages);
|
|
||||||
public void set_tls_errors_policy (WebKit.TLSErrorsPolicy policy);
|
|
||||||
public void set_web_extensions_directory (string directory);
|
|
||||||
public void set_web_extensions_initialization_user_data (GLib.Variant user_data);
|
|
||||||
public signal void download_started (WebKit.Download download);
|
|
||||||
public signal void initialize_web_extensions ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_inspector_get_type ()")]
|
|
||||||
public class WebInspector : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebInspector ();
|
|
||||||
public void close ();
|
|
||||||
public uint get_attached_height ();
|
|
||||||
public unowned string get_inspected_uri ();
|
|
||||||
public unowned WebKit.WebViewBase get_web_view ();
|
|
||||||
public bool is_attached ();
|
|
||||||
public void show ();
|
|
||||||
public uint attached_height { get; }
|
|
||||||
public string inspected_uri { get; }
|
|
||||||
[HasEmitter]
|
|
||||||
public signal bool attach ();
|
|
||||||
public signal bool bring_to_front ();
|
|
||||||
public signal void closed ();
|
|
||||||
[HasEmitter]
|
|
||||||
public signal bool detach ();
|
|
||||||
public signal bool open_window ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_resource_get_type ()")]
|
|
||||||
public class WebResource : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebResource ();
|
|
||||||
public async uint8[] get_data (GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public unowned WebKit.URIResponse get_response ();
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public WebKit.URIResponse response { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
public signal void failed (void* error);
|
|
||||||
public signal void finished ();
|
|
||||||
public signal void received_data (uint64 data_length);
|
|
||||||
public signal void sent_request (WebKit.URIRequest request, WebKit.URIResponse redirected_response);
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_view_get_type ()")]
|
|
||||||
public class WebView : WebKit.WebViewBase, Atk.Implementor, Gtk.Buildable {
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView ();
|
|
||||||
public async bool can_execute_editing_command (string command, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public bool can_go_back ();
|
|
||||||
public bool can_go_forward ();
|
|
||||||
public bool can_show_mime_type (string mime_type);
|
|
||||||
public WebKit.Download download_uri (string uri);
|
|
||||||
public void execute_editing_command (string command);
|
|
||||||
public unowned WebKit.BackForwardList get_back_forward_list ();
|
|
||||||
public unowned WebKit.WebContext get_context ();
|
|
||||||
public unowned string get_custom_charset ();
|
|
||||||
public double get_estimated_load_progress ();
|
|
||||||
public unowned Cairo.Surface get_favicon ();
|
|
||||||
public unowned WebKit.FindController get_find_controller ();
|
|
||||||
public unowned WebKit.WebInspector get_inspector ();
|
|
||||||
public unowned WebKit.WebResource get_main_resource ();
|
|
||||||
public uint64 get_page_id ();
|
|
||||||
public unowned WebKit.Settings get_settings ();
|
|
||||||
public async Cairo.Surface get_snapshot (WebKit.SnapshotRegion region, WebKit.SnapshotOptions options, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public unowned string get_title ();
|
|
||||||
public bool get_tls_info (out unowned GLib.TlsCertificate certificate, out GLib.TlsCertificateFlags errors);
|
|
||||||
public unowned string get_uri ();
|
|
||||||
public unowned WebKit.UserContentManager get_user_content_manager ();
|
|
||||||
public unowned WebKit.WindowProperties get_window_properties ();
|
|
||||||
public double get_zoom_level ();
|
|
||||||
public void go_back ();
|
|
||||||
public void go_forward ();
|
|
||||||
public void go_to_back_forward_list_item (WebKit.BackForwardListItem list_item);
|
|
||||||
public void load_alternate_html (string content, string content_uri, string? base_uri);
|
|
||||||
public void load_bytes (GLib.Bytes bytes, string? mime_type, string? encoding, string? base_uri);
|
|
||||||
public void load_html (string content, string? base_uri);
|
|
||||||
public void load_plain_text (string plain_text);
|
|
||||||
public void load_request (WebKit.URIRequest request);
|
|
||||||
public void load_uri (string uri);
|
|
||||||
public Gtk.Widget new_with_related_view ();
|
|
||||||
public void reload ();
|
|
||||||
public void reload_bypass_cache ();
|
|
||||||
public async WebKit.JavascriptResult run_javascript (string script, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public async WebKit.JavascriptResult run_javascript_from_gresource (string resource, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public async GLib.InputStream save (WebKit.SaveMode save_mode, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public async bool save_to_file (GLib.File file, WebKit.SaveMode save_mode, GLib.Cancellable? cancellable) throws GLib.Error;
|
|
||||||
public void set_custom_charset (string? charset);
|
|
||||||
public void set_settings (WebKit.Settings settings);
|
|
||||||
public void set_zoom_level (double zoom_level);
|
|
||||||
public void stop_loading ();
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView.with_context (WebKit.WebContext context);
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView.with_settings (WebKit.Settings settings);
|
|
||||||
[CCode (has_construct_function = false, type = "GtkWidget*")]
|
|
||||||
public WebView.with_user_content_manager (WebKit.UserContentManager user_content_manager);
|
|
||||||
public double estimated_load_progress { get; }
|
|
||||||
public void* favicon { get; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public bool is_loading { get; }
|
|
||||||
public WebKit.WebView related_view { construct; }
|
|
||||||
public WebKit.Settings settings { set construct; }
|
|
||||||
public string title { get; }
|
|
||||||
public string uri { get; }
|
|
||||||
public WebKit.UserContentManager user_content_manager { get; construct; }
|
|
||||||
[NoAccessorMethod]
|
|
||||||
public WebKit.WebContext web_context { owned get; construct; }
|
|
||||||
public double zoom_level { get; set; }
|
|
||||||
public virtual signal bool authenticate (WebKit.AuthenticationRequest request);
|
|
||||||
public virtual signal void close ();
|
|
||||||
public virtual signal bool context_menu (WebKit.ContextMenu context_menu, Gdk.Event event, WebKit.HitTestResult hit_test_result);
|
|
||||||
public virtual signal void context_menu_dismissed ();
|
|
||||||
public signal Gtk.Widget create (WebKit.NavigationAction navigation_action);
|
|
||||||
public virtual signal bool decide_policy (WebKit.PolicyDecision decision, WebKit.PolicyDecisionType type);
|
|
||||||
public virtual signal bool enter_fullscreen ();
|
|
||||||
public virtual signal void insecure_content_detected (WebKit.InsecureContentEvent event);
|
|
||||||
public virtual signal bool leave_fullscreen ();
|
|
||||||
public virtual signal void load_changed (WebKit.LoadEvent load_event);
|
|
||||||
public virtual signal bool load_failed (WebKit.LoadEvent load_event, string failing_uri, void* error);
|
|
||||||
public virtual signal bool load_failed_with_tls_errors (GLib.TlsCertificate certificate, GLib.TlsCertificateFlags errors, string host);
|
|
||||||
public virtual signal void mouse_target_changed (WebKit.HitTestResult hit_test_result, uint modifiers);
|
|
||||||
public virtual signal bool permission_request (WebKit.PermissionRequest permission_request);
|
|
||||||
public virtual signal bool print (WebKit.PrintOperation print_operation);
|
|
||||||
public virtual signal void ready_to_show ();
|
|
||||||
public virtual signal void resource_load_started (WebKit.WebResource resource, WebKit.URIRequest request);
|
|
||||||
public virtual signal void run_as_modal ();
|
|
||||||
public virtual signal bool run_file_chooser (WebKit.FileChooserRequest request);
|
|
||||||
public virtual signal bool script_dialog (WebKit.ScriptDialog dialog);
|
|
||||||
public virtual signal void submit_form (WebKit.FormSubmissionRequest request);
|
|
||||||
public virtual signal bool web_process_crashed ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_web_view_base_get_type ()")]
|
|
||||||
public class WebViewBase : Gtk.Container, Atk.Implementor, Gtk.Buildable {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WebViewBase ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_window_properties_get_type ()")]
|
|
||||||
public class WindowProperties : GLib.Object {
|
|
||||||
[CCode (has_construct_function = false)]
|
|
||||||
protected WindowProperties ();
|
|
||||||
public bool get_fullscreen ();
|
|
||||||
public Gdk.Rectangle get_geometry ();
|
|
||||||
public bool get_locationbar_visible ();
|
|
||||||
public bool get_menubar_visible ();
|
|
||||||
public bool get_resizable ();
|
|
||||||
public bool get_scrollbars_visible ();
|
|
||||||
public bool get_statusbar_visible ();
|
|
||||||
public bool get_toolbar_visible ();
|
|
||||||
public bool fullscreen { get; construct; }
|
|
||||||
public Cairo.RectangleInt geometry { get; construct; }
|
|
||||||
public bool locationbar_visible { get; construct; }
|
|
||||||
public bool menubar_visible { get; construct; }
|
|
||||||
public bool resizable { get; construct; }
|
|
||||||
public bool scrollbars_visible { get; construct; }
|
|
||||||
public bool statusbar_visible { get; construct; }
|
|
||||||
public bool toolbar_visible { get; construct; }
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", type_id = "webkit_permission_request_get_type ()")]
|
|
||||||
public interface PermissionRequest : GLib.Object {
|
|
||||||
public abstract void allow ();
|
|
||||||
public abstract void deny ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_AUTHENTICATION_SCHEME_", type_id = "webkit_authentication_scheme_get_type ()")]
|
|
||||||
public enum AuthenticationScheme {
|
|
||||||
DEFAULT,
|
|
||||||
HTTP_BASIC,
|
|
||||||
HTTP_DIGEST,
|
|
||||||
HTML_FORM,
|
|
||||||
NTLM,
|
|
||||||
NEGOTIATE,
|
|
||||||
CLIENT_CERTIFICATE_REQUESTED,
|
|
||||||
SERVER_TRUST_EVALUATION_REQUESTED,
|
|
||||||
UNKNOWN
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_CACHE_MODEL_", type_id = "webkit_cache_model_get_type ()")]
|
|
||||||
public enum CacheModel {
|
|
||||||
DOCUMENT_VIEWER,
|
|
||||||
WEB_BROWSER,
|
|
||||||
DOCUMENT_BROWSER
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_CONTEXT_MENU_ACTION_", type_id = "webkit_context_menu_action_get_type ()")]
|
|
||||||
public enum ContextMenuAction {
|
|
||||||
NO_ACTION,
|
|
||||||
OPEN_LINK,
|
|
||||||
OPEN_LINK_IN_NEW_WINDOW,
|
|
||||||
DOWNLOAD_LINK_TO_DISK,
|
|
||||||
COPY_LINK_TO_CLIPBOARD,
|
|
||||||
OPEN_IMAGE_IN_NEW_WINDOW,
|
|
||||||
DOWNLOAD_IMAGE_TO_DISK,
|
|
||||||
COPY_IMAGE_TO_CLIPBOARD,
|
|
||||||
COPY_IMAGE_URL_TO_CLIPBOARD,
|
|
||||||
OPEN_FRAME_IN_NEW_WINDOW,
|
|
||||||
GO_BACK,
|
|
||||||
GO_FORWARD,
|
|
||||||
STOP,
|
|
||||||
RELOAD,
|
|
||||||
COPY,
|
|
||||||
CUT,
|
|
||||||
PASTE,
|
|
||||||
DELETE,
|
|
||||||
SELECT_ALL,
|
|
||||||
INPUT_METHODS,
|
|
||||||
UNICODE,
|
|
||||||
SPELLING_GUESS,
|
|
||||||
NO_GUESSES_FOUND,
|
|
||||||
IGNORE_SPELLING,
|
|
||||||
LEARN_SPELLING,
|
|
||||||
IGNORE_GRAMMAR,
|
|
||||||
FONT_MENU,
|
|
||||||
BOLD,
|
|
||||||
ITALIC,
|
|
||||||
UNDERLINE,
|
|
||||||
OUTLINE,
|
|
||||||
INSPECT_ELEMENT,
|
|
||||||
OPEN_VIDEO_IN_NEW_WINDOW,
|
|
||||||
OPEN_AUDIO_IN_NEW_WINDOW,
|
|
||||||
COPY_VIDEO_LINK_TO_CLIPBOARD,
|
|
||||||
COPY_AUDIO_LINK_TO_CLIPBOARD,
|
|
||||||
TOGGLE_MEDIA_CONTROLS,
|
|
||||||
TOGGLE_MEDIA_LOOP,
|
|
||||||
ENTER_VIDEO_FULLSCREEN,
|
|
||||||
MEDIA_PLAY,
|
|
||||||
MEDIA_PAUSE,
|
|
||||||
MEDIA_MUTE,
|
|
||||||
DOWNLOAD_VIDEO_TO_DISK,
|
|
||||||
DOWNLOAD_AUDIO_TO_DISK,
|
|
||||||
CUSTOM
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_COOKIE_POLICY_ACCEPT_", type_id = "webkit_cookie_accept_policy_get_type ()")]
|
|
||||||
public enum CookieAcceptPolicy {
|
|
||||||
ALWAYS,
|
|
||||||
NEVER,
|
|
||||||
NO_THIRD_PARTY
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_COOKIE_PERSISTENT_STORAGE_", type_id = "webkit_cookie_persistent_storage_get_type ()")]
|
|
||||||
public enum CookiePersistentStorage {
|
|
||||||
TEXT,
|
|
||||||
SQLITE
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_CREDENTIAL_PERSISTENCE_", type_id = "webkit_credential_persistence_get_type ()")]
|
|
||||||
public enum CredentialPersistence {
|
|
||||||
NONE,
|
|
||||||
FOR_SESSION,
|
|
||||||
PERMANENT
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_FIND_OPTIONS_", type_id = "webkit_find_options_get_type ()")]
|
|
||||||
[Flags]
|
|
||||||
public enum FindOptions {
|
|
||||||
NONE,
|
|
||||||
CASE_INSENSITIVE,
|
|
||||||
AT_WORD_STARTS,
|
|
||||||
TREAT_MEDIAL_CAPITAL_AS_WORD_START,
|
|
||||||
BACKWARDS,
|
|
||||||
WRAP_AROUND
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_HIT_TEST_RESULT_CONTEXT_", type_id = "webkit_hit_test_result_context_get_type ()")]
|
|
||||||
[Flags]
|
|
||||||
public enum HitTestResultContext {
|
|
||||||
DOCUMENT,
|
|
||||||
LINK,
|
|
||||||
IMAGE,
|
|
||||||
MEDIA,
|
|
||||||
EDITABLE,
|
|
||||||
SCROLLBAR
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_INSECURE_CONTENT_", type_id = "webkit_insecure_content_event_get_type ()")]
|
|
||||||
public enum InsecureContentEvent {
|
|
||||||
RUN,
|
|
||||||
DISPLAYED
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_LOAD_", type_id = "webkit_load_event_get_type ()")]
|
|
||||||
public enum LoadEvent {
|
|
||||||
STARTED,
|
|
||||||
REDIRECTED,
|
|
||||||
COMMITTED,
|
|
||||||
FINISHED
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_NAVIGATION_TYPE_", type_id = "webkit_navigation_type_get_type ()")]
|
|
||||||
public enum NavigationType {
|
|
||||||
LINK_CLICKED,
|
|
||||||
FORM_SUBMITTED,
|
|
||||||
BACK_FORWARD,
|
|
||||||
RELOAD,
|
|
||||||
FORM_RESUBMITTED,
|
|
||||||
OTHER
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_POLICY_DECISION_TYPE_", type_id = "webkit_policy_decision_type_get_type ()")]
|
|
||||||
public enum PolicyDecisionType {
|
|
||||||
NAVIGATION_ACTION,
|
|
||||||
NEW_WINDOW_ACTION,
|
|
||||||
RESPONSE
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PRINT_OPERATION_RESPONSE_", type_id = "webkit_print_operation_response_get_type ()")]
|
|
||||||
public enum PrintOperationResponse {
|
|
||||||
PRINT,
|
|
||||||
CANCEL
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PROCESS_MODEL_", type_id = "webkit_process_model_get_type ()")]
|
|
||||||
public enum ProcessModel {
|
|
||||||
SHARED_SECONDARY_PROCESS,
|
|
||||||
MULTIPLE_SECONDARY_PROCESSES
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SAVE_MODE_", type_id = "webkit_save_mode_get_type ()")]
|
|
||||||
public enum SaveMode {
|
|
||||||
MHTML
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SCRIPT_DIALOG_", type_id = "webkit_script_dialog_type_get_type ()")]
|
|
||||||
public enum ScriptDialogType {
|
|
||||||
ALERT,
|
|
||||||
CONFIRM,
|
|
||||||
PROMPT
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SNAPSHOT_OPTIONS_", type_id = "webkit_snapshot_options_get_type ()")]
|
|
||||||
[Flags]
|
|
||||||
public enum SnapshotOptions {
|
|
||||||
NONE,
|
|
||||||
INCLUDE_SELECTION_HIGHLIGHTING
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SNAPSHOT_REGION_", type_id = "webkit_snapshot_region_get_type ()")]
|
|
||||||
public enum SnapshotRegion {
|
|
||||||
VISIBLE,
|
|
||||||
FULL_DOCUMENT
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_TLS_ERRORS_POLICY_", type_id = "webkit_tls_errors_policy_get_type ()")]
|
|
||||||
public enum TLSErrorsPolicy {
|
|
||||||
IGNORE,
|
|
||||||
FAIL
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_USER_CONTENT_INJECT_", type_id = "webkit_user_content_injected_frames_get_type ()")]
|
|
||||||
public enum UserContentInjectedFrames {
|
|
||||||
ALL_FRAMES,
|
|
||||||
TOP_FRAME
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_", type_id = "webkit_user_script_injection_time_get_type ()")]
|
|
||||||
public enum UserScriptInjectionTime {
|
|
||||||
START,
|
|
||||||
END
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_USER_STYLE_LEVEL_", type_id = "webkit_user_style_level_get_type ()")]
|
|
||||||
public enum UserStyleLevel {
|
|
||||||
USER,
|
|
||||||
AUTHOR
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_DOWNLOAD_ERROR_")]
|
|
||||||
public errordomain DownloadError {
|
|
||||||
NETWORK,
|
|
||||||
CANCELLED_BY_USER,
|
|
||||||
DESTINATION;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_FAVICON_DATABASE_ERROR_")]
|
|
||||||
public errordomain FaviconDatabaseError {
|
|
||||||
NOT_INITIALIZED,
|
|
||||||
FAVICON_NOT_FOUND,
|
|
||||||
FAVICON_UNKNOWN;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_JAVASCRIPT_ERROR_SCRIPT_")]
|
|
||||||
public errordomain JavascriptError {
|
|
||||||
FAILED;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_NETWORK_ERROR_")]
|
|
||||||
public errordomain NetworkError {
|
|
||||||
FAILED,
|
|
||||||
TRANSPORT,
|
|
||||||
UNKNOWN_PROTOCOL,
|
|
||||||
CANCELLED,
|
|
||||||
FILE_DOES_NOT_EXIST;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PLUGIN_ERROR_")]
|
|
||||||
public errordomain PluginError {
|
|
||||||
FAILED,
|
|
||||||
CANNOT_FIND_PLUGIN,
|
|
||||||
CANNOT_LOAD_PLUGIN,
|
|
||||||
JAVA_UNAVAILABLE,
|
|
||||||
CONNECTION_CANCELLED,
|
|
||||||
WILL_HANDLE_LOAD;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_POLICY_ERROR_")]
|
|
||||||
public errordomain PolicyError {
|
|
||||||
FAILED,
|
|
||||||
CANNOT_SHOW_MIME_TYPE,
|
|
||||||
CANNOT_SHOW_URI,
|
|
||||||
FRAME_LOAD_INTERRUPTED_BY_POLICY_CHANGE,
|
|
||||||
CANNOT_USE_RESTRICTED_PORT;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_PRINT_ERROR_")]
|
|
||||||
public errordomain PrintError {
|
|
||||||
GENERAL,
|
|
||||||
PRINTER_NOT_FOUND,
|
|
||||||
INVALID_PAGE_RANGE;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cprefix = "WEBKIT_SNAPSHOT_ERROR_FAILED_TO_")]
|
|
||||||
public errordomain SnapshotError {
|
|
||||||
CREATE;
|
|
||||||
public static GLib.Quark quark ();
|
|
||||||
}
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", instance_pos = 1.9)]
|
|
||||||
public delegate void URISchemeRequestCallback (WebKit.URISchemeRequest request);
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_COPY")]
|
|
||||||
public const string EDITING_COMMAND_COPY;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_CUT")]
|
|
||||||
public const string EDITING_COMMAND_CUT;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_PASTE")]
|
|
||||||
public const string EDITING_COMMAND_PASTE;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_REDO")]
|
|
||||||
public const string EDITING_COMMAND_REDO;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_SELECT_ALL")]
|
|
||||||
public const string EDITING_COMMAND_SELECT_ALL;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_EDITING_COMMAND_UNDO")]
|
|
||||||
public const string EDITING_COMMAND_UNDO;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_MAJOR_VERSION")]
|
|
||||||
public const int MAJOR_VERSION;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_MICRO_VERSION")]
|
|
||||||
public const int MICRO_VERSION;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h", cname = "WEBKIT_MINOR_VERSION")]
|
|
||||||
public const int MINOR_VERSION;
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h")]
|
|
||||||
public static uint get_major_version ();
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h")]
|
|
||||||
public static uint get_micro_version ();
|
|
||||||
[CCode (cheader_filename = "webkit2/webkit2.h")]
|
|
||||||
public static uint get_minor_version ();
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user