[gnome-boxes] Simplify actor fading in ui_state_changed implementation



commit 6281117ddbc8dafacfb6f2db25469381e23a5b97
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 16 15:59:58 2012 +0100

    Simplify actor fading in ui_state_changed implementation
    
    These are all of the form if in the right state, fade in, otherwise
    fade out. No need to use the switches for this.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688473

 src/collection-view.vala |    4 +---
 src/properties.vala      |    5 ++---
 src/wizard.vala          |    4 +---
 3 files changed, 4 insertions(+), 9 deletions(-)
---
diff --git a/src/collection-view.vala b/src/collection-view.vala
index e05baf3..a481110 100644
--- a/src/collection-view.vala
+++ b/src/collection-view.vala
@@ -65,10 +65,8 @@ private class Boxes.CollectionView: Boxes.UI {
     }
 
     public override void ui_state_changed () {
-        uint opacity = 0;
         switch (ui_state) {
         case UIState.COLLECTION:
-            opacity = 255;
             icon_view.unselect_all ();
             break;
 
@@ -82,7 +80,7 @@ private class Boxes.CollectionView: Boxes.UI {
             break;
         }
 
-        fade_actor (actor, opacity);
+        fade_actor (actor, ui_state == UIState.COLLECTION ? 255 : 0);
     }
 
     public void update_item_visible (CollectionItem item) {
diff --git a/src/properties.vala b/src/properties.vala
index 3dade93..3de2fdf 100644
--- a/src/properties.vala
+++ b/src/properties.vala
@@ -289,7 +289,6 @@ private class Boxes.Properties: Boxes.UI {
     }
 
     public override void ui_state_changed () {
-        uint opacity = 0;
         if (stats_id != 0) {
             App.app.current_item.disconnect (stats_id);
             stats_id = 0;
@@ -312,7 +311,6 @@ private class Boxes.Properties: Boxes.UI {
             else
                 toolbar_label.label = "";
             populate ();
-            opacity = 255;
             break;
         default:
             if (previous_ui_state == UIState.PROPERTIES)
@@ -323,6 +321,7 @@ private class Boxes.Properties: Boxes.UI {
                 }
             break;
         }
-        fade_actor (actor, opacity);
+
+        fade_actor (actor, ui_state == UIState.PROPERTIES ? 255 : 0);
     }
 }
diff --git a/src/wizard.vala b/src/wizard.vala
index e4fdb85..eb788ff 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -672,7 +672,6 @@ private class Boxes.Wizard: Boxes.UI {
     }
 
     public override void ui_state_changed () {
-        uint opacity = 0;
         switch (ui_state) {
         case UIState.WIZARD:
             if (previous_ui_state == UIState.PROPERTIES)
@@ -681,11 +680,10 @@ private class Boxes.Wizard: Boxes.UI {
                 wizard_source.uri = "";
                 page = WizardPage.INTRODUCTION;
             }
-            opacity = 255;
             break;
         }
 
-        fade_actor (actor, opacity);
+        fade_actor (actor, ui_state == UIState.WIZARD ? 255 : 0);
     }
 
     private void destroy_machine () {



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