[gitg/wip/albfan/diff-long-lines] SourceView needs to be wrapped in a scroll view
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gitg/wip/albfan/diff-long-lines] SourceView needs to be wrapped in a scroll view
- Date: Sun, 31 Oct 2021 11:02:48 +0000 (UTC)
commit 008229e9c4798d2946aca6a9f6dc8742ce876741
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Sun Oct 31 12:02:33 2021 +0100
SourceView needs to be wrapped in a scroll view
libgitg/gitg-diff-view-file.vala | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-file.vala b/libgitg/gitg-diff-view-file.vala
index fc2ae1bd..7ac01345 100644
--- a/libgitg/gitg-diff-view-file.vala
+++ b/libgitg/gitg-diff-view-file.vala
@@ -36,31 +36,41 @@ class Gitg.DiffViewFile : Gtk.Grid
private Binding? d_vexpand_binding;
+ private DiffViewFileRenderer? _renderer;
+
+ private Gtk.ScrolledWindow? scrolled_window;
+
public DiffViewFileRenderer? renderer
{
owned get
{
- return d_revealer_content.get_child() as DiffViewFileRenderer;
+ return _renderer;
}
construct set
{
- var current = this.renderer;
-
- if (current != value)
+ if (_renderer != value)
{
+ _renderer = value;
if (d_vexpand_binding != null)
{
d_vexpand_binding.unbind();
d_vexpand_binding = null;
}
- if (current != null)
+ if (scrolled_window != null)
{
- d_revealer_content.remove(current);
+ d_revealer_content.remove(scrolled_window);
}
- d_revealer_content.add(value);
+ var scrolled_window = new Gtk.ScrolledWindow(null, null);
+ scrolled_window.set_policy (Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC);
+
+ scrolled_window.add (_renderer);
+ scrolled_window.set_border_width (5);
+ scrolled_window.show();
+
+ d_revealer_content.add(scrolled_window);
d_vexpand_binding = this.bind_property("vexpand", value, "vexpand",
BindingFlags.SYNC_CREATE);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]