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 <math.h>
#include <location/location-gps-device.h>
#include <location/location-gpsd-control.h>
#include <gconf/gconf-client.h>
+#include <glib/gprintf.h>
#include "util.h"
#include "appdata.h"
#include "callbacks.h"
#include "ui.h"
-
-gdouble unit_array[] = {3.6};
+/* This is used when converting to other units
+ * number represents a multiplier which is used
+ * when converting the base unit to other units.
+ * Base unit is m/s thus the first multiplier is
+ * one. Units are in following order:
+ *
+ * m/s, km/h, mph
+ */
+gdouble conversion[] = { 1, 3.6, 2.237 };
#define GCONF_KEY "/apps/Maemo/speedometer/disclaimer"
g_assert(appdata);
g_assert(!isnan(speed));
+ /* speed is in m/s so let's convert
+ * it to the unit that we are using
+ */
+ speed *= conversion[appdata->unit];
+
// convert float to a 6 digits (including dot) wide string with leading zeros
gchar* charspeed = g_malloc(10); // alloc
g_sprintf(charspeed, "%0*.2f", 6, speed);
}
-static show_dialog() {
+static void show_dialog() {
GtkWidget *dialog = gtk_message_dialog_new(
NULL,
GTK_DIALOG_MODAL,
"which means (among other things) that you don't have to pay "
"a dime for it. "
"If you think, however, that this software is worth it, you "
- "can always drop me a postcard. (or a speeding ticket :)\n\n"
+ "can always drop me a postcard.\n\n"
"Wellu Mäkinen\n"
"PO BOX\n"
"33580 Tampere\n"
g_object_unref(client);
}
+void load_settings() {
+
+}