From 26498481fa75d3910579a04740935c91e93f9c25 Mon Sep 17 00:00:00 2001 From: Unia Date: Sun, 7 Apr 2013 16:01:31 +0200 Subject: fixed timer from not running --- README.md | 4 ++-- gstopwatch.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 11d7fe1..bf48f38 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ For any bug or request [fill an issue][bug] on [GitHub][ghp]. ToDo ---- -* Centralize text, display them like gnome-clocks? +* Display text like gnome-clocks? * Laps * Hours:Minutes:Seconds display -* Font size +* Font size depend on window size License ------- diff --git a/gstopwatch.c b/gstopwatch.c index a1525c4..fd9a3f4 100644 --- a/gstopwatch.c +++ b/gstopwatch.c @@ -2,6 +2,8 @@ #include #include + +gboolean running; GTimer *timer; GtkWidget *timer_display; @@ -17,8 +19,7 @@ gboolean update_progress_bar (void) { return TRUE; } -gboolean keypress (GdkEventKey *event) { - gboolean running = FALSE; +gboolean keypress (GtkWidget *widget, GdkEventKey *event) { guint(g) = event->keyval; if((g == GDK_KEY_space)) { @@ -38,18 +39,18 @@ gboolean keypress (GdkEventKey *event) { int main (int argc, char *argv[]) { GtkWidget *window, *box; - gtk_init (&argc, &argv); + gtk_init(&argc, &argv); timer_display = gtk_label_new(""); box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5); - gtk_box_pack_start(GTK_BOX (box), timer_display, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX (box), timer_display, TRUE, TRUE, 5); - window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_container_add (GTK_CONTAINER (window), box); - gtk_widget_show_all (window); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_add(GTK_CONTAINER (window), box); + gtk_widget_show_all(window); - timer = g_timer_new (); + timer = g_timer_new(); g_timer_stop(timer); g_timeout_add_full(G_PRIORITY_HIGH, 50, (GSourceFunc) update_progress_bar, NULL, NULL); -- cgit v1.2.3