[gnome-documents/gnome-3-4] window: move the search entry to WindowToolbar
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents/gnome-3-4] window: move the search entry to WindowToolbar
- Date: Mon, 14 May 2012 19:08:44 +0000 (UTC)
commit 4b664e0f32cef93305569a96ef8f7c6dc28d8388
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Mon May 14 13:45:35 2012 -0400
window: move the search entry to WindowToolbar
And show it automatically when we go back to overview with a search
string active.
src/embed.js | 4 +++-
src/mainToolbar.js | 12 ++++++++++++
src/mainWindow.js | 21 +++------------------
3 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index d09aac7..4f93438 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -103,7 +103,9 @@ ViewEmbed.prototype = {
// create the dropdown for the search bar, it's hidden by default
this._dropdownBox = new Searchbar.Dropdown();
this._overlayLayout.add(this._dropdownBox.actor,
- Clutter.BinAlignment.CENTER, Clutter.BinAlignment.START);
+ Clutter.BinAlignment.CENTER, Clutter.BinAlignment.FIXED);
+ this._dropdownBox.actor.add_constraint(new Clutter.BindConstraint({ source: this._toolbar.toolbarActor,
+ coordinate: Clutter.BindCoordinate.Y }));
// create the OSD toolbar for selected items, it's hidden by default
this._selectionToolbar = new Selections.SelectionToolbar();
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 56e0e03..ba142b0 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -334,5 +334,17 @@ OverviewToolbar.prototype = {
this.layout.pack_start = true;
this.layout.pack(this.searchbar.actor, false, true, false,
Clutter.BoxAlignment.CENTER, Clutter.BoxAlignment.START);
+ },
+
+ _onWindowModeChanged: function() {
+ MainToolbar.prototype._onWindowModeChanged.call(this);
+
+ let mode = Global.modeController.getWindowMode();
+
+ if (mode == WindowMode.WindowMode.PREVIEW)
+ this.searchbar.hide();
+ else if (mode == WindowMode.WindowMode.OVERVIEW &&
+ Global.searchController.getString() != '')
+ this.searchbar.show();
}
};
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 2cd45a0..04722e9 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -90,22 +90,12 @@ MainWindow.prototype = {
Global.modeController.connect('fullscreen-changed',
Lang.bind(this, this._onFullscreenChanged));
- Global.modeController.connect('window-mode-changed',
- Lang.bind(this, this._onWindowModeChanged));
- // the base layout is a vertical ClutterBox
- this._clutterBoxLayout = new Clutter.BoxLayout({ vertical: true });
- this._clutterBox = new Clutter.Box({ layout_manager: this._clutterBoxLayout });
- this._clutterBox.add_constraint(
+ this._embed = new Embed.ViewEmbed();
+ this._embed.actor.add_constraint(
new Clutter.BindConstraint({ coordinate: Clutter.BindCoordinate.SIZE,
source: stage }));
-
- stage.add_actor(this._clutterBox);
-
- this._embed = new Embed.ViewEmbed();
- this._clutterBox.add_actor(this._embed.actor);
- this._clutterBoxLayout.set_expand(this._embed.actor, true);
- this._clutterBoxLayout.set_fill(this._embed.actor, true, true);
+ stage.add_actor(this._embed.actor);
},
_saveWindowGeometry: function() {
@@ -152,11 +142,6 @@ MainWindow.prototype = {
Global.settings.set_boolean('window-maximized', maximized);
},
- _onWindowModeChanged: function() {
- if (Global.modeController.getWindowMode() == WindowMode.WindowMode.PREVIEW)
- this._embed._toolbar.searchbar.hide();
- },
-
_onFullscreenChanged: function(controller, fullscreen) {
if (fullscreen)
this.window.fullscreen();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]