[meld] Pack MsgAreas such that showing a single one works as intended



commit 11e1e19c2c63a858401c24fb143dbce96feafe17
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Jul 14 08:39:53 2009 +1000

    Pack MsgAreas such that showing a single one works as intended
    
    When packed into a gtk.Table, showing a single MsgArea will show blank
    space for other MsgAreas, rather than simply shrinking the associated
    gtk.TextView. This commit instead packs the MsgAreas into gtk.VBoxes with
    their associated gtk.TextView.

 data/ui/filediff.glade |  126 ++++++++++++++++++++++--------------------------
 meld/filediff.py       |    6 +-
 2 files changed, 60 insertions(+), 72 deletions(-)
---
diff --git a/data/ui/filediff.glade b/data/ui/filediff.glade
index a156e79..9c5f7f5 100644
--- a/data/ui/filediff.glade
+++ b/data/ui/filediff.glade
@@ -12,7 +12,7 @@
         <child>
           <widget class="GtkTable" id="table">
             <property name="visible">True</property>
-            <property name="n_rows">3</property>
+            <property name="n_rows">2</property>
             <property name="n_columns">7</property>
             <child>
               <placeholder/>
@@ -60,6 +60,18 @@
               </packing>
             </child>
             <child>
+              <widget class="GtkVBox" id="vbox0">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="Custom" id="msgarea_mgr0">
+                    <property name="visible">True</property>
+                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
+                </child>
+                <child>
               <widget class="GtkScrolledWindow" id="scrolledwindow0">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -80,11 +92,13 @@
                   </widget>
                 </child>
               </widget>
+                </child>
+              </widget>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="right_attach">2</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
               </packing>
             </child>
             <child>
@@ -126,6 +140,18 @@
               </packing>
             </child>
             <child>
+              <widget class="GtkVBox" id="vbox2">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="Custom" id="msgarea_mgr2">
+                    <property name="visible">True</property>
+                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
+                </child>
+                <child>
               <widget class="GtkScrolledWindow" id="scrolledwindow2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -142,14 +168,28 @@
                   </widget>
                 </child>
               </widget>
+                </child>
+              </widget>
               <packing>
                 <property name="left_attach">5</property>
                 <property name="right_attach">6</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
               </packing>
             </child>
             <child>
+              <widget class="GtkVBox" id="vbox1">
+                <property name="visible">True</property>
+                <child>
+                  <widget class="Custom" id="msgarea_mgr1">
+                    <property name="visible">True</property>
+                    <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
+                </child>
+                <child>
               <widget class="GtkScrolledWindow" id="scrolledwindow1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
@@ -166,11 +206,13 @@
                   </widget>
                 </child>
               </widget>
+                </child>
+              </widget>
               <packing>
                 <property name="left_attach">3</property>
                 <property name="right_attach">4</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
               </packing>
             </child>
             <child>
@@ -184,8 +226,8 @@
               <packing>
                 <property name="left_attach">6</property>
                 <property name="right_attach">7</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
@@ -207,8 +249,8 @@
               <packing>
                 <property name="left_attach">2</property>
                 <property name="right_attach">3</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
                 <property name="x_options">GTK_FILL</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
@@ -222,8 +264,8 @@
                 <signal name="button_press_event" handler="on_diffmap_button_press_event"/>
               </widget>
               <packing>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
+                <property name="top_attach">1</property>
+                <property name="bottom_attach">2</property>
                 <property name="x_options">GTK_FILL</property>
               </packing>
             </child>
@@ -244,66 +286,12 @@
               <packing>
                 <property name="left_attach">4</property>
                 <property name="right_attach">5</property>
-                <property name="top_attach">2</property>
-                <property name="bottom_attach">3</property>
-                <property name="x_options">GTK_FILL</property>
-                <property name="y_options">GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Custom" id="msgarea_mgr0">
-                <property name="visible">True</property>
-                <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
-              </widget>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="right_attach">2</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Custom" id="msgarea_mgr1">
-                <property name="visible">True</property>
-                <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
-              </widget>
-              <packing>
-                <property name="left_attach">3</property>
-                <property name="right_attach">4</property>
                 <property name="top_attach">1</property>
                 <property name="bottom_attach">2</property>
-                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
-              </packing>
-            </child>
-            <child>
-              <widget class="Custom" id="msgarea_mgr2">
-                <property name="visible">True</property>
-                <property name="creation_function">meld.ui.msgarea.msgarea_mgr_create</property>
-              </widget>
-              <packing>
-                <property name="left_attach">5</property>
-                <property name="right_attach">6</property>
-                <property name="top_attach">1</property>
-                <property name="bottom_attach">2</property>
-                <property name="y_options">GTK_SHRINK | GTK_FILL</property>
+                <property name="x_options">GTK_FILL</property>
+                <property name="y_options">GTK_FILL</property>
               </packing>
             </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
-            <child>
-              <placeholder/>
-            </child>
           </widget>
         </child>
         <child>
diff --git a/meld/filediff.py b/meld/filediff.py
index b6870c3..6356d25 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -104,7 +104,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         """
         melddoc.MeldDoc.__init__(self, prefs)
         gnomeglade.Component.__init__(self, paths.ui_dir("filediff.glade"), "filediff", srcviewer.override)
-        self.map_widgets_into_lists( ["textview", "fileentry", "diffmap", "scrolledwindow", "linkmap", "statusimage", "msgarea_mgr"] )
+        self.map_widgets_into_lists(["textview", "fileentry", "diffmap", "scrolledwindow", "linkmap", "statusimage", "msgarea_mgr", "vbox"])
         self._update_regexes()
         self.warned_bad_comparison = False
         for v in self.textview:
@@ -1085,12 +1085,12 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
         if n != self.num_panes and n in (1,2,3):
             self.num_panes = n
             toshow =  self.scrolledwindow[:n] + self.fileentry[:n]
-            toshow += self.msgarea_mgr[:n]
+            toshow += self.vbox[:n] + self.msgarea_mgr[:n]
             toshow += self.linkmap[:n-1] + self.diffmap[:n]
             map( lambda x: x.show(), toshow )
 
             tohide =  self.statusimage + self.scrolledwindow[n:] + self.fileentry[n:]
-            tohide += self.msgarea_mgr[n:]
+            tohide += self.vbox[n:] + self.msgarea_mgr[n:]
             tohide += self.linkmap[n-1:] + self.diffmap[n:]
             map( lambda x: x.hide(), tohide )
 



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