[california/wip/742310-black] Final touches



commit 2d3e90cc972ce47736f9478780795c9cf56b2556
Author: Jim Nelson <jim yorba org>
Date:   Tue Jan 6 15:37:09 2015 -0800

    Final touches

 src/toolkit/toolkit-deck.vala |   20 +++-----------------
 src/toolkit/toolkit.vala      |   13 +++++++++++++
 2 files changed, 16 insertions(+), 17 deletions(-)
---
diff --git a/src/toolkit/toolkit-deck.vala b/src/toolkit/toolkit-deck.vala
index 224cb61..b51ffb2 100644
--- a/src/toolkit/toolkit-deck.vala
+++ b/src/toolkit/toolkit-deck.vala
@@ -81,13 +81,13 @@ public class Deck : Gtk.Stack {
         
         if (home != null)
             add_card(home);
+        
+        Toolkit.unity_fixup_background(this);
     }
     
     ~Deck() {
-        foreach (Card card in ids.values) {
+        foreach (Card card in ids.values)
             card.map.disconnect(on_card_mapped);
-            card.realize.disconnect(on_card_realized);
-        }
     }
     
     private void on_child_to_top() {
@@ -156,9 +156,6 @@ public class Deck : Gtk.Stack {
             // i.e. home)
             card.map.connect(on_card_mapped);
             
-            // some theme issues with Unity
-            card.realize.connect(on_card_realized);
-            
             // add in order to ensure order is preserved if sparsely removed later
             list.add(card);
         }
@@ -190,7 +187,6 @@ public class Deck : Gtk.Stack {
             }
             
             card.map.disconnect(on_card_mapped);
-            card.realize.disconnect(on_card_realized);
             
             remove(card);
             
@@ -315,16 +311,6 @@ public class Deck : Gtk.Stack {
                 message("Card %s specifies initial focus that cannot focus", card.card_id);
         }
     }
-    
-    // When a child GtkScrolledWindow is visible, the entire GtkStack's background color goes black;
-    // this overrides the color and uses the toplevel's background color for the Card.  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
-    }
 }
 
 }
diff --git a/src/toolkit/toolkit.vala b/src/toolkit/toolkit.vala
index 27f0298..a06b38d 100644
--- a/src/toolkit/toolkit.vala
+++ b/src/toolkit/toolkit.vala
@@ -165,20 +165,33 @@ private void on_state_flags_changed(Gtk.Widget widget, Gtk.StateFlags old_state_
         widget.unset_state_flags(Gtk.StateFlags.PRELIGHT);
 }
 
+/**
+ * When a child GtkScrolledWindow is visible, the entire GtkStack's background color goes black;
+ * this overrides the color and uses the toplevel's background color for the Card.  See:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=735421
+ * and https://bugzilla.gnome.org/show_bug.cgi?id=742310
+ */
 public void unity_fixup_background(Gtk.Widget widget) {
+#if ENABLE_UNITY
     widget.realize.connect(on_unity_fixup_realize);
     
     Gtk.Container? container = widget as Gtk.Container;
     if (container == null)
         return;
     
+    // Fixup all existing children
     container.foreach(unity_fixup_background);
+    
+    // Fixup all added children
     container.add.connect(unity_fixup_background);
+#endif
 }
 
+#if ENABLE_UNITY
 private void on_unity_fixup_realize(Gtk.Widget widget) {
     Gdk.RGBA bg = widget.get_toplevel().get_style_context().get_background_color(Gtk.StateFlags.NORMAL);
     widget.override_background_color(Gtk.StateFlags.NORMAL, bg);
 }
+#endif
 
 }


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