[gitg/wip/remove-webkit] Remove additional unneeded scrolled window



commit 045ee52db3b3a2637a3bdbdd8eddc564a4e900a3
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Thu Aug 27 19:31:41 2015 +0200

    Remove additional unneeded scrolled window

 libgitg/gitg-diff-view.vala |    9 +++++++--
 plugins/diff/gitg-diff.vala |   30 ++++++++++++++++++++----------
 2 files changed, 27 insertions(+), 12 deletions(-)
---
diff --git a/libgitg/gitg-diff-view.vala b/libgitg/gitg-diff-view.vala
index fafab7c..14b3846 100644
--- a/libgitg/gitg-diff-view.vala
+++ b/libgitg/gitg-diff-view.vala
@@ -23,6 +23,9 @@ public class Gitg.DiffView : Gtk.Grid
        [GtkChild( name = "commit_details" )]
        private Gitg.DiffViewCommitDetails d_commit_details;
 
+       [GtkChild( name = "scrolledwindow" )]
+       private Gtk.ScrolledWindow d_scrolledwindow;
+
        [GtkChild( name = "grid_files" )]
        private Gtk.Grid d_grid_files;
 
@@ -206,11 +209,13 @@ public class Gitg.DiffView : Gtk.Grid
                // the diff content
                if (d_diff == null && d_commit == null)
                {
-                       hide();
+                       d_commit_details.hide();
+                       d_scrolledwindow.hide();
                        return;
                }
 
-               show();
+               d_commit_details.show();
+               d_scrolledwindow.show();
 
                // Cancel running operations
                d_cancellable.cancel();
diff --git a/plugins/diff/gitg-diff.vala b/plugins/diff/gitg-diff.vala
index 76a9bed..fb03617 100644
--- a/plugins/diff/gitg-diff.vala
+++ b/plugins/diff/gitg-diff.vala
@@ -27,17 +27,16 @@ namespace GitgDiff
                public GitgExt.Application? application { owned get; construct set; }
                public GitgExt.History? history { owned get; construct set; }
 
-               private Gtk.ScrolledWindow d_sw;
                private Gitg.DiffView d_diff;
                private Gitg.WhenMapped d_whenMapped;
 
+               private ulong d_selection_changed_id;
+
                construct
                {
-                       d_sw = new Gtk.ScrolledWindow(null, null);
-                       d_sw.show();
-
                        d_diff = new Gitg.DiffView();
                        d_diff.show_parents = true;
+                       d_diff.show();
 
                        var settings = new Settings("org.gnome.gitg.preferences.diff");
 
@@ -79,16 +78,27 @@ namespace GitgDiff
                                      SettingsBindFlags.GET |
                                      SettingsBindFlags.SET);
 
-                       d_diff.show();
-
-                       d_sw.add(d_diff);
+                       d_diff.notify["visible"].connect(() => {
+                               stdout.printf(@"visible: $(d_diff.visible)\n");
+                       });
 
-                       d_whenMapped = new Gitg.WhenMapped(d_sw);
+                       d_whenMapped = new Gitg.WhenMapped(d_diff);
 
-                       history.selection_changed.connect(on_selection_changed);
+                       d_selection_changed_id = history.selection_changed.connect(on_selection_changed);
                        on_selection_changed(history);
                }
 
+               protected override void dispose()
+               {
+                       if (history != null && d_selection_changed_id != 0)
+                       {
+                               history.disconnect(d_selection_changed_id);
+                               d_selection_changed_id = 0;
+                       }
+
+                       base.dispose();
+               }
+
                public string id
                {
                        owned get { return "/org/gnome/gitg/Panels/Diff"; }
@@ -142,7 +152,7 @@ namespace GitgDiff
 
                public Gtk.Widget? widget
                {
-                       owned get { return d_sw; }
+                       owned get { return d_diff; }
                }
 
                public bool enabled


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