diff options
author | Unia <jthidskes@live.nl> | 2013-04-07 00:03:04 +0200 |
---|---|---|
committer | Unia <jthidskes@live.nl> | 2013-04-07 00:03:04 +0200 |
commit | 56d315b91b431b8a4da1030d4f2e498e0600e299 (patch) | |
tree | b9abe1789a31a9639108b9200ee787de21dad98a | |
parent | 2ae3c219a0354f60709380281fcbf80cdb392d7a (diff) |
improved makefile, readme. small code cleanups
-rw-r--r-- | Makefile | 33 | ||||
-rw-r--r-- | README.md | 43 | ||||
-rw-r--r-- | gstopwatch.c | 4 |
3 files changed, 67 insertions, 13 deletions
@@ -1,5 +1,32 @@ -gstopwatch: - gcc gstopwatch.c `pkg-config --cflags --libs gtk+-3.0` -o gstopwatch +PROG = gstopwatch + +CC = gcc +LIBS = `pkg-config --cflags --libs gtk+-3.0` +CFLAGS = -std=c99 -Wall -Wextra -Wno-deprecated-declarations + +PREFIX ?= /usr/local +BINPREFIX = $(PREFIX)/bin + +all: CFLAGS += -Os +all: LDFLAGS += -s +all: $(PROG) + +debug: CFLAGS += -O0 -g -pedantic +debug: all + +$(PROG): $(PROG).c + gcc $(PROG).c -o $(PROG) $(CFLAGS) $(LIBS) + +install: + mkdir -p $(DESTDIR)/$(BINPREFIX) + mkdir -p $(DESTDIR)/usr/share/applications/ + + install -m 0755 $(PROG) $(DESTDIR)/$(BINPREFIX)/ + install -m 0644 data/$(PROG).desktop $(DESTDIR)/usr/share/applications/ + +uninstall: + rm -f $(BINPREFIX)/$(PROG) + rm -f /usr/share/applications/$(PROG).desktop clean: - rm -f gstopwatch + rm -f $(PROG) @@ -1,22 +1,49 @@ -gstopwatch ----------- +Gstopwatch +========= + +**A simple stopwatch, written in GTK3.** + Okay, so apparently there are absolutely zero good stopwatches around for X11! I spent my time searching but couldn't find one simple enough for me. This stopwatch will start counting, stop counting and reset. Usage ----- -Press space to start timing, space to stop, space again to reset and start -timing again. +The spacebar does it all! Press space to start timing, space to stop, space again to reset and space to start timing again. + +Installation +------------ + +You'll need the GTK 3.x libraries and headers installed and ready to go. To +build, simply run these commands: + + $ make + $ make clean install + +Bugs +---- + +For any bug or request [fill an issue][bug] on [GitHub][ghp]. -Building --------- -You'll need the gtk 3.x libraries and headers installed and ready to go. To -build, simple run make in the gstopwatch folder + [bug]: https://github.com/Unia/gstopwatch/issues + [ghp]: https://github.com/Unia/gstopwatch ToDo ---- + +* Centralize text, display them like gnome-clocks? * Laps * Hours:Minutes:Seconds display * Font size + +License +------- + +**Gstopwatch** is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + +**Gstopwatch** is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. + +**Copyright © 2013** Jente (jthidskes at outlook dot com) diff --git a/gstopwatch.c b/gstopwatch.c index 52a0ea7..094e399 100644 --- a/gstopwatch.c +++ b/gstopwatch.c @@ -9,7 +9,7 @@ GTimer *timer; gboolean update_progress_bar (void) { gulong gulong; gdouble time_elapsed; - char *output; + char *output = NULL; time_elapsed = g_timer_elapsed (timer, &gulong); sprintf(output, "%.2f", time_elapsed); @@ -18,7 +18,7 @@ gboolean update_progress_bar (void) { return TRUE; } -gboolean keypress (GtkWidget *widget, GdkEventKey *event) { +gboolean keypress (GdkEventKey *event) { guint(g) = event->keyval; if((g == GDK_KEY_space)) { |