-.deps
-.libs
-Makefile.in
-aclocal.m4
-autom4te.cache
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-depcomp
-install-sh
+*.o
*.la
*.lo
-*.o
-libtool
-ltmain.sh
-missing
-stamp-h1
-*.desktop
*~
+++ /dev/null
-Maemo Team <xxxx@maemo.org>
+++ /dev/null
-Copyright (C) 2009 Nokia Corporation. All rights reserved.
-
-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:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE
+++ /dev/null
-2009-06-24 Maemo Team <xxxx@maemo.org>
-
- * Autotoolized and debianized
+++ /dev/null
-# We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
-# so we can specify the non-standard installation directory.
-desktoplib_LTLIBRARIES = lib-timeout-home-widget.la
-desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
-
-lib_timeout_home_widget_la_SOURCES = lib-timeout-home-widget.c lib-timeout-home-widget.h location-provider.h location-provider.c
-lib_timeout_home_widget_la_LIBADD = $(EXAMPLE_LIBS)
-
-AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS)
-
-# .desktop file
-desktopdir = $(HILDON_HOME_DESKTOP_DIR)
-desktop_DATA = timeout-home-widget.desktop
-
-DISTCLEANFILES = $(desktop_DATA)
+++ /dev/null
-Example Home widget. Provides TimeOut applet for the Home Area of the desktop.
+++ /dev/null
-#!/bin/sh
-
-set -ex
-if test -f Makefile; then
- make distclean
-fi
-rm -f *.tar.* *.tgz
-rm -Rf autom4te.cache
-rm -f Makefile.in aclocal.m4 configure depcomp install-sh missing ltmain.sh config.guess config.sub config.h.in mkinstalldirs INSTALL
+++ /dev/null
-#!/bin/sh
-
-set -ex
-autoreconf --install --force
+++ /dev/null
-AC_PREREQ(2.61)
-AC_INIT([hildon-timeout-desktop-widget-example], [0.1])
-AC_CONFIG_SRCDIR([lib-timeout-home-widget.c])
-AM_INIT_AUTOMAKE
-AC_CONFIG_HEADER([config.h])
-
-AC_PROG_CC
-AC_HEADER_STDC
-AC_PROG_INSTALL
-AM_PROG_LIBTOOL
-
-PKG_CHECK_MODULES(EXAMPLE, hildon-1 libhildondesktop-1 gtk+-2.0 liblocation)
-AC_SUBST(EXAMPLE_CFLAGS)
-AC_SUBST(EXAMPLE_LIBS)
-
-# Discover where to install the .desktop file:
-HILDON_HOME_DESKTOP_DIR=`pkg-config libhildondesktop-1 --variable=hildonhomedesktopentrydir`
-AC_SUBST(HILDON_HOME_DESKTOP_DIR)
-
-# Discover where to install the status widget's lib file:
-HILDON_DESKTOP_LIB_DIR=`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir`
-AC_SUBST(HILDON_DESKTOP_LIB_DIR)
-
-
-AC_OUTPUT(Makefile)
-AC_OUTPUT(timeout-home-widget.desktop)
+++ /dev/null
-#include "coordinate-system.h"
-
-#include <math.h>
-
-
-// Degrees to radians
-double radians(double deg) {
- return deg * M_PI / 180.0;
-}
-
-// Radians to degrees
-double degrees(double rad) {
- return rad * 180.0 / M_PI;
-}
-
-
-// Constants
-// Longitude0 and Center meridian of KKJ bands
-const double KKJ_ZONE_INFO[6][2] = { {18.0, 500000.0},
- {21.0, 1500000.0},
- {24.0, 2500000.0},
- {27.0, 3500000.0},
- {30.0, 4500000.0},
- {33.0, 5500000.0} };
-
-
-// Function: KKJ_Zone_I
-int KKJ_Zone_I(KKJ easting) {
- int zoneNumber = floor(easting / 1000000.0);
- if (zoneNumber < 0 || zoneNumber > 5) {
- zoneNumber = -1;
- }
-
- return zoneNumber;
-}
-
-
-// Function: KKJ_Zone_Lo
-int KKJ_Zone_Lo(double kkjlo) {
- // determine the zonenumber from KKJ easting
- // takes KKJ zone which has center meridian
- // longitude nearest (in math value) to
- // the given KKJ longitude
- int zoneNumber = 5;
- while (zoneNumber >= 0) {
- if (fabs(kkjlo - KKJ_ZONE_INFO[zoneNumber][0]) <= 1.5) {
- break;
- }
- zoneNumber--;
- }
-
- return zoneNumber;
-}
-
-
-// Function: KKJlalo_to_WGS84lalo
-void KKJlola_to_WGS84lola(double kkjlo, double kkjla, double *outLongitude, double *outLatitude) {
- double dLa = radians(0.124867E+01 + -0.269982E+00 * kkjla + 0.191330E+00 * kkjlo + 0.356119E-02 * kkjla * kkjla + -0.122312E-02 * kkjla * kkjlo + -0.335514E-03 * kkjlo * kkjlo) / 3600.0;
- double dLo = radians(-0.286111E+02 + 0.114183E+01 * kkjla + -0.581428E+00 * kkjlo + -0.152421E-01 * kkjla * kkjla + 0.118177E-01 * kkjla * kkjlo + 0.826646E-03 * kkjlo * kkjlo) / 3600.0;
-
- *outLatitude = degrees(radians(kkjla) + dLa);
- *outLongitude = degrees(radians(kkjlo) + dLo);
-}
-
-
-// Function: WGS84lalo_to_KKJlalo
-void WGS84lola_to_KKJlola(double longitude, double latitude, double *outLongitude, double *outLatitude) {
- double dLa = radians(-0.124766E+01 + 0.269941E+00 * latitude + -0.191342E+00 * longitude + -0.356086E-02 * latitude * latitude + 0.122353E-02 * latitude * longitude + 0.335456E-03 * longitude * longitude) / 3600.0;
- double dLo = radians(0.286008E+02 + -0.114139E+01 * latitude + 0.581329E+00 * longitude + 0.152376E-01 * latitude * latitude + -0.118166E-01 * latitude * longitude + -0.826201E-03 * longitude * longitude) / 3600.0;
-
- *outLatitude = degrees(radians(latitude) + dLa);
- *outLongitude = degrees(radians(longitude) + dLo);
-}
-
-
-// Function: KKJlalo_to_KKJxy
-void KKJlola_to_KKJxy(double lon, double lat, int zoneNumber, KKJ *outX, KKJ *outY) {
- // Hayford ellipsoid
- double a = 6378388.0;
- double f = 1.0 / 297.0;
- double b = (1.0 - f) * a;
- double bb = b * b;
- double c = (a / b) * a;
- double ee = (a * a - bb) / bb;
- double n = (a - b) / (a + b);
- double nn = n * n;
-
- double Lo = radians(lon) - radians(KKJ_ZONE_INFO[zoneNumber][0]);
- double cosLa = cos(radians(lat));
- double NN = ee * cosLa * cosLa;
- double LaF = atan(tan(radians(lat)) / cos(Lo * sqrt(1.0 + NN)));
- double cosLaF = cos(LaF);
- double t = (tan(Lo) * cosLaF) / sqrt(1.0 + ee * cosLaF * cosLaF);
- double A = a / (1.0 + n);
- double A1 = A * (1.0 + nn / 4.0 + nn * nn / 64.0);
- double A2 = A * 1.5 * n * (1.0 - nn / 8.0);
- double A3 = A * 0.9375 * nn * (1.0 - nn / 4.0);
- double A4 = A * 35.0 / 48.0 * nn * n;
-
- *outY = A1 * LaF - A2 * sin(2.0 * LaF) + A3 * sin(4.0 * LaF) - A4 * sin(6.0 * LaF);
- *outX = c * log(t + sqrt(1.0 + t * t)) + 500000.0 + zoneNumber * 1000000.0;
-}
-
-// Function: KKJxy_to_KKJlalo
-void KKJxy_to_KKJlola(KKJ x, KKJ y, double *outLongitude, double *outLatitude) {
- // Scan iteratively the target area, until find matching
- // KKJ coordinate value. Area is defined with Hayford Ellipsoid.
- int zoneNumber = KKJ_Zone_I(x);
- double minLo = radians(18.5);
- double maxLo = radians(32.0);
- double minLa = radians(59.0);
- double maxLa = radians(70.5);
-
- int i = 1;
- KKJ tmpX, tmpY;
-
- while (i < 35) {
- double deltaLo = maxLo - minLo;
- double deltaLa = maxLa - minLa;
- *outLongitude = degrees(minLo + 0.5 * deltaLo);
- *outLatitude = degrees(minLa + 0.5 * deltaLa);
- KKJlola_to_KKJxy(*outLongitude, *outLatitude, zoneNumber, &tmpX, &tmpY);
- if (tmpY < y) {
- minLa = minLa + 0.45 * deltaLa;
- } else {
- maxLa = minLa + 0.55 * deltaLa;
- }
-
- if (tmpX < x) {
- minLo = minLo + 0.45 * deltaLo;
- } else {
- maxLo = minLo + 0.55 * deltaLo;
- }
-
- i++;
- }
-}
-
- ////////////////////
- // PUBLIC METHODS //
-////////////////////
-
-void WGS84lola_to_KKJxy(double longitude, double latitude, KKJ *outX, KKJ *outY) {
- double kkjlo, kkjla;
-
- WGS84lola_to_KKJlola(longitude, latitude, &kkjlo, &kkjla);
- int zoneNumber = KKJ_Zone_Lo(kkjlo);
- KKJlola_to_KKJxy(kkjlo, kkjla, zoneNumber, outX, outY);
- }
-
-void KKJxy_to_WGS84lola(KKJ x, KKJ y, double *outLongitude, double *outLatitude) {
- double kkjlo, kkjla;
-
- KKJxy_to_KKJlola(x, y, &kkjlo, &kkjla);
- KKJlola_to_WGS84lola(kkjlo, kkjla, outLongitude, outLatitude);
-}
+++ /dev/null
-#ifndef COORDINATE_SYSTEM_H
-#define COORDINATE_SYSTEM_H
-
-// Type for KKJ x/y coordinates
-typedef unsigned int KKJ;
-
-/**
- * Transformes WGS84 longitude/latitude coordinates to KKJ x/y coordinates.
- * @param longitude the input longitude in degrees
- * @param latitude the input latitude in degrees
- * @param outX the result x (easting)
- * @param outY the result y (northing)
- */
-void WGS84lola_to_KKJxy(double longitude, double latitude, KKJ *outX, KKJ *outY);
-
-/**
- * Transformes KKJ x/y coordinates to WGS84 longitude/latitude coordinates.
- * @param x the input x (easting)
- * @param y the input y (northing)
- * @param outLongitude the result longitude in degrees
- * @param outLatitude the result latitude in degrees
- */
-void KKJxy_to_WGS84lola(KKJ x, KKJ y, double *outLongitude, double *outLatitude);
-
-#endif
+++ /dev/null
-hildon-timeout-home-widget-example (0.1-1) unstable; urgency=low
-
- * Autotoolized and debianized
-
- -- Maemo Team <xxxx@maemo.org> Wed, 24 Jun 2009 16:22:18 +0300
-
+++ /dev/null
-Source: hildon-timeout-home-widget-example
-Section: user/desktop
-Priority: optional
-Maintainer: Maemo Team <xxxx@maemo.org>
-Build-Depends: debhelper (>= 5), autotools-dev, libhildondesktop1-dev (>= 2.1.16)
-Standards-Version: 3.7.2
-
-Package: hildon-timeout-home-widget-example
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Example home widget
- An example home widget for Maemo.
+++ /dev/null
-This package was debianized by Maemo Team <xxxx@maemo.org> on
-Wed, 24 Jun 2009 16:22:18 +0300.
-
-Copyright (C) 2009 Nokia Corporation. All rights reserved.
-
-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:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE
+++ /dev/null
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-
-# These are used for cross-compiling and for saving the configure script
-# from having to guess our platform (since we know it already)
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-
-config.status: configure
- dh_testdir
- # Add here commands to configure the package.
- ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
-
-
-build: build-stamp
-
-build-stamp: config.status
- dh_testdir
-
- # Add here commands to compile the package.
- $(MAKE)
- #docbook-to-man debian/hildon-timeout-home-widget-example.sgml > hildon-timeout-home-widget-example.1
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp
-
- # Add here commands to clean up after the build process.
- -$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
- cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
- cp -f /usr/share/misc/config.guess config.guess
-endif
-
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- # Add here commands to install the package into debian/hildon-timeout-home-widget-example.
- $(MAKE) DESTDIR=$(CURDIR)/debian/hildon-timeout-home-widget-example install
-
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs ChangeLog
- dh_installdocs
- dh_installexamples
-# dh_install
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
-# dh_installinit
-# dh_installcron
-# dh_installinfo
- dh_installman
- dh_link
- dh_strip
- dh_compress
- dh_fixperms
-# dh_perl
-# dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+.deps
+.libs
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+depcomp
+install-sh
+libtool
+ltmain.sh
+missing
+stamp-h1
+*.desktop
+*~
--- /dev/null
+Maemo Team <xxxx@maemo.org>
--- /dev/null
+Copyright (C) 2009 Nokia Corporation. All rights reserved.
+
+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:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE
--- /dev/null
+2009-06-24 Maemo Team <xxxx@maemo.org>
+
+ * Autotoolized and debianized
--- /dev/null
+# We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
+# so we can specify the non-standard installation directory.
+desktoplib_LTLIBRARIES = lib-timeout-home-widget.la
+desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
+
+lib_timeout_home_widget_la_SOURCES = lib-timeout-home-widget.c lib-timeout-home-widget.h location-provider.h location-provider.c
+lib_timeout_home_widget_la_LIBADD = $(EXAMPLE_LIBS)
+
+AM_CFLAGS = -Wall $(EXAMPLE_CFLAGS)
+
+# .desktop file
+desktopdir = $(HILDON_HOME_DESKTOP_DIR)
+desktop_DATA = timeout-home-widget.desktop
+
+DISTCLEANFILES = $(desktop_DATA)
--- /dev/null
+Example Home widget. Provides TimeOut applet for the Home Area of the desktop.
--- /dev/null
+#!/bin/sh
+
+set -ex
+if test -f Makefile; then
+ make distclean
+fi
+rm -f *.tar.* *.tgz
+rm -Rf autom4te.cache
+rm -f Makefile.in aclocal.m4 configure depcomp install-sh missing ltmain.sh config.guess config.sub config.h.in mkinstalldirs INSTALL
--- /dev/null
+#!/bin/sh
+
+set -ex
+autoreconf --install --force
--- /dev/null
+AC_PREREQ(2.61)
+AC_INIT([hildon-timeout-desktop-widget-example], [0.1])
+AC_CONFIG_SRCDIR([lib-timeout-home-widget.c])
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADER([config.h])
+
+AC_PROG_CC
+AC_HEADER_STDC
+AC_PROG_INSTALL
+AM_PROG_LIBTOOL
+
+PKG_CHECK_MODULES(EXAMPLE, hildon-1 libhildondesktop-1 gtk+-2.0 liblocation)
+AC_SUBST(EXAMPLE_CFLAGS)
+AC_SUBST(EXAMPLE_LIBS)
+
+# Discover where to install the .desktop file:
+HILDON_HOME_DESKTOP_DIR=`pkg-config libhildondesktop-1 --variable=hildonhomedesktopentrydir`
+AC_SUBST(HILDON_HOME_DESKTOP_DIR)
+
+# Discover where to install the status widget's lib file:
+HILDON_DESKTOP_LIB_DIR=`pkg-config libhildondesktop-1 --variable=hildondesktoplibdir`
+AC_SUBST(HILDON_DESKTOP_LIB_DIR)
+
+
+AC_OUTPUT(Makefile)
+AC_OUTPUT(timeout-home-widget.desktop)
--- /dev/null
+#include "coordinate-system.h"
+
+#include <math.h>
+
+
+// Degrees to radians
+double radians(double deg) {
+ return deg * M_PI / 180.0;
+}
+
+// Radians to degrees
+double degrees(double rad) {
+ return rad * 180.0 / M_PI;
+}
+
+
+// Constants
+// Longitude0 and Center meridian of KKJ bands
+const double KKJ_ZONE_INFO[6][2] = { {18.0, 500000.0},
+ {21.0, 1500000.0},
+ {24.0, 2500000.0},
+ {27.0, 3500000.0},
+ {30.0, 4500000.0},
+ {33.0, 5500000.0} };
+
+
+// Function: KKJ_Zone_I
+int KKJ_Zone_I(KKJ easting) {
+ int zoneNumber = floor(easting / 1000000.0);
+ if (zoneNumber < 0 || zoneNumber > 5) {
+ zoneNumber = -1;
+ }
+
+ return zoneNumber;
+}
+
+
+// Function: KKJ_Zone_Lo
+int KKJ_Zone_Lo(double kkjlo) {
+ // determine the zonenumber from KKJ easting
+ // takes KKJ zone which has center meridian
+ // longitude nearest (in math value) to
+ // the given KKJ longitude
+ int zoneNumber = 5;
+ while (zoneNumber >= 0) {
+ if (fabs(kkjlo - KKJ_ZONE_INFO[zoneNumber][0]) <= 1.5) {
+ break;
+ }
+ zoneNumber--;
+ }
+
+ return zoneNumber;
+}
+
+
+// Function: KKJlalo_to_WGS84lalo
+void KKJlola_to_WGS84lola(double kkjlo, double kkjla, double *outLongitude, double *outLatitude) {
+ double dLa = radians(0.124867E+01 + -0.269982E+00 * kkjla + 0.191330E+00 * kkjlo + 0.356119E-02 * kkjla * kkjla + -0.122312E-02 * kkjla * kkjlo + -0.335514E-03 * kkjlo * kkjlo) / 3600.0;
+ double dLo = radians(-0.286111E+02 + 0.114183E+01 * kkjla + -0.581428E+00 * kkjlo + -0.152421E-01 * kkjla * kkjla + 0.118177E-01 * kkjla * kkjlo + 0.826646E-03 * kkjlo * kkjlo) / 3600.0;
+
+ *outLatitude = degrees(radians(kkjla) + dLa);
+ *outLongitude = degrees(radians(kkjlo) + dLo);
+}
+
+
+// Function: WGS84lalo_to_KKJlalo
+void WGS84lola_to_KKJlola(double longitude, double latitude, double *outLongitude, double *outLatitude) {
+ double dLa = radians(-0.124766E+01 + 0.269941E+00 * latitude + -0.191342E+00 * longitude + -0.356086E-02 * latitude * latitude + 0.122353E-02 * latitude * longitude + 0.335456E-03 * longitude * longitude) / 3600.0;
+ double dLo = radians(0.286008E+02 + -0.114139E+01 * latitude + 0.581329E+00 * longitude + 0.152376E-01 * latitude * latitude + -0.118166E-01 * latitude * longitude + -0.826201E-03 * longitude * longitude) / 3600.0;
+
+ *outLatitude = degrees(radians(latitude) + dLa);
+ *outLongitude = degrees(radians(longitude) + dLo);
+}
+
+
+// Function: KKJlalo_to_KKJxy
+void KKJlola_to_KKJxy(double lon, double lat, int zoneNumber, KKJ *outX, KKJ *outY) {
+ // Hayford ellipsoid
+ double a = 6378388.0;
+ double f = 1.0 / 297.0;
+ double b = (1.0 - f) * a;
+ double bb = b * b;
+ double c = (a / b) * a;
+ double ee = (a * a - bb) / bb;
+ double n = (a - b) / (a + b);
+ double nn = n * n;
+
+ double Lo = radians(lon) - radians(KKJ_ZONE_INFO[zoneNumber][0]);
+ double cosLa = cos(radians(lat));
+ double NN = ee * cosLa * cosLa;
+ double LaF = atan(tan(radians(lat)) / cos(Lo * sqrt(1.0 + NN)));
+ double cosLaF = cos(LaF);
+ double t = (tan(Lo) * cosLaF) / sqrt(1.0 + ee * cosLaF * cosLaF);
+ double A = a / (1.0 + n);
+ double A1 = A * (1.0 + nn / 4.0 + nn * nn / 64.0);
+ double A2 = A * 1.5 * n * (1.0 - nn / 8.0);
+ double A3 = A * 0.9375 * nn * (1.0 - nn / 4.0);
+ double A4 = A * 35.0 / 48.0 * nn * n;
+
+ *outY = A1 * LaF - A2 * sin(2.0 * LaF) + A3 * sin(4.0 * LaF) - A4 * sin(6.0 * LaF);
+ *outX = c * log(t + sqrt(1.0 + t * t)) + 500000.0 + zoneNumber * 1000000.0;
+}
+
+// Function: KKJxy_to_KKJlalo
+void KKJxy_to_KKJlola(KKJ x, KKJ y, double *outLongitude, double *outLatitude) {
+ // Scan iteratively the target area, until find matching
+ // KKJ coordinate value. Area is defined with Hayford Ellipsoid.
+ int zoneNumber = KKJ_Zone_I(x);
+ double minLo = radians(18.5);
+ double maxLo = radians(32.0);
+ double minLa = radians(59.0);
+ double maxLa = radians(70.5);
+
+ int i = 1;
+ KKJ tmpX, tmpY;
+
+ while (i < 35) {
+ double deltaLo = maxLo - minLo;
+ double deltaLa = maxLa - minLa;
+ *outLongitude = degrees(minLo + 0.5 * deltaLo);
+ *outLatitude = degrees(minLa + 0.5 * deltaLa);
+ KKJlola_to_KKJxy(*outLongitude, *outLatitude, zoneNumber, &tmpX, &tmpY);
+ if (tmpY < y) {
+ minLa = minLa + 0.45 * deltaLa;
+ } else {
+ maxLa = minLa + 0.55 * deltaLa;
+ }
+
+ if (tmpX < x) {
+ minLo = minLo + 0.45 * deltaLo;
+ } else {
+ maxLo = minLo + 0.55 * deltaLo;
+ }
+
+ i++;
+ }
+}
+
+ ////////////////////
+ // PUBLIC METHODS //
+////////////////////
+
+void WGS84lola_to_KKJxy(double longitude, double latitude, KKJ *outX, KKJ *outY) {
+ double kkjlo, kkjla;
+
+ WGS84lola_to_KKJlola(longitude, latitude, &kkjlo, &kkjla);
+ int zoneNumber = KKJ_Zone_Lo(kkjlo);
+ KKJlola_to_KKJxy(kkjlo, kkjla, zoneNumber, outX, outY);
+ }
+
+void KKJxy_to_WGS84lola(KKJ x, KKJ y, double *outLongitude, double *outLatitude) {
+ double kkjlo, kkjla;
+
+ KKJxy_to_KKJlola(x, y, &kkjlo, &kkjla);
+ KKJlola_to_WGS84lola(kkjlo, kkjla, outLongitude, outLatitude);
+}
--- /dev/null
+#ifndef COORDINATE_SYSTEM_H
+#define COORDINATE_SYSTEM_H
+
+// Type for KKJ x/y coordinates
+typedef unsigned int KKJ;
+
+/**
+ * Transformes WGS84 longitude/latitude coordinates to KKJ x/y coordinates.
+ * @param longitude the input longitude in degrees
+ * @param latitude the input latitude in degrees
+ * @param outX the result x (easting)
+ * @param outY the result y (northing)
+ */
+void WGS84lola_to_KKJxy(double longitude, double latitude, KKJ *outX, KKJ *outY);
+
+/**
+ * Transformes KKJ x/y coordinates to WGS84 longitude/latitude coordinates.
+ * @param x the input x (easting)
+ * @param y the input y (northing)
+ * @param outLongitude the result longitude in degrees
+ * @param outLatitude the result latitude in degrees
+ */
+void KKJxy_to_WGS84lola(KKJ x, KKJ y, double *outLongitude, double *outLatitude);
+
+#endif
--- /dev/null
+hildon-timeout-home-widget-example (0.1-1) unstable; urgency=low
+
+ * Autotoolized and debianized
+
+ -- Maemo Team <xxxx@maemo.org> Wed, 24 Jun 2009 16:22:18 +0300
+
--- /dev/null
+Source: hildon-timeout-home-widget-example
+Section: user/desktop
+Priority: optional
+Maintainer: Maemo Team <xxxx@maemo.org>
+Build-Depends: debhelper (>= 5), autotools-dev, libhildondesktop1-dev (>= 2.1.16)
+Standards-Version: 3.7.2
+
+Package: hildon-timeout-home-widget-example
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: Example home widget
+ An example home widget for Maemo.
--- /dev/null
+This package was debianized by Maemo Team <xxxx@maemo.org> on
+Wed, 24 Jun 2009 16:22:18 +0300.
+
+Copyright (C) 2009 Nokia Corporation. All rights reserved.
+
+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:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/hildon-timeout-home-widget-example.sgml > hildon-timeout-home-widget-example.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ -$(MAKE) distclean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/hildon-timeout-home-widget-example.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/hildon-timeout-home-widget-example install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+/*
+ * This file is part of hildon-timeout-home-widget-example
+ *
+ * Copyright (C) 2009 Nokia Corporation. All rights reserved.
+ *
+ * This maemo code example is licensed under a MIT-style license,
+ * that can be found in the file called "COPYING" in the root
+ * directory.
+ *
+ */
+
+#include <gtk/gtk.h>
+#include <hildon/hildon.h>
+
+#include "lib-timeout-home-widget.h"
+
+#include "location-provider.h"
+
+HD_DEFINE_PLUGIN_MODULE (TimeOutPlugin, time_out_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
+
+GtkTextBuffer *debugBuffer = NULL;
+
+static void printDebug(const char *msg)
+{
+ if (debugBuffer != NULL) {
+ gtk_text_buffer_insert_at_cursor(debugBuffer, msg, -1);
+ gtk_text_buffer_insert_at_cursor(debugBuffer, "\n", -1);
+ }
+}
+
+char debugStr[1024];
+#define debug(...) sprintf(debugStr, __VA_ARGS__); printDebug(debugStr)
+
+static void location_listener(double latitude, double longitude)
+{
+ debug("got location: %f, %f", latitude, longitude);
+}
+
+int locationTrackingOn = 0;
+void search_button_clicked(GtkButton *button, gpointer user_data)
+{
+ if (!locationTrackingOn) {
+ // Setup location tracking
+ setup_location_provider();
+ set_location_listener(location_listener);
+ start_location_provider();
+
+ locationTrackingOn = 1;
+ debug("Location tracking started");
+ } else {
+ stop_location_provider();
+ cleanup_location_provider();
+
+ locationTrackingOn = 0;
+ debug("Location tracking stopped");
+ }
+}
+
+static GtkWidget *build_ui(void)
+{
+ GtkVBox *contents = GTK_VBOX(gtk_vbox_new(0, FALSE));
+ GtkLabel *label = GTK_LABEL(gtk_label_new("Get me home"));
+// HildonPickerButton *action;
+// action = HILDON_PICKER_BUTTON (hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT,
+// HILDON_BUTTON_ARRANGEMENT_VERTICAL));
+// HildonTouchSelector *action_selector;
+// action_selector = HILDON_TOUCH_SELECTOR (hildon_touch_selector_new_text ());
+// hildon_button_set_title (HILDON_BUTTON (action), "Action");
+// hildon_touch_selector_append_text (action_selector, "Blank Screen");
+// hildon_touch_selector_append_text (action_selector, "Suspend");
+// hildon_touch_selector_append_text (action_selector, "Turn Off");
+// hildon_picker_button_set_selector (action, action_selector);
+// hildon_picker_button_set_active (action, 0);
+
+ GtkWidget* getmehomeButton = hildon_gtk_button_new(HILDON_SIZE_AUTO);
+ gtk_button_set_label(GTK_BUTTON(getmehomeButton), "Search");
+
+ g_signal_connect(getmehomeButton, "clicked", G_CALLBACK(search_button_clicked), NULL);
+
+// HildonTimeButton *time;
+// time = HILDON_TIME_BUTTON (hildon_time_button_new (HILDON_SIZE_FINGER_HEIGHT,
+// HILDON_BUTTON_ARRANGEMENT_VERTICAL));
+// hildon_time_button_set_time (time, 22, 00);
+
+ GtkHBox *buttons = GTK_HBOX(gtk_hbox_new(0, TRUE));
+ gtk_container_add(GTK_CONTAINER(buttons), GTK_WIDGET(getmehomeButton));
+// gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (action));
+// gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (time));
+
+ GtkWidget *debugView = hildon_text_view_new(); // gtk_text_view_new();
+ gtk_widget_set_size_request(GTK_WIDGET(debugView), 400, 200);
+ debugBuffer = hildon_text_view_get_buffer(HILDON_TEXT_VIEW(debugView)); // gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
+ GtkWidget* debugScroller = gtk_scrolled_window_new(NULL, NULL);
+ gtk_container_add(GTK_CONTAINER(debugScroller), GTK_WIDGET(debugView));
+
+ gtk_box_pack_start(GTK_BOX(contents), GTK_WIDGET(label), FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(contents), GTK_WIDGET(buttons), FALSE, FALSE, 0);
+ gtk_box_pack_end(GTK_BOX(contents), GTK_WIDGET(debugScroller), FALSE, FALSE, 0);
+ gtk_widget_show_all(GTK_WIDGET(contents));
+
+ return GTK_WIDGET(contents);
+}
+
+static void
+time_out_plugin_init (TimeOutPlugin *desktop_plugin)
+{
+ GtkWidget *contents = build_ui ();
+ gtk_container_add (GTK_CONTAINER (desktop_plugin), contents);
+}
+
+static void
+time_out_plugin_class_init (TimeOutPluginClass *class) {}
+
+static void
+time_out_plugin_class_finalize (TimeOutPluginClass *class) {}
--- /dev/null
+/*
+ * This file is part of hildon-timeout-home-widget-example
+ *
+ * Copyright (C) 2009 Nokia Corporation. All rights reserved.
+ *
+ * This maemo code example is licensed under a MIT-style license,
+ * that can be found in the file called "COPYING" in the root
+ * directory.
+ *
+ */
+
+#ifndef TIME_OUT_PLUGIN_H
+#define TIME_OUT_PLUGIN_H
+
+#include <glib-object.h>
+
+#include <libhildondesktop/libhildondesktop.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TimeOutPlugin TimeOutPlugin;
+typedef struct _TimeOutPluginClass TimeOutPluginClass;
+
+#define TIME_OUT_TYPE_HOME_PLUGIN (time_out_home_plugin_get_type ())
+
+#define TIME_OUT_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePlugin))
+
+#define TIME_OUT_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+ TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePluginClass))
+
+#define TIME_OUT_IS_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+ TIME_OUT_TYPE_HOME_PLUGIN))
+
+#define TIME_OUT_IS_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+ TIME_OUT_TYPE_HOME_PLUGIN))
+
+#define TIME_OUT_HOME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+ TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePluginClass))
+
+struct _TimeOutPlugin
+{
+ HDHomePluginItem hitem;
+};
+
+struct _TimeOutPluginClass
+{
+ HDHomePluginItemClass parent_class;
+};
+
+GType time_out_home_plugin_get_type(void);
+
+G_END_DECLS
+
+#endif
--- /dev/null
+#include "location-provider.h"
+
+#include <location/location-gps-device.h>
+#include <location/location-gpsd-control.h>
+
+void (*listener)(double, double) = NULL;
+
+/*static void on_error(LocationGPSDControl *control, LocationGPSDControlError error, gpointer data)
+{
+ g_debug("location error: %d... quitting", error);
+ g_main_loop_quit((GMainLoop *) data);
+}*/
+
+static void on_changed(LocationGPSDevice *device, gpointer data)
+{
+ if (device == NULL || listener == NULL) {
+ return;
+ }
+
+ if (device->fix) {
+ if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) {
+ listener(device->fix->latitude, device->fix->longitude);
+ }
+ }
+}
+
+/*static void on_stop(LocationGPSDControl *control, gpointer data)
+{
+ g_debug("quitting");
+ g_main_loop_quit((GMainLoop *) data);
+}*/
+
+/*static gboolean start_location(gpointer data)
+{
+ location_gpsd_control_start((LocationGPSDControl *) data);
+ return FALSE;
+}*/
+
+LocationGPSDControl *control = NULL;
+LocationGPSDevice *device = NULL;
+
+void setup_location_provider()
+{
+// GMainLoop *loop;
+
+// g_type_init();
+
+// loop = g_main_loop_new(NULL, FALSE);
+
+ if (control != NULL) {
+ return;
+ }
+
+ control = location_gpsd_control_get_default();
+ device = g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
+
+ g_object_set(G_OBJECT(control),
+ "preferred-method", LOCATION_METHOD_USER_SELECTED,
+ "preferred-interval", LOCATION_INTERVAL_DEFAULT,
+ NULL);
+
+// g_signal_connect(control, "error-verbose", G_CALLBACK(on_error), loop);
+ g_signal_connect(device, "changed", G_CALLBACK(on_changed), control);
+// g_signal_connect(control, "gpsd-stopped", G_CALLBACK(on_stop), loop);
+
+// g_idle_add(start_location, control);
+
+// g_main_loop_run(loop);
+}
+
+void cleanup_location_provider()
+{
+ if (control != NULL) {
+ location_gpsd_control_stop(control);
+
+ g_object_unref(device);
+ g_object_unref(control);
+ device = NULL;
+ control = NULL;
+ }
+}
+
+void start_location_provider()
+{
+ if (control != NULL) {
+ location_gpsd_control_start(control);
+ }
+}
+
+void stop_location_provider()
+{
+ if (control != NULL) {
+ location_gpsd_control_stop(control);
+ }
+}
+
+void set_location_listener(void (*newListener)(double, double))
+{
+ listener = newListener;
+}
--- /dev/null
+#ifndef LOCATION_PROVIDER_H
+#define LOCATION_PROVIDER_H
+
+void setup_location_provider();
+void cleanup_location_provider();
+
+void start_location_provider();
+void stop_location_provider();
+
+void set_location_listener(void (*newListener)(double, double));
+
+#endif
--- /dev/null
+[Desktop Entry]
+Name=TimeOut Widget
+Comment=Execute an action at a given time
+Type=default
+X-Path=lib-timeout-home-widget.so
+++ /dev/null
-/*
- * This file is part of hildon-timeout-home-widget-example
- *
- * Copyright (C) 2009 Nokia Corporation. All rights reserved.
- *
- * This maemo code example is licensed under a MIT-style license,
- * that can be found in the file called "COPYING" in the root
- * directory.
- *
- */
-
-#include <gtk/gtk.h>
-#include <hildon/hildon.h>
-
-#include "lib-timeout-home-widget.h"
-
-#include "location-provider.h"
-
-HD_DEFINE_PLUGIN_MODULE (TimeOutPlugin, time_out_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
-
-GtkTextBuffer *debugBuffer = NULL;
-
-static void printDebug(const char *msg)
-{
- if (debugBuffer != NULL) {
- gtk_text_buffer_insert_at_cursor(debugBuffer, msg, -1);
- gtk_text_buffer_insert_at_cursor(debugBuffer, "\n", -1);
- }
-}
-
-char debugStr[1024];
-#define debug(...) sprintf(debugStr, __VA_ARGS__); printDebug(debugStr)
-
-static void location_listener(double latitude, double longitude)
-{
- debug("got location: %f, %f", latitude, longitude);
-}
-
-int locationTrackingOn = 0;
-void search_button_clicked(GtkButton *button, gpointer user_data)
-{
- if (!locationTrackingOn) {
- // Setup location tracking
- setup_location_provider();
- set_location_listener(location_listener);
- start_location_provider();
-
- locationTrackingOn = 1;
- debug("Location tracking started");
- } else {
- stop_location_provider();
- cleanup_location_provider();
-
- locationTrackingOn = 0;
- debug("Location tracking stopped");
- }
-}
-
-static GtkWidget *build_ui(void)
-{
- GtkVBox *contents = GTK_VBOX(gtk_vbox_new(0, FALSE));
- GtkLabel *label = GTK_LABEL(gtk_label_new("Get me home"));
-// HildonPickerButton *action;
-// action = HILDON_PICKER_BUTTON (hildon_picker_button_new (HILDON_SIZE_FINGER_HEIGHT,
-// HILDON_BUTTON_ARRANGEMENT_VERTICAL));
-// HildonTouchSelector *action_selector;
-// action_selector = HILDON_TOUCH_SELECTOR (hildon_touch_selector_new_text ());
-// hildon_button_set_title (HILDON_BUTTON (action), "Action");
-// hildon_touch_selector_append_text (action_selector, "Blank Screen");
-// hildon_touch_selector_append_text (action_selector, "Suspend");
-// hildon_touch_selector_append_text (action_selector, "Turn Off");
-// hildon_picker_button_set_selector (action, action_selector);
-// hildon_picker_button_set_active (action, 0);
-
- GtkWidget* getmehomeButton = hildon_gtk_button_new(HILDON_SIZE_AUTO);
- gtk_button_set_label(GTK_BUTTON(getmehomeButton), "Search");
-
- g_signal_connect(getmehomeButton, "clicked", G_CALLBACK(search_button_clicked), NULL);
-
-// HildonTimeButton *time;
-// time = HILDON_TIME_BUTTON (hildon_time_button_new (HILDON_SIZE_FINGER_HEIGHT,
-// HILDON_BUTTON_ARRANGEMENT_VERTICAL));
-// hildon_time_button_set_time (time, 22, 00);
-
- GtkHBox *buttons = GTK_HBOX(gtk_hbox_new(0, TRUE));
- gtk_container_add(GTK_CONTAINER(buttons), GTK_WIDGET(getmehomeButton));
-// gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (action));
-// gtk_container_add (GTK_CONTAINER (buttons), GTK_WIDGET (time));
-
- GtkWidget *debugView = hildon_text_view_new(); // gtk_text_view_new();
- gtk_widget_set_size_request(GTK_WIDGET(debugView), 400, 200);
- debugBuffer = hildon_text_view_get_buffer(HILDON_TEXT_VIEW(debugView)); // gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
- GtkWidget* debugScroller = gtk_scrolled_window_new(NULL, NULL);
- gtk_container_add(GTK_CONTAINER(debugScroller), GTK_WIDGET(debugView));
-
- gtk_box_pack_start(GTK_BOX(contents), GTK_WIDGET(label), FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(contents), GTK_WIDGET(buttons), FALSE, FALSE, 0);
- gtk_box_pack_end(GTK_BOX(contents), GTK_WIDGET(debugScroller), FALSE, FALSE, 0);
- gtk_widget_show_all(GTK_WIDGET(contents));
-
- return GTK_WIDGET(contents);
-}
-
-static void
-time_out_plugin_init (TimeOutPlugin *desktop_plugin)
-{
- GtkWidget *contents = build_ui ();
- gtk_container_add (GTK_CONTAINER (desktop_plugin), contents);
-}
-
-static void
-time_out_plugin_class_init (TimeOutPluginClass *class) {}
-
-static void
-time_out_plugin_class_finalize (TimeOutPluginClass *class) {}
+++ /dev/null
-/*
- * This file is part of hildon-timeout-home-widget-example
- *
- * Copyright (C) 2009 Nokia Corporation. All rights reserved.
- *
- * This maemo code example is licensed under a MIT-style license,
- * that can be found in the file called "COPYING" in the root
- * directory.
- *
- */
-
-#ifndef TIME_OUT_PLUGIN_H
-#define TIME_OUT_PLUGIN_H
-
-#include <glib-object.h>
-
-#include <libhildondesktop/libhildondesktop.h>
-
-G_BEGIN_DECLS
-
-typedef struct _TimeOutPlugin TimeOutPlugin;
-typedef struct _TimeOutPluginClass TimeOutPluginClass;
-
-#define TIME_OUT_TYPE_HOME_PLUGIN (time_out_home_plugin_get_type ())
-
-#define TIME_OUT_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePlugin))
-
-#define TIME_OUT_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
- TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePluginClass))
-
-#define TIME_OUT_IS_HOME_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
- TIME_OUT_TYPE_HOME_PLUGIN))
-
-#define TIME_OUT_IS_HOME_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- TIME_OUT_TYPE_HOME_PLUGIN))
-
-#define TIME_OUT_HOME_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- TIME_OUT_TYPE_HOME_PLUGIN, TimeOutHomePluginClass))
-
-struct _TimeOutPlugin
-{
- HDHomePluginItem hitem;
-};
-
-struct _TimeOutPluginClass
-{
- HDHomePluginItemClass parent_class;
-};
-
-GType time_out_home_plugin_get_type(void);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-#include "location-provider.h"
-
-#include <location/location-gps-device.h>
-#include <location/location-gpsd-control.h>
-
-void (*listener)(double, double) = NULL;
-
-/*static void on_error(LocationGPSDControl *control, LocationGPSDControlError error, gpointer data)
-{
- g_debug("location error: %d... quitting", error);
- g_main_loop_quit((GMainLoop *) data);
-}*/
-
-static void on_changed(LocationGPSDevice *device, gpointer data)
-{
- if (device == NULL || listener == NULL) {
- return;
- }
-
- if (device->fix) {
- if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) {
- listener(device->fix->latitude, device->fix->longitude);
- }
- }
-}
-
-/*static void on_stop(LocationGPSDControl *control, gpointer data)
-{
- g_debug("quitting");
- g_main_loop_quit((GMainLoop *) data);
-}*/
-
-/*static gboolean start_location(gpointer data)
-{
- location_gpsd_control_start((LocationGPSDControl *) data);
- return FALSE;
-}*/
-
-LocationGPSDControl *control = NULL;
-LocationGPSDevice *device = NULL;
-
-void setup_location_provider()
-{
-// GMainLoop *loop;
-
-// g_type_init();
-
-// loop = g_main_loop_new(NULL, FALSE);
-
- if (control != NULL) {
- return;
- }
-
- control = location_gpsd_control_get_default();
- device = g_object_new(LOCATION_TYPE_GPS_DEVICE, NULL);
-
- g_object_set(G_OBJECT(control),
- "preferred-method", LOCATION_METHOD_USER_SELECTED,
- "preferred-interval", LOCATION_INTERVAL_DEFAULT,
- NULL);
-
-// g_signal_connect(control, "error-verbose", G_CALLBACK(on_error), loop);
- g_signal_connect(device, "changed", G_CALLBACK(on_changed), control);
-// g_signal_connect(control, "gpsd-stopped", G_CALLBACK(on_stop), loop);
-
-// g_idle_add(start_location, control);
-
-// g_main_loop_run(loop);
-}
-
-void cleanup_location_provider()
-{
- if (control != NULL) {
- location_gpsd_control_stop(control);
-
- g_object_unref(device);
- g_object_unref(control);
- device = NULL;
- control = NULL;
- }
-}
-
-void start_location_provider()
-{
- if (control != NULL) {
- location_gpsd_control_start(control);
- }
-}
-
-void stop_location_provider()
-{
- if (control != NULL) {
- location_gpsd_control_stop(control);
- }
-}
-
-void set_location_listener(void (*newListener)(double, double))
-{
- listener = newListener;
-}
+++ /dev/null
-#ifndef LOCATION_PROVIDER_H
-#define LOCATION_PROVIDER_H
-
-void setup_location_provider();
-void cleanup_location_provider();
-
-void start_location_provider();
-void stop_location_provider();
-
-void set_location_listener(void (*newListener)(double, double));
-
-#endif
+++ /dev/null
-[Desktop Entry]
-Name=TimeOut Widget
-Comment=Execute an action at a given time
-Type=default
-X-Path=lib-timeout-home-widget.so