[atomix] Use monospace clock to avoid jumping digits
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atomix] Use monospace clock to avoid jumping digits
- Date: Sun, 25 Mar 2018 03:38:01 +0000 (UTC)
commit 6d504a06a5dc65451088f10ce9df879c080f12e9
Author: Robert Roth <robert roth off gmail com>
Date: Sun Mar 25 06:37:43 2018 +0300
Use monospace clock to avoid jumping digits
src/clock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/clock.c b/src/clock.c
index 346e430..38704be 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -76,6 +76,7 @@ static void clock_init (Clock *clock)
static void clock_gen_str (Clock *clock)
{
gchar *timestr;
+ gchar *markup;
gint secs = 0;
GDateTime *dtm;
@@ -84,10 +85,12 @@ static void clock_gen_str (Clock *clock)
dtm = g_date_time_new_from_unix_utc (secs);
timestr = g_date_time_format (dtm, clock->fmt);
+ markup = g_strdup_printf("<tt>%s</tt>", timestr);
g_date_time_unref (dtm);
- gtk_label_set_text (GTK_LABEL (clock), timestr);
+ gtk_label_set_markup (GTK_LABEL (clock), markup);
g_free (timestr);
+ g_free (markup);
}
static gint clock_timer_callback (gpointer data)
@@ -106,6 +109,7 @@ GtkWidget *clock_new (void)
clock->fmt = g_strdup ("%H:%M:%S");
clock_gen_str (clock);
+ gtk_label_set_xalign (GTK_LABEL (clock), 0.0);
return GTK_WIDGET (clock);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]