[gitg/wip/albfan/diff-long-lines: 3/3] TextView 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: 3/3] TextView needs to be wrapped in a scroll view
- Date: Tue, 9 Nov 2021 07:05:31 +0000 (UTC)
commit 17e8d52899d391ce6247a5dc3c705c83320e10c7
Author: Alberto Fanjul <albertofanjul gmail com>
Date: Tue Nov 9 08:05:17 2021 +0100
TextView needs to be wrapped in a scroll view
libgitg/gitg-diff-view-file.vala | 23 +++++++++++++----------
libgitg/resources/ui/gitg-diff-view-file.ui | 8 ++++++++
2 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/libgitg/gitg-diff-view-file.vala b/libgitg/gitg-diff-view-file.vala
index fc2ae1bd..112085c3 100644
--- a/libgitg/gitg-diff-view-file.vala
+++ b/libgitg/gitg-diff-view-file.vala
@@ -32,36 +32,39 @@ class Gitg.DiffViewFile : Gtk.Grid
[GtkChild( name = "revealer_content" )]
private unowned Gtk.Revealer d_revealer_content;
+ [GtkChild( name = "scrolled_window" )]
+ private unowned Gtk.ScrolledWindow? scrolled_window;
+
private bool d_expanded;
private Binding? d_vexpand_binding;
+ private DiffViewFileRenderer? _renderer;
+
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)
{
+ if (_renderer != null)
+ scrolled_window.remove(_renderer);
+
+ _renderer = value;
if (d_vexpand_binding != null)
{
d_vexpand_binding.unbind();
d_vexpand_binding = null;
}
- if (current != null)
- {
- d_revealer_content.remove(current);
- }
+ scrolled_window.add (_renderer);
- d_revealer_content.add(value);
- d_vexpand_binding = this.bind_property("vexpand", value, "vexpand",
BindingFlags.SYNC_CREATE);
+ d_vexpand_binding = this.bind_property("vexpand", _renderer, "vexpand",
BindingFlags.SYNC_CREATE);
}
}
}
diff --git a/libgitg/resources/ui/gitg-diff-view-file.ui b/libgitg/resources/ui/gitg-diff-view-file.ui
index a55a7c5f..3a7aa76b 100644
--- a/libgitg/resources/ui/gitg-diff-view-file.ui
+++ b/libgitg/resources/ui/gitg-diff-view-file.ui
@@ -57,6 +57,14 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="transition_type">slide-down</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ </object>
+ </child>
</object>
</child>
</template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]