[gnome-documents] mainToolbar: Show the collection's title in the toolbar



commit a86cf8ecdc6ff43ad59c8895515f6d074e39a202
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Mar 17 16:03:02 2015 +0100

    mainToolbar: Show the collection's title in the toolbar
    
    We need to unset the custom toolbar title so that the collection's name
    shows up as a label.
    
    Fall out from a437bdce009a06fddc064b4adb3a287bd4b9fdab
    
    https://bugzilla.gnome.org/show_bug.cgi?id=746366

 src/mainToolbar.js |   37 +++++++++++++++++++++++--------------
 1 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index bb615ef..5b11481 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013 Red Hat, Inc.
+ * Copyright (c) 2011, 2013, 2015 Red Hat, Inc.
  *
  * Gnome Documents is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by the
@@ -215,24 +215,33 @@ const OverviewToolbar = new Lang.Class({
         this.addSearchButton();
     },
 
-    _checkCollectionBackButton: function() {
+    _checkCollectionWidgets: function() {
+        let customTitle;
         let item = Application.documentManager.getActiveCollection();
 
-        if (item && !this._collBackButton) {
-            this._collBackButton = this.addBackButton();
-            this._collBackButton.show();
-            this._collBackButton.connect('clicked', Lang.bind(this,
-                function() {
-                    Application.documentManager.activatePreviousCollection();
-                }));
-        } else if (!item && this._collBackButton) {
-            this._collBackButton.destroy();
-            this._collBackButton = null;
+        if (item) {
+            customTitle = null;
+            if (!this._collBackButton) {
+                this._collBackButton = this.addBackButton();
+                this._collBackButton.show();
+                this._collBackButton.connect('clicked', Lang.bind(this,
+                    function() {
+                        Application.documentManager.activatePreviousCollection();
+                    }));
+            }
+        } else {
+            customTitle = this._stackSwitcher;
+            if (this._collBackButton) {
+                this._collBackButton.destroy();
+                this._collBackButton = null;
+            }
         }
+
+        this.toolbar.set_custom_title(customTitle);
     },
 
     _onActiveCollectionChanged: function() {
-        this._checkCollectionBackButton();
+        this._checkCollectionWidgets();
         this._setToolbarTitle();
         Application.application.change_action_state('search', GLib.Variant.new('b', false));
     },
@@ -240,7 +249,7 @@ const OverviewToolbar = new Lang.Class({
     _populateForOverview: function() {
         this.toolbar.set_show_close_button(true);
         this.toolbar.set_custom_title(this._stackSwitcher);
-        this._checkCollectionBackButton();
+        this._checkCollectionWidgets();
 
         let selectionButton = new Gtk.Button({ image: new Gtk.Image ({ icon_name: 'object-select-symbolic' 
}),
                                                tooltip_text: _("Select Items") });


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