[gnome-documents] mainToolbar: Disable headerbar controls when there are no documents
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] mainToolbar: Disable headerbar controls when there are no documents
- Date: Mon, 25 Jan 2016 17:53:30 +0000 (UTC)
commit e97245fa35b2bf9b525ed736574d71e0404f6d2d
Author: Alessandro Bono <abono gnome org>
Date: Sat Nov 7 16:06:41 2015 +0100
mainToolbar: Disable headerbar controls when there are no documents
https://bugzilla.gnome.org/show_bug.cgi?id=756014
src/mainToolbar.js | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index e249536..174e15c 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -114,6 +114,7 @@ const OverviewToolbar = new Lang.Class({
this._viewSettingsId = 0;
this._activeCollection = null;
this._infoUpdatedId = 0;
+ this._countChangedId = 0;
this.parent();
@@ -286,6 +287,11 @@ const OverviewToolbar = new Lang.Class({
this._viewMenuButton = null;
this.toolbar.set_custom_title(null);
+ if (this._countChangedId != 0) {
+ Application.offsetDocumentsController.disconnect(this._countChangedId);
+ this._countChangedId = 0;
+ }
+
if (this._collectionId != 0) {
Application.documentManager.disconnect(this._collectionId);
this._collectionId = 0;
@@ -323,6 +329,14 @@ const OverviewToolbar = new Lang.Class({
this._setToolbarTitle();
this.toolbar.show_all();
+ this._countChangedId = Application.offsetDocumentsController.connect('item-count-changed',
Lang.bind(this,
+ function(controller, count) {
+ this.toolbar.foreach(Lang.bind(this,
+ function(child) {
+ child.set_sensitive(count != 0);
+ }));
+ }));
+
if (Application.searchController.getString() != '')
Application.application.change_action_state('search', GLib.Variant.new('b', true));
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]