From a526efc84112318aff7132f31051656bfd7b2eca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 1 Mar 2010 16:30:44 -0600 Subject: Reacting to changes in style. --- src/indicator-datetime.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c index d1a2db4..3fe11a3 100644 --- a/src/indicator-datetime.c +++ b/src/indicator-datetime.c @@ -275,6 +275,18 @@ guess_label_size (IndicatorDatetime * self) return; } +/* React to the style changing, which could mean an font + update. */ +static void +style_changed (GtkWidget * widget, GtkStyle * oldstyle, gpointer data) +{ + g_debug("New style for time label"); + IndicatorDatetime * self = INDICATOR_DATETIME(data); + guess_label_size(self); + update_label(self); + return; +} + /* Grabs the label. Creates it if it doesn't exist already */ static GtkLabel * @@ -286,6 +298,7 @@ get_label (IndicatorObject * io) if (self->priv->label == NULL) { self->priv->label = GTK_LABEL(gtk_label_new("Time")); g_object_ref(G_OBJECT(self->priv->label)); + g_signal_connect(G_OBJECT(self->priv->label), "style-set", G_CALLBACK(style_changed), self); guess_label_size(self); update_label(self); gtk_widget_show(GTK_WIDGET(self->priv->label)); -- cgit v1.2.3