aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2010-12-23 00:24:51 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2010-12-23 00:24:51 +0100
commit0c85942be07ac17ede7fe4499db60733a3dbf801 (patch)
treed826729ed5f2c4a7da627b6689a28b55abb0f649 /src
parent0a7a68160740fdacc7a62b7c201c21f2845a4518 (diff)
downloadayatana-indicator-datetime-0c85942be07ac17ede7fe4499db60733a3dbf801.tar.gz
ayatana-indicator-datetime-0c85942be07ac17ede7fe4499db60733a3dbf801.tar.bz2
ayatana-indicator-datetime-0c85942be07ac17ede7fe4499db60733a3dbf801.zip
Set label justification to center, and connect to "screen-changed" signal
Update gravity on screen change!
Diffstat (limited to 'src')
-rw-r--r--src/indicator-datetime.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/indicator-datetime.c b/src/indicator-datetime.c
index 75b857d..5c5f6fd 100644
--- a/src/indicator-datetime.c
+++ b/src/indicator-datetime.c
@@ -847,6 +847,22 @@ style_changed (GtkWidget * widget, GtkStyle * oldstyle, gpointer data)
return;
}
+
+static void
+update_text_gravity (GtkWidget *widget, GdkScreen *previous_screen, gpointer data)
+{
+ IndicatorDatetime * self = INDICATOR_DATETIME(data);
+ if (self->priv->label == NULL) return;
+
+ PangoLayout *layout;
+ PangoContext *context;
+
+ layout = gtk_label_get_layout (GTK_LABEL(self->priv->label));
+ context = pango_layout_get_context(layout);
+ pango_context_set_base_gravity(context, PANGO_GRAVITY_AUTO);
+}
+
+
/* Tries to figure out what our format string should be. Lots
of translator comments in here. */
static gchar *
@@ -966,8 +982,10 @@ get_label (IndicatorObject * io)
/* If there's not a label, we'll build ourselves one */
if (self->priv->label == NULL) {
self->priv->label = GTK_LABEL(gtk_label_new("Time"));
+ gtk_label_set_justify (GTK_LABEL(self->priv->label), GTK_JUSTIFY_CENTER);
g_object_ref(G_OBJECT(self->priv->label));
g_signal_connect(G_OBJECT(self->priv->label), "style-set", G_CALLBACK(style_changed), self);
+ g_signal_connect(G_OBJECT(self->priv->label), "screen-changed", G_CALLBACK(update_text_gravity), self);
guess_label_size(self);
update_label(self);
gtk_widget_show(GTK_WIDGET(self->priv->label));