[gnome-documents/wip/rishi/split-view: 9/15] mainToolbar: Add a stack switcher for switching between the views



commit 9d0920f76604669c8247c876384b1fa976a64b3f
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 6 14:37:59 2014 +0200

    mainToolbar: Add a stack switcher for switching between the views
    
    https://bugzilla.gnome.org/show_bug.cgi?id=686461

 src/embed.js       |    2 +-
 src/mainToolbar.js |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index f3c1773..f3588de 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -440,7 +440,7 @@ const Embed = new Lang.Class({
             this._toolbar.widget.destroy();
 
         // pack the toolbar
-        this._toolbar = new MainToolbar.OverviewToolbar(this._stackOverlay);
+        this._toolbar = new MainToolbar.OverviewToolbar(this._stackOverlay, this._stack);
         this._titlebar.add(this._toolbar.widget);
 
         this._spinnerBox.stop();
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 4835f8f..11c4e42 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -94,7 +94,7 @@ const OverviewToolbar = new Lang.Class({
     Name: 'OverviewToolbar',
     Extends: MainToolbar,
 
-    _init: function(overlay) {
+    _init: function(overlay, stack) {
         this._overlay = overlay;
         this._collBackButton = null;
         this._collectionId = 0;
@@ -111,6 +111,9 @@ const OverviewToolbar = new Lang.Class({
         this._selectionMenu = new Gtk.MenuButton({ menu_model: selectionMenu });
         this._selectionMenu.get_style_context().add_class('selection-menu');
 
+        this._stackSwitcher = new Gtk.StackSwitcher({ no_show_all: true,
+                                                      stack: stack });
+
         // setup listeners to mode changes that affect the toolbar layout
         this._selectionModeId = Application.selectionController.connect('selection-mode-changed',
             Lang.bind(this, this._resetToolbarMode));
@@ -235,6 +238,7 @@ const OverviewToolbar = new Lang.Class({
 
     _populateForOverview: function() {
         this.toolbar.set_show_close_button(true);
+        this.toolbar.set_custom_title(this._stackSwitcher);
         this._checkCollectionBackButton();
 
         let selectionButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'object-select-symbolic' 
}),


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