[california/wip/736161-black] Style changes *must* be applied to Card, not Deck



commit 83fb11de7c9fe55b905635224e7caae0efcd4e2a
Author: Jim Nelson <jim yorba org>
Date:   Tue Sep 9 18:06:50 2014 -0700

    Style changes *must* be applied to Card, not Deck

 src/toolkit/toolkit-deck.vala |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/src/toolkit/toolkit-deck.vala b/src/toolkit/toolkit-deck.vala
index 5f2ce5a..49d3039 100644
--- a/src/toolkit/toolkit-deck.vala
+++ b/src/toolkit/toolkit-deck.vala
@@ -83,23 +83,12 @@ public class Deck : Gtk.Stack {
     }
     
     ~Deck() {
-        foreach (Card card in names.values)
+        foreach (Card card in names.values) {
             card.map.disconnect(on_card_mapped);
+            card.realize.disconnect(on_card_realized);
+        }
     }
     
-#if ENABLE_UNITY
-    // When description_text_window is visible, the entire GtkGrid's background color goes black
-    // in the GtkPopover; this overrides the color and uses GtkPopover's background color for the
-    // GtkGrid.  See:
-    // https://bugzilla.gnome.org/show_bug.cgi?id=735421
-    public override void realize() {
-        base.realize();
-        
-        Gdk.RGBA bg = get_toplevel().get_style_context().get_background_color(Gtk.StateFlags.NORMAL);
-        override_background_color(Gtk.StateFlags.NORMAL, bg);
-    }
-#endif
-    
     private void on_child_to_top() {
         // disconnect from previous top card and push onto nav stack
         if (top != null) {
@@ -170,6 +159,9 @@ public class Deck : Gtk.Stack {
             // i.e. home)
             card.map.connect(on_card_mapped);
             
+            // some realize issues with Unity
+            card.realize.connect(on_card_realized);
+            
             // add in order to ensure order is preserved if sparsely removed later
             list.add(card);
         }
@@ -201,6 +193,7 @@ public class Deck : Gtk.Stack {
             }
             
             card.map.disconnect(on_card_mapped);
+            card.realize.disconnect(on_card_realized);
             
             remove(card);
             
@@ -333,6 +326,16 @@ public class Deck : Gtk.Stack {
                 message("Card %s specifies initial focus that cannot focus", card.card_id);
         }
     }
+    
+    // When description_text_window is visible, the entire GtkStack's background color goes black;
+    // this overrides the color and uses GtkPopover's background color for the GtkGrid.  See:
+    // https://bugzilla.gnome.org/show_bug.cgi?id=735421
+    private void on_card_realized(Gtk.Widget card) {
+#if ENABLE_UNITY
+        Gdk.RGBA bg = card.get_toplevel().get_style_context().get_background_color(Gtk.StateFlags.NORMAL);
+        card.override_background_color(Gtk.StateFlags.NORMAL, bg);
+#endif
+    }
 }
 
 }


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