aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-11-30 15:49:52 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2013-11-30 15:49:52 -0500
commit8f3a4a4727451aff6d8f1451c0203c57655bd644 (patch)
treea722913f5cc2df584b9078fb77a8f5002c9e4a62
parent9df2cdaa4f874ca4fe1a555561878317a9ce3957 (diff)
only update the string if our output is differentHEADmaster
-rw-r--r--gstopwatch.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gstopwatch.c b/gstopwatch.c
index be89abe..b8722c1 100644
--- a/gstopwatch.c
+++ b/gstopwatch.c
@@ -47,6 +47,7 @@ GdkColor color;
gboolean show_milliseconds = TRUE;
char output[100];
+char output_old[100];
gboolean stopwatch_function (void) {
gchar *markup;
@@ -65,10 +66,14 @@ gboolean stopwatch_function (void) {
else
sprintf(output, "%02d:%02d:%02d", hours, minutes, (int)seconds);
- gtk_label_set_text(GTK_LABEL(stopwatch_display), output);
- markup = g_markup_printf_escaped("<span font=\"48\" weight=\"heavy\"><tt>%s</tt></span>", output);
- gtk_label_set_markup(GTK_LABEL(stopwatch_display), markup);
- g_free (markup);
+ if(strcmp(output, output_old) != 0) {
+ gtk_label_set_text(GTK_LABEL(stopwatch_display), output);
+ markup = g_markup_printf_escaped("<span font=\"48\" weight=\"heavy\"><tt>%s</tt></span>", output);
+ gtk_label_set_markup(GTK_LABEL(stopwatch_display), markup);
+ g_free (markup);
+ }
+
+ strcpy(output_old, output);
return TRUE;
}