[gnome-control-center] shell: make sure the background colours are updated if the style changes



commit b7ab940c783aa965514905d97de3d07a5767f3db
Author: Thomas Wood <thomas wood intel com>
Date:   Thu Jul 22 17:29:47 2010 +0100

    shell: make sure the background colours are updated if the style changes
    
    Make sure the background of the main vbox uses base/text colour
    combinations and is updated if the style changes

 shell/gnome-control-center.c |   30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 2c4e1ef..756385b 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -899,12 +899,27 @@ gnome_control_center_class_init (GnomeControlCenterClass *klass)
 }
 
 static void
+vbox_style_set_cb (GtkWidget *widget,
+                   GtkStyle  *old_style)
+{
+  GtkWidget *parent;
+  GtkStyle *style;
+
+  parent = gtk_widget_get_parent (widget);
+  style = gtk_widget_get_style (widget);
+  gtk_widget_modify_bg (parent, GTK_STATE_NORMAL,
+                        &style->base[GTK_STATE_NORMAL]);
+  gtk_widget_modify_fg (parent, GTK_STATE_NORMAL,
+                        &style->text[GTK_STATE_NORMAL]);
+
+}
+
+static void
 gnome_control_center_init (GnomeControlCenter *self)
 {
   GError *err = NULL;
-  GtkWidget *vbox, *parent;
+  GtkWidget *vbox;
   GnomeControlCenterPrivate *priv;
-  GtkStyle *style;
 
   priv = self->priv = CONTROL_CENTER_PRIVATE (self);
 
@@ -937,12 +952,11 @@ gnome_control_center_init (GnomeControlCenter *self)
   vbox = W (priv->builder, "main-vbox");
   gtk_widget_set_size_request (vbox, 0, -1);
 
-  parent = gtk_widget_get_parent (vbox);
-  style = gtk_widget_get_style (vbox);
-  gtk_widget_modify_bg (parent, GTK_STATE_NORMAL,
-                        &style->base[GTK_STATE_NORMAL]);
-  gtk_widget_modify_fg (parent, GTK_STATE_NORMAL,
-                        &style->text[GTK_STATE_NORMAL]);
+  /* make sure the background of the vbox uses base/text colour combinations
+   * and is updated if the style changes */
+  vbox_style_set_cb (vbox, NULL);
+  g_signal_connect (vbox, "style-set", G_CALLBACK (vbox_style_set_cb),
+                    NULL);
 
   /* load the available settings panels */
   fill_model (self);



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