[meld] Move notebook label UI to be full-width and hidden with only one tab



commit 133aaccfcb32ed7c5778fbbd8f76bf609d09ba35
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Fri Jan 4 10:10:56 2019 +1000

    Move notebook label UI to be full-width and hidden with only one tab
    
    This is the UI form used by basically every modern GTK+/GNOME-y MDI UI
    that I can find. It has its drawbacks (mainly that it's different to the
    browser MDI UI, which everyone uses), but it circumvents other issues
    such as us having very long labels in very small tabs.
    
    This fixes (even if indirectly) #21 and #263.

 meld/meldwindow.py  | 1 +
 meld/ui/notebook.py | 2 ++
 2 files changed, 3 insertions(+)
---
diff --git a/meld/meldwindow.py b/meld/meldwindow.py
index ed776226..76474bbb 100644
--- a/meld/meldwindow.py
+++ b/meld/meldwindow.py
@@ -505,6 +505,7 @@ class MeldWindow(Gtk.ApplicationWindow):
     def _append_page(self, page, icon):
         nbl = NotebookLabel(icon_name=icon, page=page)
         self.notebook.append_page(page, nbl)
+        self.notebook.child_set_property(page, 'tab-expand', True)
 
         # Change focus to the newly created page only if the user is on a
         # DirDiff or VcView page, or if it's a new tab page. This prevents
diff --git a/meld/ui/notebook.py b/meld/ui/notebook.py
index 47d37c84..acdadc9f 100644
--- a/meld/ui/notebook.py
+++ b/meld/ui/notebook.py
@@ -151,9 +151,11 @@ class MeldNotebook(Gtk.Notebook):
 
     def on_page_added(self, notebook, child, page_num, *args):
         child.connect("label-changed", self.on_label_changed)
+        self.props.show_tabs = self.get_n_pages() > 1
 
     def on_page_removed(self, notebook, child, page_num, *args):
         child.disconnect_by_func(self.on_label_changed)
+        self.props.show_tabs = self.get_n_pages() > 1
 
     def on_label_changed(self, page, text, tooltip):
         nbl = self.get_tab_label(page)


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