[gnome-documents] toolbar: always create an actor for MainToolbar



commit 18c9e29653adb78cb6c8d08d5c55f8c5808e4812
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 31 12:41:18 2011 -0400

    toolbar: always create an actor for MainToolbar

 src/embed.js       |   18 ++++++++++++------
 src/mainToolbar.js |    6 ++++--
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index a688054..f1ea4a6 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -59,15 +59,23 @@ ViewEmbed.prototype  = {
         this._scrolledWinView = null;
         this._scrolledWinPreview = null;
 
-        this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL });
-        this.actor = new GtkClutter.Actor({ contents: this.widget });
+        // the embed is a vertical ClutterBox
+        this._layout = new Clutter.BoxLayout({ vertical: true });
+        this.actor = new Clutter.Box({ layout_manager: this._layout });
 
+        // pack the toolbar
         this._toolbar = new MainToolbar.MainToolbar();
-        this.widget.add(this._toolbar.widget);
+        this.actor.add_actor(this._toolbar.actor);
+        this._layout.set_fill(this._toolbar.actor, true, false);
 
+        // pack the main GtkNotebook
         this._notebook = new Gtk.Notebook({ show_tabs: false });
         this._notebook.show();
-        this.widget.add(this._notebook);
+
+        this._embedActor = new GtkClutter.Actor({ contents: this._notebook });
+        this.actor.add_actor(this._embedActor);
+        this._layout.set_expand(this._embedActor, true);
+        this._layout.set_fill(this._embedActor, true, true);
 
         Global.errorHandler.connect('load-error',
                                     Lang.bind(this, this._onLoadError));
@@ -77,8 +85,6 @@ ViewEmbed.prototype  = {
         Global.modeController.connect('fullscreen-changed',
                                       Lang.bind(this, this._onFullscreenChanged));
         this._onWindowModeChanged();
-
-        this.widget.show();
     },
 
     _onFullscreenChanged: function(controller, fullscreen) {
diff --git a/src/mainToolbar.js b/src/mainToolbar.js
index 9388918..bc3bf95 100644
--- a/src/mainToolbar.js
+++ b/src/mainToolbar.js
@@ -45,6 +45,9 @@ MainToolbar.prototype = {
 
         this.widget = new Gtk.Toolbar({ icon_size: Gtk.IconSize.MENU });
         this.widget.get_style_context().add_class(Gtk.STYLE_CLASS_MENUBAR);
+        this.widget.show();
+
+        this.actor = new GtkClutter.Actor({ contents: this.widget });
 
         // setup listeners to mode changes that affect the toolbar layout
         this._selectionModeId =
@@ -321,8 +324,7 @@ FullscreenToolbar.prototype = {
     _init: function() {
         MainToolbar.prototype._init.call(this);
 
-        this.actor = new GtkClutter.Actor({ contents: this.widget,
-                                            y: -(this.widget.get_preferred_height()[1]) });
+        this.actor.y = -(this.widget.get_preferred_height()[1]);
     },
 
     show: function() {



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