diff options
author | Unia <jthidskes@live.nl> | 2013-04-07 16:01:31 +0200 |
---|---|---|
committer | Unia <jthidskes@live.nl> | 2013-04-07 16:01:31 +0200 |
commit | 26498481fa75d3910579a04740935c91e93f9c25 (patch) | |
tree | 6142d1bc2ba44299566a5e3b2386f44d29884d30 | |
parent | a7ff168022c01482aa7ae45288036d8a146d2f9d (diff) |
fixed timer from not running
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | gstopwatch.c | 17 |
2 files changed, 11 insertions, 10 deletions
@@ -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 <gdk/gdkkeysyms.h> #include <glib.h> + +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); |