# Copyright 2009 Michael Cronenworth <mike@cchtml.com>
#
-# The icons
-
-icondir = $(datadir)/icons/hicolor
-
-install-data-local:
- i=stopish; \
- $(mkinstalldirs) $(DESTDIR)$(icondir)/16x16/hildon; \
- $(mkinstalldirs) $(DESTDIR)$(icondir)/26x26/hildon; \
- $(mkinstalldirs) $(DESTDIR)$(icondir)/40x40/hildon; \
- $(mkinstalldirs) $(DESTDIR)$(icondir)/scalable/hildon; \
- $(INSTALL_DATA) $(srcdir)/$$i.16.png $(DESTDIR)$(icondir)/16x16/hildon/$$i.png; \
- $(INSTALL_DATA) $(srcdir)/$$i.26.png $(DESTDIR)$(icondir)/26x26/hildon/$$i.png; \
- $(INSTALL_DATA) $(srcdir)/$$i.40.png $(DESTDIR)$(icondir)/40x40/hildon/$$i.png; \
- $(INSTALL_DATA) $(srcdir)/$$i.64.png $(DESTDIR)$(icondir)/scalable/hildon/$$i.png;
-
-uninstall-local:
- i=stopish; \
- rm $(DESTDIR)$(icondir)/16x16/hildon/$$i.png; \
- rm $(DESTDIR)$(icondir)/26x26/hildon/$$i.png; \
- rm $(DESTDIR)$(icondir)/40x40/hildon/$$i.png; \
- rm $(DESTDIR)$(icondir)/scalable/hildon/$$i.png;
-
-# The program
-
-bin_PROGRAMS = stopish
-
-stopish_SOURCES = stopish.c
-
-stopish_CFLAGS = $(GTK_CFLAGS) $(OSSO_CFLAGS)
-stopish_LDADD = $(GTK_LIBS) $(OSSO_LIBS) $(DESKTOP_LIBS)
-
-desktopdir = $(datadir)/applications/hildon
-desktop_DATA = stopish.desktop
-
-servicedir = $(datadir)/dbus-1/services
-service_DATA = com.nokia.stopish.service
-
-# The shared library
-
-#lib_LTLIBRARIES = libhelloworld.la
-
-#include_HEADERS = libhelloworld.h
-
-#libhelloworld_la_SOURCES = libhelloworld.c \
- #libhelloworld.h
-#libhelloworld_la_CFLAGS = $(GTK_CFLAGS)
-#libhelloworld_la_LIBADD = $(GTK_LIBS)
-
-# The control panel applet
-
-#libcpdir = $(libdir)/hildon-control-panel
-#libcp_LTLIBRARIES = libhelloworld-cp.la
-
-#libhelloworld_cp_la_SOURCES = hello-world-applet.c
-#libhelloworld_cp_la_CFLAGS = $(GTK_CFLAGS) $(OSSO_CFLAGS)
-#libhelloworld_cp_la_LDFLAGS = -module -avoid-version
-#libhelloworld_cp_la_LIBADD = $(GTK_LIBS) libhelloworld.la
-
-#controlpaneldir = $(datadir)/applications/hildon-control-panel
-#controlpanel_DATA = hello-world-cp.desktop
-
-# The status menu plugin
-
-#libsmdir = `pkg-config libhildondesktop-1 --variable=hildondesktoplibdir`
-#libsm_LTLIBRARIES = libhelloworld-sm.la
-#datsmdir = `pkg-config libhildondesktop-1 --variable=hildonstatusmenudesktopentrydir`
-#datsm_DATA = hello-world-sm.desktop
-
-#libhelloworld_sm_la_SOURCES = hello-world-statusmenu.c
-#libhelloworld_sm_la_CFLAGS = $(GTK_CFLAGS) $(OSSO_CFLAGS) $(DESKTOP_CFLAGS)
-#libhelloworld_sm_la_LDFLAGS = -module -avoid-version
-#libhelloworld_sm_la_LIBADD = libhelloworld.la $(GTK_LIBS)
-
-# The Home plugin
-
-#libhhdir = `pkg-config osso-af-settings --variable=hildondesktoplibdir`
-#dathhdir = $(datadir)/applications/hildon-home
-#libhh_LTLIBRARIES = libhelloworld-home.la
-#dathh_DATA = stopish.desktop
-
-#libhelloworld_home_la_SOURCES = hello-world-home.c
-#libhelloworld_home_la_CFLAGS = $(GTK_CFLAGS) $(OSSO_CFLAGS) $(DESKTOP_CFLAGS)
-#libhelloworld_home_la_LDFLAGS = -module -avoid-version
-#libhelloworld_home_la_LIBADD = $(GTK_LIBS) libhelloworld.la
-
-# The locale
-
-# The gstreamer plugin
-
-# The backup/restore configuration
-
EXTRA_DIST = \
autogen.sh \
- make-package \
- debian/changelog \
- debian/compat \
- debian/copyright \
- debian/control \
- debian/rules \
- stopish.desktop \
- com.nokia.stopish.service \
- stopish.26.png \
- stopish.40.png \
- stopish.64.png
+ debian/changelog \
+ debian/compat \
+ debian/copyright \
+ debian/control \
+ debian/rules
-deb:
- ./make-package $(PACKAGE) $(VERSION)
+SUBDIRS = src data
#!/bin/sh
set -x
-aclocal-1.7
-autoconf
-libtoolize
-automake-1.7 --add-missing --foreign
+libtoolize --automake --copy --force
+aclocal
+autoconf --force
+automake --add-missing --copy --force-missing --foreign
+++ /dev/null
-# Sample service description file
-[D-BUS Service]
-Name=com.nokia.stopish
-Exec=/usr/bin/stopish
-AC_INIT(stopish, 1.0)
-AC_CONFIG_SRCDIR(Makefile.am)
-AM_INIT_AUTOMAKE
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(stopish, 0.9)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
+# Option to enable debugging
+AC_ARG_ENABLE(debug,
+ [AC_HELP_STRING([ --enable-debug],[Debugging (default=no)])],
+ [with_debug=yes], [with_debug=no])
+
+if test "x$with_debug" == "xyes" ; then
+ CFLAGS="$CFLAGS -ggdb -O0 -DDEBUG -Wall "
+else
+ CFLAGS="$CFLAGS -O2 -Wall "
+fi
+
PKG_CHECK_MODULES(GTK, gtk+-2.0)
AC_SUBST(GTK_LIBS)
AC_SUBST(GTK_CFLAGS)
AC_SUBST(DESKTOP_LIBS)
AC_SUBST(DESKTOP_CFLAGS)
-AC_OUTPUT([ Makefile])
+# Application icon install directories
+icon_16x16dir=$datadir/icons/hicolor/16x16/hildon
+icon_26x26dir=$datadir/icons/hicolor/26x26/hildon
+icon_40x40dir=$datadir/icons/hicolor/40x40/hildon
+icon_scalabledir=$datadir/icons/hicolor/scalable/hildon
+AC_SUBST(icon_16x16dir)
+AC_SUBST(icon_26x26dir)
+AC_SUBST(icon_40x40dir)
+AC_SUBST(icon_scalabledir)
+
+# Produce output files
+AC_OUTPUT(
+ Makefile \
+ src/Makefile \
+ data/Makefile
+)
--- /dev/null
+#
+# This file is part of stopish
+#
+# Copyright 2009 Michael Cronenworth <mike@cchtml.com>
+#
+
+# The icons
+
+icondir = $(datadir)/icons/hicolor
+
+icon_16x16_DATA = icons/16x16/stopish.png
+icon_26x26_DATA = icons/26x26/stopish.png
+icon_40x40_DATA = icons/40x40/stopish.png
+icon_scalable_DATA = icons/scalable/stopish.png
+
+# The data files
+
+desktopdir = $(datadir)/applications/hildon
+desktop_DATA = stopish.desktop
+
+servicedir = $(datadir)/dbus-1/services
+service_DATA = com.nokia.stopish.service
+
+EXTRA_DIST = $(service_DATA) $(desktop_DATA) \
+ $(icon_16x16_DATA) $(icon_26x26_DATA) $(icon_40x40_DATA) $(icon_scalable_DATA)
--- /dev/null
+# Sample service description file
+[D-BUS Service]
+Name=com.nokia.stopish
+Exec=/usr/bin/stopish
--- /dev/null
+[Desktop Entry]
+Encoding=UTF-8
+Version=0.9
+Type=Application
+Name=Stopish
+Exec=/usr/bin/stopish
+Icon=stopish
+X-Window-Icon=stopish
+X-Window-Icon-Dimmed=stopish
+X-Osso-Service=com.nokia.stopish
+X-Osso-Type=application/x-executable
-stopish (1.0) unstable; urgency=low
+stopish (0.9) unstable; urgency=low
* Initial Release.
- -- Michael Cronenworth <mike@cchtml.com> Tue, 08 Dec 2000 22:48:40 -0600
-
+ -- Michael Cronenworth <mike@cchtml.com> Tue, 09 Dec 2000 18:53:10 -0600
Standards-Version: 3.7.2
Package: stopish
+Section: user/office
Architecture: any
Depends: ${shlibs:Depends}, hildon-desktop, libgtk2.0-bin
Description: A stopwatch when you need to keep track of the length of
an important event.
-XB-Maemo-Icon-26:
- iVBORw0KGgoAAAANSUhEUgAAABoAAAAZCAAAAAAKtWG8AAAACXBIWXMAAAAnAAAAJwEqCZFP
- AAAAB3RJTUUH1QkMEgEBuF+MPAAAACF0RVh0Q29tbWVudABKUEVHOmdudS1oZWFkLmpwZyAy
- NzZ4MjYxjzmxCgAAAi9JREFUKM9dkd9LU2Ecxp/37HU/nFub02Zty9K0lc5FYWJBUCBeRD+o
- y6j/IoIuoj8hgi6DgqAroSAk+gWSIuZVTU1nuDM3tzl1O3PNc3a29/12cSyoy+/zfD+fm4cR
- QJWdPXgiCgMAECNVF72t4ICZmEmxmn9ooN8FAEV1gnmr/VeCHDKd9USHlIAecAIAfPJmM5l5
- br/NkdS16KAHtFdccndTLuAcBaKmVslxMkoIeUAFdT4hr00IfvUGR8fxjU2dw1VK3AG0z4/V
- qjI59j05R7cUHHLYHVyW01GC+fFhPayFR/p6JlefHLyI5fnrLVzhzfxi+MW7B+N29Wx2mr9f
- y73O19+E3G1MzmZeenxLr7rW3sYHybbz6XLft6ep0PDwOdujtt3Dxer9ASbj+pTdF04mzwRT
- sfOdo5zDf5L7XBcA+BfVES/8P0zn+NbRkA0govzSHBElhDR0SXJ6VYpsk4gYAagXurH9q8sJ
- kXKFChm30XTEAQ4AxUhjVcQkseV68Eu8UzutAAAjwFgo1S+VI6i0VtX0GHnyXre1AVFj29gS
- X4nkuiYqZTH1QRIRkQKABxyK0l4mFt5gXl+hEbOG4wAAGDi2IjpYx2xEW8mdsjIQERGtCVrf
- kCTMjCnTlo8U6yFUQLi+1RA/n92dYZYPjCy2xPy1vcIJRdUHbPu+fYq110w3p6JN7hL+rcC6
- WhiOqMmFXuP/Ci0KuMuZLd2b/5OwvzwAamrlWs+B/es340gXFARK7DMAAAAASUVORK5CYII=
+
+Package: stopish-dbg
+Section: user/office
+Architecture: any
+Depends: stopish (= ${Source-Version})
+Description: A stopwatch when you need to keep track of the length of
+ an important event. This package contains debug symbols.
Copyright (C) 2009 Michael Cronenworth <mike@cchtml.com>
-This maemo code example is licensed under a following MIT-style license.
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+ This software is licensed under the GPLv3 license.
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
usr/bin/stopish
-usr/share/applications/hildon-home
+usr/share/*
--- /dev/null
+#
+# This file is part of stopish
+#
+# Copyright 2009 Michael Cronenworth <mike@cchtml.com>
+#
+
+# The program
+
+bin_PROGRAMS = stopish
+
+stopish_SOURCES = stopish.c
+
+stopish_CFLAGS = $(GTK_CFLAGS) $(OSSO_CFLAGS)
+stopish_LDADD = $(GTK_LIBS) $(OSSO_LIBS) $(DESKTOP_LIBS)
--- /dev/null
+// stopish.c
+//
+// Copyright 2009 Michael Cronenworth <mike@cchtml.com>
+//
+// This program 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 2 of the License, or
+// (at your option) any later version.
+//
+// This program 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, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+// MA 02110-1301, USA.
+
+
+#include <string.h>
+#include <stdlib.h>
+#include <sys/time.h>
+
+#include <gtk/gtk.h>
+#include <libosso.h>
+
+static GtkWidget *timerLabel = NULL;
+static int stopishMode = 0; // 0 = Start, 1 = Stop
+static int timerHandle = -1;
+static int timerStartTime = 0;
+static int timeTicks = 0;
+
+//Prototypes
+gint dbus_callback( const gchar *interface, const gchar *method,
+ GArray *arguments, gpointer data, osso_rpc_t *retval );
+GtkWindow *stopish_new( void );
+static void start_cb( GtkButton* button, gpointer data );
+static void close_cb( GtkButton* button, gpointer data );
+static gint timeout_cb( gpointer data );
+static int current_time( void );
+
+
+int main( int argc, char *argv[] )
+{
+ osso_context_t *ctxt;
+ osso_return_t ret;
+ GtkWindow *window;
+
+ //printf( "stopish: starting up\n" );
+
+ ctxt = osso_initialize( "com.nokia.stopish", PACKAGE_VERSION, TRUE, NULL );
+ if ( ctxt == NULL ) {
+ fprintf( stderr, "osso_initialize failed.\n" );
+ exit( 1 );
+ }
+
+ gtk_init( &argc, &argv );
+
+ window = stopish_new( );
+
+ ret = osso_rpc_set_default_cb_f( ctxt, dbus_callback, window );
+ if ( ret != OSSO_OK ) {
+ fprintf( stderr, "osso_rpc_set_default_cb_f failed: %d.\n", ret );
+ exit( 1 );
+ }
+
+ gtk_main( );
+
+ return 0;
+}
+
+
+gint dbus_callback( const gchar *interface, const gchar *method,
+ GArray *arguments, gpointer data, osso_rpc_t *retval )
+{
+ //printf( "stopish dbus: %s, %s\n", interface, method );
+
+ if ( !strcmp( method, "top_application" ) )
+ gtk_window_present( GTK_WINDOW( data ) );
+
+ retval->type = DBUS_TYPE_INVALID;
+
+ return OSSO_OK;
+}
+
+
+GtkWindow *stopish_new( void )
+{
+ GtkWidget *window, *hBox, *label, *button;
+ GtkWidget *vBox, *vBox0;
+
+ window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+
+ gtk_container_set_border_width( GTK_CONTAINER( window ), 20 );
+
+ gtk_window_set_title( GTK_WINDOW( window ), "Stopish" );
+
+ g_signal_connect( G_OBJECT( window ), "destroy",
+ G_CALLBACK( close_cb ), window );
+
+ vBox = gtk_vbox_new( FALSE, 10 );
+
+ label = gtk_label_new( "Stopish - The Stopwatch" );
+ gtk_box_pack_start( GTK_BOX( vBox ), label, FALSE, FALSE, 0 );
+
+ hBox = gtk_hbox_new( FALSE, 10 );
+
+ // stop watch area
+ timerLabel = gtk_label_new( NULL );
+ gtk_label_set_markup( GTK_LABEL( timerLabel ), "<big>00:00:00.0</big>" );
+ gtk_container_add( GTK_CONTAINER( hBox ), timerLabel );
+
+ // button area
+ vBox0 = gtk_vbox_new( FALSE, 10 );
+
+ // close button
+ button = gtk_button_new( );
+ label = gtk_label_new( "Start" );
+ gtk_container_add( GTK_CONTAINER( button ), label );
+ g_signal_connect( G_OBJECT( button ), "clicked",
+ G_CALLBACK( start_cb ), label );
+ gtk_box_pack_start( GTK_BOX( vBox0 ), button, FALSE, FALSE, 0 );
+
+ // start stopwatch button
+ button = gtk_button_new_with_label( "Close" );
+ g_signal_connect( G_OBJECT( button ), "clicked",
+ G_CALLBACK( close_cb ), window );
+ gtk_box_pack_start( GTK_BOX( vBox0 ), button, FALSE, FALSE, 0 );
+
+ gtk_container_add( GTK_CONTAINER( hBox ), vBox0 );
+
+ gtk_container_add( GTK_CONTAINER( vBox ), hBox );
+
+ gtk_container_add( GTK_CONTAINER( window ), vBox );
+
+ gtk_widget_show_all( window );
+
+ return GTK_WINDOW( window );
+}
+
+
+static void start_cb( GtkButton* button, gpointer data )
+{
+ if ( stopishMode == 0 ) {
+ // set label text and add timer handle
+ gtk_label_set_text( GTK_LABEL( data ), "Stop" );
+ stopishMode = 1;
+ timerHandle = g_timeout_add( 100, timeout_cb, NULL );
+ timerStartTime = current_time( ) - timeTicks;
+ }
+ else {
+ // set label text and remove timer handle
+ gtk_label_set_text( GTK_LABEL( data ), "Start" );
+ stopishMode = 0;
+ timerStartTime = 0;
+ timeTicks = 0;
+ gtk_label_set_markup( GTK_LABEL( timerLabel ),
+ "<big>00:00:00.0</big>" );
+ g_source_remove( timerHandle );
+ }
+}
+
+
+static void close_cb( GtkButton* button, gpointer data )
+{
+ // destroy main window and exit gtk main loop
+ gtk_widget_destroy( GTK_WIDGET( data ) );
+ gtk_main_quit( );
+}
+
+
+static gint timeout_cb( gpointer data )
+{
+ static char timeBuffer[64];
+ int h, m, s, ss, currentTime;
+
+ // get current time
+ currentTime = current_time( );
+
+ // calculate time format
+ timeTicks = ( currentTime - timerStartTime );
+ ss = timeTicks % 10;
+ s = timeTicks / 10;
+ m = s / 60;
+ s = s % 60;
+ h = m / 60;
+ m = m % 60;
+
+ // print to screen
+ sprintf( timeBuffer, "<big>%.02d:%.02d:%.02d.%.1d</big>", h, m, s, ss);
+ gtk_label_set_markup( GTK_LABEL( timerLabel ), timeBuffer );
+
+ return TRUE;
+}
+
+
+static int current_time( void )
+{
+ struct timeval tv;
+ int s, us;
+
+ gettimeofday( &tv, NULL );
+ s = tv.tv_sec % 100000;
+ us = tv.tv_usec / 100000;
+
+ return ( s * 10 + us );
+}
+++ /dev/null
-// stopish.c
-//
-// Copyright 2009 Michael Cronenworth <mike@cchtml.com>
-//
-// This program 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 2 of the License, or
-// (at your option) any later version.
-//
-// This program 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, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-// MA 02110-1301, USA.
-
-
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include <gtk/gtk.h>
-#include <libosso.h>
-
-static GtkWidget *timerLabel = NULL;
-static int stopishMode = 0; // 0 = Start, 1 = Stop
-static int timerHandle = -1;
-static int timerStartTime = 0;
-static int timeTicks = 0;
-
-//Prototypes
-gint dbus_callback( const gchar *interface, const gchar *method,
- GArray *arguments, gpointer data, osso_rpc_t *retval );
-GtkWindow *stopish_new( void );
-static void start_cb( GtkButton* button, gpointer data );
-static void close_cb( GtkButton* button, gpointer data );
-static gint timeout_cb( gpointer data );
-static int current_time( void );
-
-
-int main( int argc, char *argv[] )
-{
- osso_context_t *ctxt;
- osso_return_t ret;
- GtkWindow *window;
-
- //printf( "stopish: starting up\n" );
-
- ctxt = osso_initialize( "com.nokia.stopish", PACKAGE_VERSION, TRUE, NULL );
- if ( ctxt == NULL ) {
- fprintf( stderr, "osso_initialize failed.\n" );
- exit( 1 );
- }
-
- gtk_init( &argc, &argv );
-
- window = stopish_new( );
-
- ret = osso_rpc_set_default_cb_f( ctxt, dbus_callback, window );
- if ( ret != OSSO_OK ) {
- fprintf( stderr, "osso_rpc_set_default_cb_f failed: %d.\n", ret );
- exit( 1 );
- }
-
- gtk_main( );
-
- return 0;
-}
-
-
-gint dbus_callback( const gchar *interface, const gchar *method,
- GArray *arguments, gpointer data, osso_rpc_t *retval )
-{
- //printf( "stopish dbus: %s, %s\n", interface, method );
-
- if ( !strcmp( method, "top_application" ) )
- gtk_window_present( GTK_WINDOW( data ) );
-
- retval->type = DBUS_TYPE_INVALID;
-
- return OSSO_OK;
-}
-
-
-GtkWindow *stopish_new( void )
-{
- GtkWidget *window, *hBox, *label, *button;
- GtkWidget *vBox, *vBox0;
-
- window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
-
- gtk_container_set_border_width( GTK_CONTAINER( window ), 20 );
-
- gtk_window_set_title( GTK_WINDOW( window ), "Stopish" );
-
- g_signal_connect( G_OBJECT( window ), "destroy",
- G_CALLBACK( close_cb ), window );
-
- vBox = gtk_vbox_new( FALSE, 10 );
-
- label = gtk_label_new( "Stopish - The Stopwatch" );
- gtk_box_pack_start( GTK_BOX( vBox ), label, FALSE, FALSE, 0 );
-
- hBox = gtk_hbox_new( FALSE, 10 );
-
- // stop watch area
- timerLabel = gtk_label_new( NULL );
- gtk_label_set_markup( GTK_LABEL( timerLabel ), "<big>00:00:00.0</big>" );
- gtk_container_add( GTK_CONTAINER( hBox ), timerLabel );
-
- // button area
- vBox0 = gtk_vbox_new( FALSE, 10 );
-
- // close button
- button = gtk_button_new( );
- label = gtk_label_new( "Start" );
- gtk_container_add( GTK_CONTAINER( button ), label );
- g_signal_connect( G_OBJECT( button ), "clicked",
- G_CALLBACK( start_cb ), label );
- gtk_box_pack_start( GTK_BOX( vBox0 ), button, FALSE, FALSE, 0 );
-
- // start stopwatch button
- button = gtk_button_new_with_label( "Close" );
- g_signal_connect( G_OBJECT( button ), "clicked",
- G_CALLBACK( close_cb ), window );
- gtk_box_pack_start( GTK_BOX( vBox0 ), button, FALSE, FALSE, 0 );
-
- gtk_container_add( GTK_CONTAINER( hBox ), vBox0 );
-
- gtk_container_add( GTK_CONTAINER( vBox ), hBox );
-
- gtk_container_add( GTK_CONTAINER( window ), vBox );
-
- gtk_widget_show_all( window );
-
- return GTK_WINDOW( window );
-}
-
-
-static void start_cb( GtkButton* button, gpointer data )
-{
- if ( stopishMode == 0 ) {
- // set label text and add timer handle
- gtk_label_set_text( GTK_LABEL( data ), "Stop" );
- stopishMode = 1;
- timerHandle = g_timeout_add( 100, timeout_cb, NULL );
- timerStartTime = current_time( ) - timeTicks;
- }
- else {
- // set label text and remove timer handle
- gtk_label_set_text( GTK_LABEL( data ), "Start" );
- stopishMode = 0;
- timerStartTime = 0;
- timeTicks = 0;
- gtk_label_set_markup( GTK_LABEL( timerLabel ),
- "<big>00:00:00.0</big>" );
- g_source_remove( timerHandle );
- }
-}
-
-
-static void close_cb( GtkButton* button, gpointer data )
-{
- // destroy main window and exit gtk main loop
- gtk_widget_destroy( GTK_WIDGET( data ) );
- gtk_main_quit( );
-}
-
-
-static gint timeout_cb( gpointer data )
-{
- static char timeBuffer[64];
- int h, m, s, ss, currentTime;
-
- // get current time
- currentTime = current_time( );
-
- // calculate time format
- timeTicks = ( currentTime - timerStartTime );
- ss = timeTicks % 10;
- s = timeTicks / 10;
- m = s / 60;
- s = s % 60;
- h = m / 60;
- m = m % 60;
-
- // print to screen
- sprintf( timeBuffer, "<big>%.02d:%.02d:%.02d.%.1d</big>", h, m, s, ss);
- gtk_label_set_markup( GTK_LABEL( timerLabel ), timeBuffer );
-
- return TRUE;
-}
-
-
-static int current_time( void )
-{
- struct timeval tv;
- int s, us;
-
- gettimeofday( &tv, NULL );
- s = tv.tv_sec % 100000;
- us = tv.tv_usec / 100000;
-
- return ( s * 10 + us );
-}
+++ /dev/null
-[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Application
-Name=Stopish
-Exec=/usr/bin/stopish
-Icon=stopish
-X-Window-Icon=tn-bookmarks-link
-X-HildonDesk-ShowInToolbar=true
-X-Osso-Service=com.nokia.stopish
-X-Osso-Type=application/x-executable
-Terminal=false