[gnome-characters] characterList: Fix initial visibility of the stack



commit 933c2a8ee974eec53df30c97445101d51704756b
Author: Daiki Ueno <dueno src gnome org>
Date:   Mon Mar 2 11:26:35 2015 +0900

    characterList: Fix initial visibility of the stack
    
    Previously, the placeholder pages (unavailable, loading, empty) of the
    inner stack sometimes got visible when the outer stack changed the page.
    Mark placeholder pages as invisible by default to prevent this.

 data/characterlist.ui |    6 +++---
 src/characterList.js  |    4 +++-
 src/window.js         |   14 ++++++++------
 3 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/data/characterlist.ui b/data/characterlist.ui
index 695bc59..3dac8ec 100644
--- a/data/characterlist.ui
+++ b/data/characterlist.ui
@@ -6,7 +6,7 @@
     <child>
       <object class="GtkGrid" id="unavailable-grid">
        <property name="can_focus">False</property>
-       <property name="visible">True</property>
+       <property name="visible">False</property>
        <property name="orientation">vertical</property>
        <property name="halign">center</property>
        <property name="valign">center</property>
@@ -52,7 +52,7 @@
     <child>
       <object class="GtkGrid" id="loading-grid">
        <property name="can_focus">False</property>
-       <property name="visible">True</property>
+       <property name="visible">False</property>
        <property name="halign">center</property>
        <property name="valign">center</property>
        <style>
@@ -84,7 +84,7 @@
     <child>
       <object class="GtkGrid" id="empty-recent-grid">
        <property name="can_focus">False</property>
-       <property name="visible">True</property>
+       <property name="visible">False</property>
        <property name="orientation">vertical</property>
        <property name="halign">center</property>
        <property name="valign">center</property>
diff --git a/src/characterList.js b/src/characterList.js
index 8de5d03..8085a2f 100644
--- a/src/characterList.js
+++ b/src/characterList.js
@@ -251,10 +251,12 @@ const CharacterListView = new Lang.Class({
                                                         vexpand: true,
                                                         fontDescription: this._fontDescription });
         let scroll = new Gtk.ScrolledWindow({
-            hscrollbar_policy: Gtk.PolicyType.NEVER
+            hscrollbar_policy: Gtk.PolicyType.NEVER,
+            visible: true
         });
         scroll.add(this._characterList);
         this.add_named(scroll, 'character-list');
+        this.visible_child_name = 'character-list';
 
         this._characters = [];
         this._spinnerTimeoutId = 0;
diff --git a/src/window.js b/src/window.js
index 9b2bb02..b94fdb9 100644
--- a/src/window.js
+++ b/src/window.js
@@ -300,15 +300,15 @@ const MainView = new Lang.Class({
         if (!(name in this._characterLists))
             return;
 
-        this.visible_child_name = name;
-        this.visible_child.setFilterFont(filterFontFamily);
+        let characterList = this.get_child_by_name(name);
+        characterList.setFilterFont(filterFontFamily);
 
         if (name == 'recent') {
             if (this.recentCharacters.length == 0)
-                this.visible_child.visible_child_name = 'empty-recent';
+                characterList.visible_child_name = 'empty-recent';
             else {
-                this.visible_child.setCharacters(this.recentCharacters);
-                this.visible_child.updateCharacterList();
+                characterList.setCharacters(this.recentCharacters);
+                characterList.updateCharacterList();
             }
         } else {
             let category = null;
@@ -319,8 +319,10 @@ const MainView = new Lang.Class({
             }
 
             Util.assertNotEqual(category, null);
-            this.visible_child.searchByCategory(category);
+            characterList.searchByCategory(category);
         }
+
+        this.visible_child = characterList;
     },
 
     addToRecent: function(uc) {


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