[PATCH 1/7] Only show tabs if there are more than 1



When doing individual diffs (eg 'meld filea fileb') there's no reason to
have the diff show up in a labeled tab.  Using tabs in the above example
wastes vertical screen space and adds clutter to the UI, especially
since the full file paths are already displayed in each pane's drop-down
menu.

Similarly, when doing a directory or a version-controlled diff it seems
cleaner to not always show tabs, particularly when first starting meld,
or when going through a series of diff tabs and only 1 exists.

Signed-off-by: Peter Tyser <ptyser gmail com>
---
 data/ui/meldapp.glade |    1 +
 meld/meldapp.py       |    8 ++++++++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/data/ui/meldapp.glade b/data/ui/meldapp.glade
index 220ad11..d91ad58 100644
--- a/data/ui/meldapp.glade
+++ b/data/ui/meldapp.glade
@@ -17,6 +17,7 @@
                 <property name="can_focus">True</property>
                 <property name="scrollable">True</property>
                 <property name="enable_popup">True</property>
+                <property name="show-tabs">False</property>
                 <signal name="switch_page" handler="on_switch_page"/>
               </widget>
               <packing>
diff --git a/meld/meldapp.py b/meld/meldapp.py
index 3f942ea..23e0d0f 100644
--- a/meld/meldapp.py
+++ b/meld/meldapp.py
@@ -474,6 +474,10 @@ class MeldApp(gnomeglade.Component):
             self.notebook.remove_page(i)
             if self.notebook.get_n_pages() == 0:
                 self.widget.set_title("Meld")
+
+            # Don't show tabs if we only have one of them
+            if self.notebook.get_n_pages() <= 1:
+                self.notebook.set_property("show-tabs", False)
         return response
 
     def on_file_changed(self, srcpage, filename):
@@ -492,6 +496,10 @@ class MeldApp(gnomeglade.Component):
         page.connect("create-diff", lambda obj,arg: self.append_diff(arg) )
         page.connect("status-changed", lambda junk,arg: self.statusbar.set_doc_status(arg) )
 
+        # Only show tabs if we have more than one of them
+        if self.notebook.get_n_pages() > 1:
+            self.notebook.set_property("show-tabs", True)
+
     def append_dirdiff(self, dirs, auto_compare=False):
         assert len(dirs) in (1,2,3)
         doc = dirdiff.DirDiff(self.prefs, len(dirs))
-- 
1.7.1.13.gcfb88



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