[gnome-documents] toolbar: show the last category/collection name in the main toolbar
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] toolbar: show the last category/collection name in the main toolbar
- Date: Fri, 28 Oct 2011 19:20:30 +0000 (UTC)
commit 7e12c21a283efa0c689e963e935e6d98effa1c40
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Oct 26 15:24:57 2011 -0400
toolbar: show the last category/collection name in the main toolbar
Now that we got rid of the search entry we can display the name of the
active where item in the main toolbar, as in the mockups.
src/filters.js | 5 ++++-
src/mainToolbar.js | 34 +++++++++++++++++++++++++++++-----
2 files changed, 33 insertions(+), 6 deletions(-)
---
diff --git a/src/filters.js b/src/filters.js
index 31bec0f..414e872 100644
--- a/src/filters.js
+++ b/src/filters.js
@@ -21,6 +21,8 @@
const Signals = imports.signals;
+const Global = imports.global;
+
function SearchFilterController() {
this._init();
};
@@ -50,7 +52,8 @@ function SideFilterController() {
SideFilterController.prototype = {
_init: function() {
- this._whereItem = null;
+ // intialize to last category
+ this._whereItem = Global.categoryManager.getActiveItem();
},
setActiveItem: function(controller, item) {
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 637985b..2a007dd 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -40,6 +40,7 @@ function MainToolbar() {
MainToolbar.prototype = {
_init: function() {
this._model = null;
+ this._whereId = 0;
this.widget = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
this.widget.get_style_context().add_class(Gtk.STYLE_CLASS_MENUBAR);
@@ -51,11 +52,16 @@ MainToolbar.prototype = {
},
_clearToolbar: function() {
+ this._model = null;
+
+ if (this._whereId != 0) {
+ Global.sideFilterController.disconnect(this._whereId);
+ this._whereId = 0;
+ }
+
this.widget.foreach(Lang.bind(this, function(widget) {
widget.destroy();
}));
-
- this._model = null;
},
_populateForOverview: function() {
@@ -77,16 +83,25 @@ MainToolbar.prototype = {
Gio.SettingsBindFlags.DEFAULT);
let box = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
- spacing: 0,
- hexpand: true });
+ spacing: 0 });
box.add(iconView);
box.add(listView);
let item = new Gtk.ToolItem();
- item.set_expand(true);
item.add(box);
this.widget.insert(item, 0);
+
+ let item2 = new Gtk.ToolItem();
+ this._whereLabel = new Gtk.Label({ margin_left: 12 });
+ item2.add(this._whereLabel);
+ this.widget.insert(item2, 1);
+
+ this._whereId =
+ Global.sideFilterController.connect('changed',
+ Lang.bind(this, this._onSideFilterChanged));
+ this._onSideFilterChanged();
+
this.widget.show_all();
},
@@ -151,6 +166,15 @@ MainToolbar.prototype = {
}
},
+ _onSideFilterChanged: function() {
+ let item = Global.sideFilterController.getWhereItem();
+
+ if (!item)
+ return;
+
+ this._whereLabel.set_markup(('<b>%s</b>').format(item.name));
+ },
+
_onWindowModeChanged: function() {
let mode = Global.modeController.getWindowMode();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]