[california] Unity theme probs when GtkStack holds GtkScrolledWindow: Bug #736161



commit 90d2d39716932b233784fe4162aa9d6ce74b6b4f
Author: Jim Nelson <jim yorba org>
Date:   Tue Sep 9 19:02:19 2014 -0700

    Unity theme probs when GtkStack holds GtkScrolledWindow: Bug #736161
    
    This generalizes the fix for bug #735421 for all Toolkit.Decks (which
    are Gtk.Stacks) who have a child Gtk.ScrolledWindow widget under
    Ambiance, which will color the entire window black.

 src/host/host-show-event.vala |   13 -------------
 src/rc/create-update-event.ui |    4 ----
 src/toolkit/toolkit-deck.vala |   18 +++++++++++++++++-
 3 files changed, 17 insertions(+), 18 deletions(-)
---
diff --git a/src/host/host-show-event.vala b/src/host/host-show-event.vala
index ee252ba..937606a 100644
--- a/src/host/host-show-event.vala
+++ b/src/host/host-show-event.vala
@@ -121,19 +121,6 @@ public class ShowEvent : Gtk.Grid, Toolkit.Card {
         Calendar.System.instance.today_changed.disconnect(build_display);
     }
     
-#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
-    
     public void jumped_to(Toolkit.Card? from, Toolkit.Card.Jump reason, Value? message) {
         // no message, don't update display
         if (message == null)
diff --git a/src/rc/create-update-event.ui b/src/rc/create-update-event.ui
index f7a8a60..b85cc36 100644
--- a/src/rc/create-update-event.ui
+++ b/src/rc/create-update-event.ui
@@ -6,10 +6,6 @@
     <property name="name">grid</property>
     <property name="visible">True</property>
     <property name="can_focus">False</property>
-    <property name="margin_left">8</property>
-    <property name="margin_right">8</property>
-    <property name="margin_top">8</property>
-    <property name="margin_bottom">8</property>
     <property name="row_spacing">6</property>
     <property name="column_spacing">6</property>
     <child>
diff --git a/src/toolkit/toolkit-deck.vala b/src/toolkit/toolkit-deck.vala
index 3196643..e4798f4 100644
--- a/src/toolkit/toolkit-deck.vala
+++ b/src/toolkit/toolkit-deck.vala
@@ -83,8 +83,10 @@ 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);
+        }
     }
     
     private void on_child_to_top() {
@@ -157,6 +159,9 @@ 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);
         }
@@ -188,6 +193,7 @@ public class Deck : Gtk.Stack {
             }
             
             card.map.disconnect(on_card_mapped);
+            card.realize.disconnect(on_card_realized);
             
             remove(card);
             
@@ -320,6 +326,16 @@ 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
+    }
 }
 
 }


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