[gnome-music] Slide out artists list on switching to artists view.



commit a4018ba39b7dbc3c79f1aa5fc4f6ad221481180e
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon May 13 18:59:12 2013 +0200

    Slide out artists list on switching to artists view.
    
    Use Gd for now for compatibility with gtk 3.8
    https://bugzilla.gnome.org/show_bug.cgi?id=700059

 src/view.js   |   17 ++++++++++++++---
 src/window.js |    8 ++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/src/view.js b/src/view.js
index 0fde095..95d77c7 100644
--- a/src/view.js
+++ b/src/view.js
@@ -106,7 +106,7 @@ const ViewContainer = new Lang.Class({
     Name: "ViewContainer",
     Extends: Gtk.Stack,
 
-    _init: function(title, header_bar) {
+    _init: function(title, header_bar, use_stack) {
         this.parent({transition_type: Gtk.StackTransitionType.CROSSFADE});
         this._grid = new Gtk.Grid({orientation: Gtk.Orientation.VERTICAL})
         this._iconWidth = -1
@@ -129,7 +129,18 @@ const ViewContainer = new Lang.Class({
         });
         this.view.set_view_type(Gd.MainViewType.ICON);
         this.view.set_model(this._model);
-        this._grid.add(this.view);
+        if (use_stack){
+            this.stack = new Gd.Stack({
+                transition_type: Gd.StackTransitionType.SLIDE_RIGHT,
+            })
+            var dummy = new Gtk.Frame({visible: false});
+            this.stack.add_named(dummy, "dummy");
+            this.stack.add_named(this.view, "artists");
+            this.stack.set_visible_child_name("dummy");
+            this._grid.add(this.stack);
+        } else {
+            this._grid.add(this.view);
+        }
 
         this._loadMore = new LoadMoreButton(this._getRemainingItemCount);
         this._grid.add(this._loadMore.widget);
@@ -415,7 +426,7 @@ const Artists = new Lang.Class({
     Extends: ViewContainer,
 
     _init: function(header_bar, player) {
-        this.parent("Artists", header_bar);
+        this.parent("Artists", header_bar, true);
         this.player = player;
         this._artists = {};
         this.countQuery = Query.artist_count;
diff --git a/src/window.js b/src/window.js
index 9b390ae..32b2cfd 100644
--- a/src/window.js
+++ b/src/window.js
@@ -85,7 +85,7 @@ const MainWindow = new Lang.Class({
             );
         }
 
-        //this._stack.connect("notify::visible-child", this._onNotifyMode);
+        this._stack.connect("notify::visible-child", this._onNotifyMode);
 
         this.views[0].populate();
         }
@@ -103,7 +103,11 @@ const MainWindow = new Lang.Class({
     },
 
     _onNotifyMode: function(stack, param) {
-        stack.get_visible_child().populate();
+        // Slide out artist list on switching to artists view
+        if(stack.get_visible_child().title == "Artists"){
+            stack.get_visible_child().stack.set_visible_child_name("dummy")
+            stack.get_visible_child().stack.set_visible_child_name("artists")
+        }
     },
 
     _toggleView: function(btn, i) {


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