[meld] dirdiff, filediff: Fix sourcemap revealer behaviour



commit c24a1d9b95a62d0c33147872d7a1eddf587719dd
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Feb 19 08:28:38 2021 +1000

    dirdiff, filediff: Fix sourcemap revealer behaviour
    
    Without these additional revealers, the sourcemap visibility toggle
    shows a very unpleasant bump at the end while the dummy toolbar and
    statusbar elements are hidden.

 meld/dirdiff.py               | 19 ++++++++++++-------
 meld/filediff.py              | 21 ++++++++++++++-------
 meld/resources/ui/dirdiff.ui  | 16 ++++++++++++----
 meld/resources/ui/filediff.ui | 32 ++++++++++++++++++++++++--------
 4 files changed, 62 insertions(+), 26 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index d9b2c26c..fd7e97cc 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -373,12 +373,12 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
     vbox0 = Gtk.Template.Child()
     vbox1 = Gtk.Template.Child()
     vbox2 = Gtk.Template.Child()
-    dummy_toolbar_overview_map = Gtk.Template.Child()
     dummy_toolbar_linkmap0 = Gtk.Template.Child()
     dummy_toolbar_linkmap1 = Gtk.Template.Child()
     file_toolbar0 = Gtk.Template.Child()
     file_toolbar1 = Gtk.Template.Child()
     file_toolbar2 = Gtk.Template.Child()
+    toolbar_sourcemap_revealer = Gtk.Template.Child()
 
     state_actions = {
         tree.STATE_NORMAL: ("normal", "folder-status-same"),
@@ -468,13 +468,18 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
                 "text-filters-changed", self.on_text_filters_changed)
         ]
 
-        # Handle overview map visibility binding
-        self.bind_property(
-            'show-overview-map', self.overview_map_revealer, 'reveal-child',
-            GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE,
+        # Handle overview map visibility binding. Because of how we use
+        # grid packing, we need two revealers here instead of the more
+        # obvious one.
+        revealers = (
+            self.toolbar_sourcemap_revealer,
+            self.overview_map_revealer,
         )
-        self.overview_map_revealer.bind_property(
-            'child-revealed', self.dummy_toolbar_overview_map, 'visible')
+        for revealer in revealers:
+            self.bind_property(
+                'show-overview-map', revealer, 'reveal-child',
+                GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE,
+            )
 
         map_widgets_into_lists(
             self,
diff --git a/meld/filediff.py b/meld/filediff.py
index 41cd14c2..048edd58 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -147,7 +147,6 @@ class FileDiff(Gtk.VBox, MeldDoc):
     dummy_toolbar_actiongutter3 = Gtk.Template.Child()
     dummy_toolbar_linkmap0 = Gtk.Template.Child()
     dummy_toolbar_linkmap1 = Gtk.Template.Child()
-    dummy_toolbar_sourcemap = Gtk.Template.Child()
     file_open_button0 = Gtk.Template.Child()
     file_open_button1 = Gtk.Template.Child()
     file_open_button2 = Gtk.Template.Child()
@@ -181,11 +180,13 @@ class FileDiff(Gtk.VBox, MeldDoc):
     statusbar0 = Gtk.Template.Child()
     statusbar1 = Gtk.Template.Child()
     statusbar2 = Gtk.Template.Child()
+    statusbar_sourcemap_revealer = Gtk.Template.Child()
     linkmap0 = Gtk.Template.Child()
     linkmap1 = Gtk.Template.Child()
     textview0 = Gtk.Template.Child()
     textview1 = Gtk.Template.Child()
     textview2 = Gtk.Template.Child()
+    toolbar_sourcemap_revealer = Gtk.Template.Child()
     vbox0 = Gtk.Template.Child()
     vbox1 = Gtk.Template.Child()
     vbox2 = Gtk.Template.Child()
@@ -370,13 +371,19 @@ class FileDiff(Gtk.VBox, MeldDoc):
 
         self.create_text_filters()
 
-        # Handle overview map visibility binding
-        self.bind_property(
-            'show-overview-map', self.sourcemap_revealer, 'reveal-child',
-            GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE,
+        # Handle overview map visibility binding. Because of how we use
+        # grid packing, we need three revealers here instead of the
+        # more obvious one.
+        revealers = (
+            self.toolbar_sourcemap_revealer,
+            self.sourcemap_revealer,
+            self.statusbar_sourcemap_revealer,
         )
-        self.sourcemap_revealer.bind_property(
-            'child-revealed', self.dummy_toolbar_sourcemap, 'visible')
+        for revealer in revealers:
+            self.bind_property(
+                'show-overview-map', revealer, 'reveal-child',
+                GObject.BindingFlags.DEFAULT | GObject.BindingFlags.SYNC_CREATE,
+            )
 
         # Handle overview map style mapping manually
         self.connect(
diff --git a/meld/resources/ui/dirdiff.ui b/meld/resources/ui/dirdiff.ui
index cdb47e19..d0abbf66 100644
--- a/meld/resources/ui/dirdiff.ui
+++ b/meld/resources/ui/dirdiff.ui
@@ -403,12 +403,20 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToolbar" id="dummy_toolbar_overview_map">
+          <object class="GtkRevealer" id="toolbar_sourcemap_revealer">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <style>
-              <class name="meld-notebook-toolbar"/>
-            </style>
+            <property name="reveal-child">True</property>
+            <property name="transition-type">GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT</property>
+            <child>
+              <object class="GtkToolbar" id="dummy_toolbar_overview_map">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">5</property>
diff --git a/meld/resources/ui/filediff.ui b/meld/resources/ui/filediff.ui
index 2cadb783..dbb3f629 100644
--- a/meld/resources/ui/filediff.ui
+++ b/meld/resources/ui/filediff.ui
@@ -596,12 +596,20 @@
           </packing>
         </child>
         <child>
-          <object class="GtkToolbar" id="dummy_toolbar_sourcemap">
+          <object class="GtkRevealer" id="toolbar_sourcemap_revealer">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <style>
-              <class name="meld-notebook-toolbar"/>
-            </style>
+            <property name="reveal-child">True</property>
+            <property name="transition-type">GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT</property>
+            <child>
+              <object class="GtkToolbar" id="dummy_toolbar_sourcemap">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-notebook-toolbar"/>
+                </style>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">9</property>
@@ -698,12 +706,20 @@
           </packing>
         </child>
         <child>
-          <object class="GtkLabel" id="dummy_statusbar_sourcemap">
+          <object class="GtkRevealer" id="statusbar_sourcemap_revealer">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <style>
-              <class name="meld-status-bar"/>
-            </style>
+            <property name="reveal-child">True</property>
+            <property name="transition-type">GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT</property>
+            <child>
+              <object class="GtkLabel" id="dummy_statusbar_sourcemap">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <style>
+                  <class name="meld-status-bar"/>
+                </style>
+              </object>
+            </child>
           </object>
           <packing>
             <property name="left_attach">9</property>


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