Some code cleanups.
authorwellu <wellu@wellu.org>
Thu, 28 Aug 2008 18:20:27 +0000 (18:20 +0000)
committerwellu <wellu@wellu.org>
Thu, 28 Aug 2008 18:20:27 +0000 (18:20 +0000)
Added .desktop and .service thus integrates nicely in to the menus etc.
Version number to 0.2.

git-svn-id: file:///svnroot/speedometer/trunk@12 df364472-da61-43ef-8a67-511c89aa921b

Makefile
callbacks.c [new file with mode: 0644]
callbacks.h [new file with mode: 0644]
data/speedometer.desktop [new file with mode: 0644]
data/speedometer.service [new file with mode: 0644]
debian/changelog
debian/control
main.c

index 24838d4..0650c32 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,8 @@ CFLAGS   = -g -Wall
 INCPATH  = `pkg-config --cflags gtk+-2.0 liblocation`
 LIBS     = `pkg-config --libs gtk+-2.0 liblocation`
 
-SOURCES  = main.c
-OBJECTS  = main.o
+SOURCES  = main.c callbacks.c
+OBJECTS  = main.o callbacks.o
 TARGET   = speedometer
 
 
@@ -28,6 +28,9 @@ $(OBJECTS): $(SOURCES)
 clean:
        rm -f $(OBJECTS) $(TARGET)
 
-install:
+install: all
        install -D -m 755 speedometer $(DESTDIR)/usr/bin/speedometer
+       install -D data/speedometer.desktop $(DESTDIR)/usr/share/applications/hildon/speedometer.desktop
+       install -D data/speedometer.service $(DESTDIR)/usr/share/dbus-1/services/speedometer.service
+
 
diff --git a/callbacks.c b/callbacks.c
new file mode 100644 (file)
index 0000000..2cc1c37
--- /dev/null
@@ -0,0 +1,26 @@
+/****
+       Speedometer, shows your current speed using GPS
+       Copyright (C) 2008 Wellu Mäkinen <wellu@wellu.org>
+
+       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 3 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, see <http://www.gnu.org/licenses/>.
+****/
+
+#include "callbacks.h"
+
+void location_changed(LocationGPSDevice *device, gpointer userdata) {
+        g_print ("Latitude: %.2f\nLongitude: %.2f\nAltitude: %.2f\n",
+                 device->fix->latitude, device->fix->longitude, device->fix->altitude);
+}
+
+
diff --git a/callbacks.h b/callbacks.h
new file mode 100644 (file)
index 0000000..1df70cd
--- /dev/null
@@ -0,0 +1,27 @@
+/****
+       Speedometer, shows your current speed using GPS
+       Copyright (C) 2008 Wellu Mäkinen <wellu@wellu.org>
+
+       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 3 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, see <http://www.gnu.org/licenses/>.
+****/
+
+#ifndef CALLBACKS_H_
+#define CALLBACKS_H_
+
+#include <location/location-gps-device.h>
+
+// called by GPSD whenever location changes
+void location_changed(LocationGPSDevice *device, gpointer userdata);
+
+#endif /* CALLBACKS_H_ */
diff --git a/data/speedometer.desktop b/data/speedometer.desktop
new file mode 100644 (file)
index 0000000..dba3cb0
--- /dev/null
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Name=Speedometer
+Exec=/usr/bin/speedometer
+Icon=speedometer
+X-Window-Icon=speedometer
+X-Window-Icon-Dimmed=speedometer
+X-Osso-Service=org.wellu.speedometer
+
+
+
diff --git a/data/speedometer.service b/data/speedometer.service
new file mode 100644 (file)
index 0000000..090ff58
--- /dev/null
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.wellu.speedometer
+Exec=/usr/bin/speedometer
+
+
index 9ed5431..4d05b0c 100644 (file)
@@ -1,3 +1,10 @@
+speedometer (0.2) unstable; urgency=low
+
+  * Added .desktop and .service files.
+  * Code cleanups.
+
+ -- Wellu Mäkinen <wellu@wellu.org>  Thu, 28 Aug 2008 21:16:05 +0300
+
 speedometer (0.1) unstable; urgency=low
 
   * Initial Release.
index ee85281..5132b74 100644 (file)
@@ -1,5 +1,5 @@
 Source: speedometer
-Section: user/utils
+Section: user/other
 Priority: extra
 Maintainer: Wellu Mäkinen <wellu@wellu.org>
 Build-Depends: debhelper (>= 5), liblocation-dev
@@ -11,4 +11,19 @@ Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Speedometer shows current speed on the screen.
  Speedometer shows your current speed in various units
  on the device screen. Speed is taken from GPS connection.
+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=
+
 
diff --git a/main.c b/main.c
index f7c2597..a082549 100644 (file)
--- a/main.c
+++ b/main.c
        along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****/
 
-
-
 #include <stdlib.h>
 #include <gtk/gtk.h>
 #include <location/location-gps-device.h>
 #include <location/location-gpsd-control.h>
 
-static void location_changed (LocationGPSDevice *device, gpointer userdata) {
-        g_print ("Latitude: %.2f\nLongitude: %.2f\nAltitude: %.2f\n",
-                 device->fix->latitude, device->fix->longitude, device->fix->altitude);
-}
-
-
-
-
-
-
+#include "callbacks.h"
 
 int main(int argc, char** argv) {
 
@@ -49,18 +38,7 @@ int main(int argc, char** argv) {
 
   /* Create a window with window border width of 12 pixels and a
      title text. */
-  window = g_object_new(GTK_TYPE_WINDOW,
-    "border-width", 12,
-    "title", "Hello GTK+",
-    NULL);
-
-  /* Create the label widget. */
-  label = g_object_new(GTK_TYPE_LABEL,
-    "label", "Hello World!",
-    NULL);
-
-  /* Pack the label into the window layout. */
-  gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(label));
+  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
   /* Show all widgets that are contained by the window. */
   gtk_widget_show_all(GTK_WIDGET(window));
@@ -78,7 +56,7 @@ int main(int argc, char** argv) {
 
   LocationGPSDControl *control;
 
-  control = location_gpsd_control_get_default ();
+  control = location_gpsd_control_get_default();
   location_gpsd_control_start(control);
 
 
@@ -86,6 +64,8 @@ int main(int argc, char** argv) {
   /* Start the main event loop. */
   gtk_main();
 
+
+
   return EXIT_SUCCESS;
 }