[gnome-documents] places: Don't use a switcher when there is only one page



commit 5da94839422a70d0ce20e4073e074ebbd1147525
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu May 21 17:48:16 2015 +0200

    places: Don't use a switcher when there is only one page
    
    https://bugzilla.gnome.org/show_bug.cgi?id=749685

 src/places.js |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/places.js b/src/places.js
index e5682d2..97732a4 100644
--- a/src/places.js
+++ b/src/places.js
@@ -59,10 +59,6 @@ const PlacesDialog = new Lang.Class({
                                       homogeneous: true });
         contentArea.pack_start(this._stack, true, true, 0);
 
-        let header = this.widget.get_header_bar();
-        let switcher = new Gtk.StackSwitcher({ stack: this._stack });
-        header.set_custom_title(switcher);
-
         let evDoc = this._model.get_document();
         let docHasLinks = false;
 
@@ -91,6 +87,16 @@ const PlacesDialog = new Lang.Class({
                 }));
             this._addPage(this._bookmarksPage);
         }
+
+        let pages = this._stack.get_children();
+        let header = this.widget.get_header_bar();
+
+        if (pages.length == 1) {
+            header.set_title(pages[0].name);
+        } else if (pages.length > 1) {
+            let switcher = new Gtk.StackSwitcher({ stack: this._stack });
+            header.set_custom_title(switcher);
+        }
     },
 
     _handleLink: function(link) {


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