[gnome-maps/wip/osrm-routing: 17/21] Sidebar: split out actor creation



commit efad7868b15e263262469b06c7bade8ee24bc17c
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Thu Jul 4 00:18:08 2013 +0200

    Sidebar: split out actor creation
    
    Split out the creation of actors into a separate method to keep _init a
    bit more clean.

 src/sidebar.js |   42 +++++++++++++++++++++++++++---------------
 1 files changed, 27 insertions(+), 15 deletions(-)
---
diff --git a/src/sidebar.js b/src/sidebar.js
index c7dab0f..5bebd4f 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -45,24 +45,36 @@ const Sidebar = new Lang.Class({
                                                  'reveal-button']);
         this._ui.revealButton.connect('clicked', this.toggle.bind(this));
         this._ui.revealer.show_all();
-        
-        this.actor = new Clutter.Actor({ layout_manager: new Clutter.BoxLayout({ spacing: 12 }),
-                                         y_expand: true,
-                                         x_align: Clutter.ActorAlign.END });
+
+        this.actor = this._createActor();
         this.actor.hide();
-        
-        // now create actors
-        let buttonActor = new GtkClutter.Actor({ contents: this._ui.revealButton,
-                                                 x_align: Clutter.ActorAlign.END });
+        this.conceal();
+    },
+
+    _createActor: function() {
+        let actor = new Clutter.Actor({
+            layout_manager: new Clutter.BoxLayout({ spacing: 12 }),
+            y_expand: true,
+            x_align: Clutter.ActorAlign.END
+        });
+
+        let buttonActor = new GtkClutter.Actor({
+            contents: this._ui.revealButton,
+            x_align: Clutter.ActorAlign.END
+        });
         Utils.clearGtkClutterActorBg(buttonActor);
-        this.actor.add_child(buttonActor);
 
-        let revealerActor = new GtkClutter.Actor({ contents: this._ui.revealer,
-                                                   x_align: Clutter.ActorAlign.END,
-                                                   x_expand: true,
-                                                   y_expand: true });
-        this.actor.add_child(revealerActor);
-        this.conceal();
+        let revealerActor = new GtkClutter.Actor({
+            contents: this._ui.revealer,
+            x_align: Clutter.ActorAlign.END,
+            x_expand: true,
+            y_expand: true
+        });
+
+        actor.add_child(buttonActor);
+        actor.add_child(revealerActor);
+
+        return actor;
     },
 
     reveal: function() {


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