* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define _GNU_SOURCE
#include <string.h>
#include <math.h>
#include <gtk/gtk.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-banner.h>
+#ifndef LEGACY
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-banner.h>
+#endif
#include "types.h"
#include "data.h"
#include "display.h"
#include "dbus-ifc.h"
+static DBusConnection *_bus = NULL;
+
/***********************
* BELOW: DBUS METHODS *
***********************/
{
/* Latitude and/or Longitude are not defined. Calculate next. */
Point new_center = map_calc_new_center(svca->new_zoom);
- unit2latlon(new_center.unitx, new_center.unity, svca->new_lat, svca->new_lon);
+ unit2latlon(new_center.unitx, new_center.unity,
+ svca->new_lat, svca->new_lon);
}
/* Argument 1: double: latitude. */
* BELOW: DBUS SIGNALS *
***********************/
-static gboolean
-dbus_ifc_view_position_changed_idle(ViewPositionChangedArgs *args)
+void
+dbus_ifc_fire_view_position_changed(
+ Point new_center, gint new_zoom, gdouble new_viewing_angle)
{
- DBusConnection *bus = NULL;
- DBusError error;
DBusMessage *message = NULL;
- printf("%s(%f, %f, %d, %f)\n", __PRETTY_FUNCTION__, args->new_lat,
- args->new_lon, args->new_zoom, args->new_viewing_angle);
+ gdouble new_lat, new_lon;
+ printf("%s(%d, %d, %d, %f)\n", __PRETTY_FUNCTION__, new_center.unitx,
+ new_center.unity, new_zoom, new_viewing_angle);
- dbus_error_init(&error);
+ unit2latlon(new_center.unitx, new_center.unity, new_lat, new_lon);
- if(NULL == (bus = dbus_bus_get(DBUS_BUS_SESSION, &error))
- || NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
+ if(NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
MM_DBUS_INTERFACE, MM_DBUS_SIGNAL_VIEW_POSITION_CHANGED))
|| !dbus_message_append_args(message,
- DBUS_TYPE_DOUBLE, &args->new_lat,
- DBUS_TYPE_DOUBLE, &args->new_lon,
- DBUS_TYPE_INT32, &args->new_zoom,
- DBUS_TYPE_DOUBLE, &args->new_viewing_angle,
+ DBUS_TYPE_DOUBLE, &new_lat,
+ DBUS_TYPE_DOUBLE, &new_lon,
+ DBUS_TYPE_INT32, &new_zoom,
+ DBUS_TYPE_DOUBLE, &new_viewing_angle,
DBUS_TYPE_INVALID)
- || !dbus_connection_send(bus, message, NULL))
+ || !dbus_connection_send(_bus, message, NULL))
{
- g_printerr("Error sending view_position_changed signal: %s: %s\n",
- (dbus_error_is_set(&error)
- ? error.name : "<no error message>"),
- (dbus_error_is_set(&error)
- ? error.message : ""));
+ g_printerr("Error sending view_position_changed signal.\n");
}
if(message)
dbus_message_unref(message);
- if(bus)
- dbus_connection_unref(bus);
-
- vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
- return FALSE;
-}
-
-void
-dbus_ifc_fire_view_position_changed(
- Point new_center, gint new_zoom, gdouble new_viewing_angle)
-{
- ViewPositionChangedArgs *args;
- printf("%s(%d, %d, %d, %f)\n", __PRETTY_FUNCTION__, new_center.unitx,
- new_center.unity, new_zoom, new_viewing_angle);
-
- args = g_new(ViewPositionChangedArgs, 1);
- unit2latlon(new_center.unitx, new_center.unity,
- args->new_lat, args->new_lon);
- args->new_zoom = new_zoom;
- args->new_viewing_angle = new_viewing_angle;
-
- g_idle_add((GSourceFunc)dbus_ifc_view_position_changed_idle, args);
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-static gboolean
-dbus_ifc_view_dimensions_changed_idle(ViewDimensionsChangedArgs *args)
+void
+dbus_ifc_fire_view_dimensions_changed(
+ gint new_view_width_pixels, gint new_view_height_pixels)
{
- DBusConnection *bus = NULL;
- DBusError error;
DBusMessage *message = NULL;
printf("%s(%d, %d)\n", __PRETTY_FUNCTION__,
- args->new_view_width_pixels, args->new_view_height_pixels);
-
- dbus_error_init(&error);
+ new_view_width_pixels, new_view_height_pixels);
- if(NULL == (bus = dbus_bus_get(DBUS_BUS_SESSION, &error))
- || NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
+ if(NULL == (message = dbus_message_new_signal(MM_DBUS_PATH,
MM_DBUS_INTERFACE, MM_DBUS_SIGNAL_VIEW_DIMENSIONS_CHANGED))
|| !dbus_message_append_args(message,
- DBUS_TYPE_INT32, &args->new_view_width_pixels,
- DBUS_TYPE_INT32, &args->new_view_height_pixels,
+ DBUS_TYPE_INT32, &new_view_width_pixels,
+ DBUS_TYPE_INT32, &new_view_height_pixels,
DBUS_TYPE_INVALID)
- || !dbus_connection_send(bus, message, NULL))
+ || !dbus_connection_send(_bus, message, NULL))
{
- g_printerr("Error sending view_dimensions_changed signal: %s: %s\n",
- (dbus_error_is_set(&error)
- ? error.name : "<no error message>"),
- (dbus_error_is_set(&error)
- ? error.message : ""));
+ g_printerr("Error sending view_dimensions_changed signal.\n");
}
if(message)
dbus_message_unref(message);
- if(bus)
- dbus_connection_unref(bus);
-
- vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
- return FALSE;
-}
-
-void
-dbus_ifc_fire_view_dimensions_changed(
- gint new_view_width_pixels, gint new_view_height_pixels)
-{
- ViewDimensionsChangedArgs *args;
- printf("%s(%d, %d)\n", __PRETTY_FUNCTION__,
- new_view_width_pixels, new_view_height_pixels);
-
- args = g_new(ViewDimensionsChangedArgs, 1);
- args->new_view_width_pixels = new_view_width_pixels;
- args->new_view_height_pixels = new_view_height_pixels;
-
- g_idle_add((GSourceFunc)dbus_ifc_view_dimensions_changed_idle, args);
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
void
dbus_ifc_init()
{
+ DBusError error;
printf("%s()\n", __PRETTY_FUNCTION__);
if(OSSO_OK != osso_rpc_set_default_cb_f(_osso, dbus_ifc_cb_default, NULL))
MM_DBUS_PATH, MM_DBUS_INTERFACE, dbus_ifc_controller, NULL))
g_printerr("osso_rpc_set_cb_f failed.\n");
+ dbus_error_init(&error);
+ if(NULL == (_bus = dbus_bus_get(DBUS_BUS_SESSION, &error)))
+ {
+ g_printerr("Error getting session bus: %s: %s\n",
+ (dbus_error_is_set(&error)
+ ? error.name : "<no error message>"),
+ (dbus_error_is_set(&error)
+ ? error.message : ""));
+ }
+
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
#define TRACKS_MASK 0x00000001
#define ROUTES_MASK 0x00000002
-#define g_timeout_add(I, F, D) g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE, \
- (I), (F), (D), NULL)
-
#define MACRO_BANNER_SHOW_INFO(A, S) { \
gchar *my_macro_buffer = g_markup_printf_escaped( \
"<span size='%s'>%s</span>", \
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <osso-helplib.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-file-chooser-dialog.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-system-sound.h>
+
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-file-chooser-dialog.h>
+# include <hildon/hildon-banner.h>
+# include <hildon/hildon-sound.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-file-chooser-dialog.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-system-sound.h>
+#endif
#include "types.h"
#include "data.h"
static GtkWidget *_sdi_fix = NULL;
static GtkWidget *_sdi_fqu = NULL;
static GtkWidget *_sdi_msp = NULL;
-static gboolean _redraw_count = 0;
+static gint _redraw_count = 0;
static gint _mark_bufx1 = -1;
static gint _mark_bufx2 = -1;
static GdkRectangle _zoom_rect = { 0, 0, 0, 0};
static gint _dl_errors = 0;
+static volatile gint _pending_replaces = 0;
/** Pango stuff. */
GdkRectangle _comprose_rect = { 0, 0, 0, 0};
if(!_speed_excess)
{
_speed_excess = TRUE;
- g_timeout_add(5000, (GSourceFunc)speed_excess, NULL);
+ g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
+ 5000, (GSourceFunc)speed_excess, NULL, NULL);
}
}
else
" Otherwise, press Cancel to continue."));
if(GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm)))
+ {
+#ifndef LEGACY
+ hildon_help_show(_osso, HELP_ID_INTRO, 0);
+#else
ossohelp_show(_osso, HELP_ID_INTRO, 0);
+#endif
+ }
gtk_widget_destroy(confirm);
/* Present the settings dialog. */
if(done_here)
{
gtk_window_present(GTK_WINDOW(_window));
- g_timeout_add(250, (GSourceFunc)banner_reset, NULL);
+ g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
+ 250, (GSourceFunc)banner_reset, NULL, NULL);
}
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
BOUND(new_center.unity, 0, WORLD_SIZE_UNITS);
mrt = g_slice_new(MapRenderTask);
- ++_redraw_count;
mrt->repo = _curr_repo;
mrt->old_offsetx = _map_offset_devx;
mrt->old_offsety = _map_offset_devy;
mrt->zoom = _next_zoom = zoom;
mrt->rotate_angle = _next_map_rotate_angle = rotate_angle;
+
gtk_widget_queue_draw_area(
_map_widget,
_redraw_wait_bounds.x,
_redraw_wait_bounds.y,
- _redraw_wait_bounds.width + (_redraw_count - 1)
- * HOURGLASS_SEPARATION,
+ _redraw_wait_bounds.width
+ + (_redraw_count * HOURGLASS_SEPARATION),
_redraw_wait_bounds.height);
+ ++_redraw_count;
+
g_thread_pool_push(_mrt_thread_pool, mrt, NULL);
}
TILE_SIZE_PIXELS,
TILE_SIZE_PIXELS,
&boundx, &boundy, &width, &height);
- /* Un-multiply the matrix that we used for blitting. */
+ /* Un-multiply the matrix that we used for blitting. Good thing
+ * we're multiplying by powers of two, or this wouldn't work
+ * consistently... */
if(zoff)
gdk_pixbuf_rotate_matrix_mult_number(
_map_rotate_matrix, 1.f / (1 << zoff));
{
printf("%s()\n", __PRETTY_FUNCTION__);
- if(!_mouse_is_down
+ if(!--_pending_replaces && !_mouse_is_down
&& mrt->screen_width_pixels == _view_width_pixels
&& mrt->screen_height_pixels == _view_height_pixels)
{
deg2rad(_map_rotate_angle
- ROTATE_DIR_ENUM_DEGREES[_rotate_dir]));
- g_slice_free(MapRenderTask, mrt);
-
--_redraw_count;
_map_offset_devx = 0;
map_set_mark();
map_force_redraw();
-
}
else
{
/* Ignore this new pixbuf. We have newer ones coming. */
g_object_unref(mrt->pixbuf);
- g_slice_free(MapRenderTask, mrt);
- gtk_widget_queue_draw_area(
- _map_widget,
- _redraw_wait_bounds.x,
- _redraw_wait_bounds.y,
- _redraw_wait_bounds.width + (_redraw_count - 1)
- * HOURGLASS_SEPARATION,
- _redraw_wait_bounds.height * _redraw_count);
--_redraw_count;
}
+ g_slice_free(MapRenderTask, mrt);
+
vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
return FALSE;
}
gfloat *tile_dev;
ThreadLatch *refresh_latch = NULL;
gint cache_amount;
- static gint8 auto_download_batch_id = CHAR_MIN;
+ static gint8 auto_download_batch_id = INT8_MIN;
printf("%s(%d, %d, %d, %d, %d, %d)\n", __PRETTY_FUNCTION__,
mrt->screen_width_pixels, mrt->screen_height_pixels,
mrt->new_center.unitx, mrt->new_center.unity, mrt->zoom,
if(g_thread_pool_unprocessed(_mrt_thread_pool))
{
g_slice_free(MapRenderTask, mrt);
- gtk_widget_queue_draw_area(
- _map_widget,
- _redraw_wait_bounds.x,
- _redraw_wait_bounds.y,
- _redraw_wait_bounds.width + (_redraw_count - 1)
- * HOURGLASS_SEPARATION,
- _redraw_wait_bounds.height * _redraw_count);
--_redraw_count;
vprintf("%s(): return FALSE\n", __PRETTY_FUNCTION__);
return FALSE;
TILE_SIZE_PIXELS >> zoff,
&boundx, &boundy, &width, &height);
g_object_unref(tile_pixbuf);
- /* Un-multiply the matrix that we used for blitting. */
+ /* Un-multiply the matrix that we used for blitting. Good
+ * thing we're multiplying by powers of two, or this wouldn't
+ * work consistently... */
if(zoff)
gdk_pixbuf_rotate_matrix_mult_number(
matrix, 1.f / (1 << zoff));
/* Don't replace the pixbuf unless/until the mouse is released. */
g_mutex_lock(_mouse_mutex);
- g_idle_add_full(G_PRIORITY_HIGH_IDLE,
+ ++_pending_replaces;
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE + 20,
(GSourceFunc)map_replace_pixbuf_idle, mrt, NULL);
g_mutex_unlock(_mouse_mutex);
/* heading_panel_expose() */
pango_context = gtk_widget_get_pango_context(_map_widget);
_heading_panel_layout = pango_layout_new(pango_context);
- pango_font = pango_font_description_new();
- pango_font_description_set_family(pango_font,"Sans Serif");
+ _heading_panel_fontdesc = pango_font_description_new();
+ pango_font_description_set_family(_heading_panel_fontdesc, "Sans Serif");
/* draw_sat_details() */
pango_context = gtk_widget_get_pango_context(_map_widget);
{
GError *error = NULL;
gchar *icon_path = "/usr/share/icons/hicolor/scalable/hildon"
- "/qgn_list_gene_image_file_wait.png";
+ "/maemo-mapper-wait.png";
_redraw_wait_bounds.x = 0;
_redraw_wait_bounds.y = 0;
_redraw_wait_icon = gdk_pixbuf_new_from_file(icon_path, &error);
if(!_redraw_wait_icon || error)
{
- printf("Error parsing pixbuf: %s\n",
+ g_printerr("Error parsing pixbuf: %s\n",
error ? error->message : icon_path);
_redraw_wait_bounds.width = 0;
_redraw_wait_bounds.height = 0;
}
-#define ROTATE_CUT_EDGES (0.0) /* cut small part of texel on edges - to avoid artefacts */
+#define ROTATE_CUT_EDGES (0.0) /* cut small part of edges, to avoid artefacts*/
/**
* gdk_pixbuf_rotate:
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-banner.h>
+
#include <libgnomevfs/gnome-vfs.h>
#include <libgnomevfs/gnome-vfs-inet-connection.h>
#include <errno.h>
+#ifndef LEGACY
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-banner.h>
+#endif
+
#include "types.h"
#include "data.h"
#include "defines.h"
static volatile GThread *_gps_thread = NULL;
static GMutex *_gps_init_mutex = NULL;
-static volatile gint _gps_rcvr_retry_count = 0;
+static gint _gps_rcvr_retry_count = 0;
static gint _gmtoffset = 0;
/* Add new data to track. */
if(_gps_state == RCVR_FIXED)
{
- if(track_add(_pos.time, newly_fixed))
+ if(track_add(_pos.time, newly_fixed) || newly_fixed)
{
/* Move mark to new location. */
map_refresh_mark(FALSE);
7 = Manual input mode
8 = Simulation mode
7. Number of satellites being tracked
- 8. Horizontal dilution of position
+ 8. Horizontal dilution of precision
9. Altitude, Meters, above mean sea level
10. Alt unit (meters)
11. Height of geoid (mean sea level) above WGS84 ellipsoid
/* Skip number of satellites */
token = strsep(&sentence, DELIM);
- /* Parse Horizontal dilution of position */
+ /* Parse Horizontal dilution of precision */
token = strsep(&sentence, DELIM);
if(token && *token)
MACRO_PARSE_INT(_gps.hdop, token);
if(_gps_state == RCVR_UP)
{
gdouble fraction = running_total * sqrtf(num_sats_used)
- / num_sats_used / 100.0;
+ / num_sats_used / 150.0;
BOUND(fraction, 0.0, 1.0);
hildon_banner_set_fraction(
HILDON_BANNER(_fix_banner), fraction);
if(_enable_gps && _gps_state >= RCVR_DOWN)
{
+ if(_gps_state < RCVR_UP)
+ set_conn_state(RCVR_UP);
+
if(!strncmp(nmea + 3, "GSV", 3))
{
if(_gps_state == RCVR_UP || _gps_info || _satdetails_on)
buf_curr -= (eol - buf + 1);
}
}
+ _gps_rcvr_retry_count = 0;
}
}
/* $Id:$ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define _GNU_SOURCE
#include <errno.h>
#include "gpsbt.h"
+#ifdef LEGACY
+
/* Set following #if to 1 if you want to use automatic bt dev disconnect.
* This does not seem to work correctly currently (disconnects too fast)
*/
#ifdef DEBUG
#if (__GNUC__ > 2) && ((__GNUC__ > 3) || (__GNUC_MINOR__ > 2))
-#define PDEBUG(fmt...) do { \
- if (debug_level) { \
- struct timeval tv; \
- gettimeofday(&tv, 0); \
- printf("DEBUG[%d]:%ld.%ld:%s:%s():%d: ", \
- getpid(), \
- tv.tv_sec, tv.tv_usec, \
- __FILE__, __FUNCTION__, __LINE__); \
- printf(fmt); \
- fflush(stdout); \
- } \
+#define PDEBUG(fmt...) do { \
+ if (debug_level) { \
+ struct timeval tv; \
+ gettimeofday(&tv, 0); \
+ printf("DEBUG[%d]:%ld.%ld:%s:%s():%d: ", \
+ getpid(), \
+ tv.tv_sec, tv.tv_usec, \
+ __FILE__, __FUNCTION__, __LINE__); \
+ printf(fmt); \
+ fflush(stdout); \
+ } \
}while(0)
#else
-#define PDEBUG(fmt...) do { \
- if (debug_level) { \
- struct timeval tv; \
- gettimeofday(&tv, 0); \
- printf("DEBUG[%d]:%ld.%ld:%s:%s():%d: ", \
- getpid(), \
- tv.tv_sec, tv.tv_usec, \
- __FILE__, __FUNCTION__, __LINE__); \
- printf(##fmt); \
- fflush(stdout); \
- } \
+#define PDEBUG(fmt...) do { \
+ if (debug_level) { \
+ struct timeval tv; \
+ gettimeofday(&tv, 0); \
+ printf("DEBUG[%d]:%ld.%ld:%s:%s():%d: ", \
+ getpid(), \
+ tv.tv_sec, tv.tv_usec, \
+ __FILE__, __FUNCTION__, __LINE__); \
+ printf(##fmt); \
+ fflush(stdout); \
+ } \
}while(0)
#endif
#else
/* ----------------------------------------------------------------------- */
static int set_error_msg(char *errbuf,
- int errbuf_max_len,
- char *msg,
- ...)
+ int errbuf_max_len,
+ char *msg,
+ ...)
{
int st, len;
va_list args;
/* ----------------------------------------------------------------------- */
extern int gpsbt_start(char *bda,
- int our_debug_level,
- int gpsd_debug_level,
- short port,
- char *error_buf,
- int error_buf_max_len,
- int timeout_ms,
- gpsbt_t *ctx)
+ int our_debug_level,
+ int gpsd_debug_level,
+ short port,
+ char *error_buf,
+ int error_buf_max_len,
+ int timeout_ms,
+ gpsbt_t *ctx)
{
int i, j, k, st, num_bondings = 0,
bonding_cnt = 0, num_classes = 0, num_rfcomms = 0,
#if (__GNUC__ > 2) && ((__GNUC__ > 3) || (__GNUC_MINOR__ > 2))
-#define ERRSTR(fmt, args...) \
- if (error_buf && error_buf_max_len>0) { \
- set_error_msg(error_buf, error_buf_max_len, fmt, args); \
- } else { \
- PDEBUG(fmt, args); \
+#define ERRSTR(fmt, args...) \
+ if (error_buf && error_buf_max_len>0) { \
+ set_error_msg(error_buf, error_buf_max_len, fmt, args); \
+ } else { \
+ PDEBUG(fmt, args); \
}
#else
-#define ERRSTR(fmt, args...) \
- if (error_buf && error_buf_max_len>0) { \
- set_error_msg(error_buf, error_buf_max_len, fmt, ##args); \
- } else { \
- PDEBUG(fmt, ##args); \
+#define ERRSTR(fmt, args...) \
+ if (error_buf && error_buf_max_len>0) { \
+ set_error_msg(error_buf, error_buf_max_len, fmt, ##args); \
+ } else { \
+ PDEBUG(fmt, ##args); \
}
#endif
if (st) {
if (st!=2) { /* gpsd is running, value 2 would mean that gpsd is not
- * running but we have a lock acquired
- */
+ * running but we have a lock acquired
+ */
st = gpsmgr_start(gpsd_prog, NULL, gpsd_ctrl_sock,
- gpsd_debug_level, port, &ctx->mgr);
+ gpsd_debug_level, port, &ctx->mgr);
if (!st) {
- /* everything is ok */
- PDEBUG("%s already running, doing nothing\n",gpsd_prog);
- goto OUT;
+ /* everything is ok */
+ PDEBUG("%s already running, doing nothing\n",gpsd_prog);
+ goto OUT;
}
PDEBUG("gpsmgr_start() returned %d [%s, %d]\n",st,strerror(errno),errno);
goto OUT;
}
-#define CHECK_ERROR(s,o,i,m,t) \
- if (st<0) { \
- ERRSTR("Cannot send msg (service=%s, object=%s, interface=%s, " \
- "method=%s) [%s]\n", s, o, i, m, \
- error.message ? error.message : "<no error msg>"); \
- goto OUT; \
+#define CHECK_ERROR(s,o,i,m,t) \
+ if (st<0) { \
+ ERRSTR("Cannot send msg (service=%s, object=%s, interface=%s, " \
+ "method=%s) [%s]\n", s, o, i, m, \
+ error.message ? error.message : "<no error msg>"); \
+ goto OUT; \
}
/* Allocate bondings array, note that we DO allocate one extra array
* element for marking end of array.
- */
- bondings = (bonding_t *)realloc(bondings,
- (bonding_cnt+num_bondings+1)*sizeof(bonding_t));
- if (!bondings) {
- st = -1;
- errno = ENOMEM;
- goto OUT;
- }
- bondings[bonding_cnt+num_bondings].bonding=
- bondings[bonding_cnt+num_bondings].adapter=NULL; /* just in case */
-
-
- j = 0;
- while (j<num_bondings && tmp_bondings[j]) {
- bondings[bonding_cnt].bonding = strdup(tmp_bondings[j]);
- free(tmp_bondings[j]);
-
- bondings[bonding_cnt].adapter = adapters[i]; /* no allocation! */
-
- PDEBUG("Bondings[%d]=%s (adapter=%s)\n", bonding_cnt,
- bondings[bonding_cnt].bonding, bondings[bonding_cnt].adapter);
+ */
+ bondings = (bonding_t *)realloc(bondings,
+ (bonding_cnt+num_bondings+1)*sizeof(bonding_t));
+ if (!bondings) {
+ st = -1;
+ errno = ENOMEM;
+ goto OUT;
+ }
+ bondings[bonding_cnt+num_bondings].bonding=
+ bondings[bonding_cnt+num_bondings].adapter=NULL; /* just in case */
+
+
+ j = 0;
+ while (j<num_bondings && tmp_bondings[j]) {
+ bondings[bonding_cnt].bonding = strdup(tmp_bondings[j]);
+ free(tmp_bondings[j]);
+
+ bondings[bonding_cnt].adapter = adapters[i]; /* no allocation! */
+
+ PDEBUG("Bondings[%d]=%s (adapter=%s)\n", bonding_cnt,
+ bondings[bonding_cnt].bonding, bondings[bonding_cnt].adapter);
/* Get all remote service classes for this bonding. */
error = NULL;
} else {
onoff = "OFF";
}
- PDEBUG("Addr=%s, Class[%d]=%s (adapter=%s), positioning bit %s\n",
+ PDEBUG("Addr=%s, Class[%d]=%s (adapter=%s), "
+ "positioning bit %s\n",
bondings[bonding_cnt].bonding, k, tmp_classes[k],
bondings[bonding_cnt].adapter, onoff);
free(tmp_classes[k]);
}
num_classes = 0;
- bonding_cnt++;
- j++;
- }
+ bonding_cnt++;
+ j++;
+ }
}
free(tmp_bondings);
if (debug_level) {
int i=0;
if (bonding_cnt) {
- PDEBUG("Bondings [%d]:\n", bonding_cnt);
- while (bondings[i].bonding && i<bonding_cnt) {
- PDEBUG("\t%s\n", bondings[i].bonding);
- i++;
- }
+ PDEBUG("Bondings [%d]:\n", bonding_cnt);
+ while (bondings[i].bonding && i<bonding_cnt) {
+ PDEBUG("\t%s\n", bondings[i].bonding);
+ i++;
+ }
} else {
- PDEBUG("No bondings exists.\n");
+ PDEBUG("No bondings exists.\n");
}
}
#endif
if (check_device_name(tmp)) {
/* Found a GPS device */
- posdev = (bonding_t *)realloc(posdev, (num_posdev+1)*sizeof(bonding_t));
+ posdev = (bonding_t *)realloc(posdev,
+ (num_posdev+1)*sizeof(bonding_t));
if (!posdev) {
st = -1;
errno = ENOMEM;
PDEBUG("Addr=%s, (adapter=%s), Name=\"%s\"\n",
bondings[i].bonding, bondings[i].adapter, tmp);
}
- }
+ }
g_object_unref(proxy);
- i++;
+ i++;
}
}
G_TYPE_STRING, posdev[i].bonding,
G_TYPE_STRING, spp,
#ifdef USE_AUTOMATIC_DISCONNECT
- G_TYPE_BOOLEAN, TRUE, /* automatic disconnect (does not work, the system disconnects too fast) */
+ G_TYPE_BOOLEAN, TRUE,
#else
- G_TYPE_BOOLEAN, FALSE, /* no automatic disconnect (this seems to work ok) */
+ G_TYPE_BOOLEAN, FALSE,
#endif
G_TYPE_INVALID,
G_TYPE_STRING, &tmp,
"com.nokia.btcond.error.connected")) {
ERROR:
- ERRSTR("Cannot send msg (service=%s, object=%s, interface=%s, "
- "method=%s) [%s]\n",
- BTCOND_DBUS,
- BTCOND_PATH,
- BTCOND_INTERFACE,
- BTCOND_CONNECT,
- error->message ? error->message : "<no error msg>");
- continue;
+ ERRSTR("Cannot send msg (service=%s, object=%s, interface=%s, "
+ "method=%s) [%s]\n",
+ BTCOND_DBUS,
+ BTCOND_PATH,
+ BTCOND_INTERFACE,
+ BTCOND_CONNECT,
+ error->message ? error->message : "<no error msg>");
+ continue;
} else if(!tmp || !*tmp) {
- /* hack: rfcommX device name is at the end of error message */
- char *last_space = strstr(error->message, " rfcomm");
- if (!last_space) {
- goto ERROR;
- }
+ /* hack: rfcommX device name is at the end of error message */
+ char *last_space = strstr(error->message, " rfcomm");
+ if (!last_space) {
+ goto ERROR;
+ }
g_free(tmp);
tmp = g_strdup_printf("/dev/%s", last_space+1);
rfcomms[num_rfcomms] = tmp;
num_rfcomms++;
- PDEBUG("BT addr=%s, RFCOMM %s now exists (adapter=%s)\n", posdev[i].bonding, tmp, posdev[i].adapter);
+ PDEBUG("BT addr=%s, RFCOMM %s now exists (adapter=%s)\n",
+ posdev[i].bonding, tmp, posdev[i].adapter);
tmp = NULL;
}
#endif
/* Just start the beast (to be done if everything is ok) */
- st = gpsmgr_start(gpsd_prog, rfcomms, gpsd_ctrl_sock, gpsd_debug_level, port, &ctx->mgr);
+ st = gpsmgr_start(gpsd_prog, rfcomms, gpsd_ctrl_sock,
+ gpsd_debug_level, port, &ctx->mgr);
if (!st) {
- /* everything is ok */
- goto OUT;
+ /* everything is ok */
+ goto OUT;
}
}
}
if (posdev) {
for (i=0; i<num_posdev; i++) {
if (posdev[i].bonding) {
- free(posdev[i].bonding);
- memset(&posdev[i], 0, sizeof(bonding_t)); /* just in case */
+ free(posdev[i].bonding);
+ memset(&posdev[i], 0, sizeof(bonding_t)); /* just in case */
}
}
free(posdev);
if (bondings) {
for (i=0; i<num_bondings; i++) {
if (bondings[i].bonding) {
- free(bondings[i].bonding);
- memset(&bondings[i], 0, sizeof(bonding_t)); /* just in case */
+ free(bondings[i].bonding);
+ memset(&bondings[i], 0, sizeof(bonding_t)); /* just in case */
}
}
free(bondings);
if (rfcomms) {
for (i=0; i<num_rfcomms; i++) {
if (rfcomms[i]) {
- free(rfcomms[i]);
- rfcomms[i]=0;
+ free(rfcomms[i]);
+ rfcomms[i]=0;
}
}
free(rfcomms);
* we are the only one using the dev.
*/
if (st>0) {
- skip_dbus = 1;
- PDEBUG("Skipping rfcomm device deletion as we are not the only location user\n");
+ skip_dbus = 1;
+ PDEBUG("Skipping rfcomm device deletion as we are "
+ "not the only location user\n");
}
}
while (ctx->rfcomms[i]) {
if (!skip_dbus) {
- /* Disconnect the device */
+ /* Disconnect the device */
proxy = dbus_g_proxy_new_for_name(bus,
BTCOND_DBUS, BTCOND_PATH, BTCOND_INTERFACE);
error = NULL;
if(!dbus_g_proxy_call(proxy, BTCOND_DISCONNECT, &error,
G_TYPE_STRING, ctx->rfcomms[i], G_TYPE_INVALID, G_TYPE_INVALID)
|| error){
- PDEBUG("Cannot send msg (service=%s, object=%s, interface=%s, "
- "method=%s) [%s]\n",
- BTCOND_DBUS,
- BTCOND_PATH,
- BTCOND_INTERFACE,
- BTCOND_DISCONNECT,
- error->message ? error->message : "<no error msg>");
- }
+ PDEBUG("Cannot send msg (service=%s, object=%s, interface=%s, "
+ "method=%s) [%s]\n",
+ BTCOND_DBUS,
+ BTCOND_PATH,
+ BTCOND_INTERFACE,
+ BTCOND_DISCONNECT,
+ error->message ? error->message : "<no error msg>");
+ }
g_object_unref(proxy);
}
return st;
}
+#endif
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifndef LEGACY
+# include "/usr/include/gpsbt.h"
+#else
+
/*
GPS BT management API. The API is used by those applications that
wish to use services provided by gps daemon i.e., they wish to receive
typedef struct {
gpsmgr_t mgr;
char **rfcomms; /* what devices where found (null terminated array),
- * not used if compiled with USE_AUTOMATIC_DISCONNECT
- * (see gpsbt.c for details)
- */
+ * not used if compiled with USE_AUTOMATIC_DISCONNECT
+ * (see gpsbt.c for details)
+ */
int timeout; /* timeout for dbus messages */
} gpsbt_t;
*/
extern int gpsbt_start(char *bda,
- int debug_level,
- int gpsd_debug_level,
- short port,
- char *error_buf,
- int error_buf_max_len,
- int timeout_ms,
- gpsbt_t *ctx);
+ int debug_level,
+ int gpsd_debug_level,
+ short port,
+ char *error_buf,
+ int error_buf_max_len,
+ int timeout_ms,
+ gpsbt_t *ctx);
/* Stop function stops the gpsd if it was running and nobody
extern int gpsbt_stop(gpsbt_t *ctx);
#endif /* gpsbt_included */
+
+#endif
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define _GNU_SOURCE
#include <math.h>
#include <gdk/gdkkeysyms.h>
-#include <hildon-widgets/hildon-defines.h>
-#include <hildon-widgets/hildon-banner.h>
+
+#ifndef LEGACY
+# include <hildon/hildon-defines.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <hildon-widgets/hildon-defines.h>
+# include <hildon-widgets/hildon-banner.h>
+#endif
#include "types.h"
#include "data.h"
;
}
key_pan_timeout(_action[custom_key]);
- _key_pan_timeout_sid = g_timeout_add(
+ _key_pan_timeout_sid = g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
250, (GSourceFunc)key_pan_timeout,
- (gpointer)(_action[custom_key]));
+ (gpointer)(_action[custom_key]), NULL);
}
break;
_("Zoom to Level"), _key_zoom_new);
MACRO_BANNER_SHOW_INFO(_window, buffer);
}
- _key_zoom_timeout_sid = g_timeout_add(
+ _key_zoom_timeout_sid =g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
500, (GSourceFunc)key_zoom_timeout,
- (gpointer)(_action[custom_key]));
+ (gpointer)(_action[custom_key]), NULL);
}
break;
{
g_source_remove(_key_zoom_timeout_sid);
_key_zoom_timeout_sid = 0;
- _key_zoom_timeout_sid = g_timeout_add(
- 500, (GSourceFunc)key_zoom_timeout, NULL);
+ _key_zoom_timeout_sid =g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
+ 500, (GSourceFunc)key_zoom_timeout, NULL, NULL);
}
_key_zoom_is_down = FALSE;
return TRUE;
if(_key_pan_timeout_sid)
{
g_source_remove(_key_pan_timeout_sid);
- _key_pan_timeout_sid = g_timeout_add(
- 500, (GSourceFunc)key_pan_timeout, NULL);
+ _key_pan_timeout_sid = g_timeout_add_full(G_PRIORITY_HIGH_IDLE,
+ 500, (GSourceFunc)key_pan_timeout, NULL, NULL);
}
_key_pan_is_down = FALSE;
_key_pan_incr_devx = 0;
#define _GNU_SOURCE
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dbus/dbus-glib.h>
-#include <hildon-widgets/hildon-program.h>
-#include <hildon-widgets/hildon-banner.h>
+#include <locale.h>
+
#include <gconf/gconf-client.h>
#include <device_symbols.h>
#include <conicconnection.h>
#include <conicconnectionevent.h>
-#include <locale.h>
+#ifndef LEGACY
+# include <hildon/hildon-program.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <hildon-widgets/hildon-program.h>
+# include <hildon-widgets/hildon-banner.h>
+#endif
#include "types.h"
#include "data.h"
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_TRACKS] = _("Toggle Tracks");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_SCALE] = _("Toggle Scale");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_POI] = _("Toggle POIs");
- CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_CHANGE_REPO]= _("Select Next Repository");
+ CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_CHANGE_REPO]
+ = _("Select Next Repository");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_ROUTE_DISTNEXT]
= _("Show Distance to Next Waypoint");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_ROUTE_DISTLAST]
= _("Show Distance to End of Route");
- CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TRACK_BREAK] = _("Insert Track Break");
+ CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TRACK_BREAK]=_("Insert Track Break");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TRACK_CLEAR] = _("Clear Track");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TRACK_DISTLAST]
= _("Show Distance from Last Break");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TRACK_DISTFIRST]
= _("Show Distance from Beginning");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_GPS] = _("Toggle GPS");
- CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_GPSINFO] = _("Toggle GPS Info");
+ CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_GPSINFO]=_("Toggle GPS Info");
CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_TOGGLE_SPEEDLIMIT]
= _("Toggle Speed Limit");
- CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_RESET_BLUETOOTH] = _("Reset Bluetooth");
+ CUSTOM_ACTION_ENUM_TEXT[CUSTOM_ACTION_RESET_BLUETOOTH]
+ = _("Reset Bluetooth");
COLORABLE_GCONF[COLORABLE_MARK] = GCONF_KEY_PREFIX"/color_mark";
COLORABLE_GCONF[COLORABLE_MARK_VELOCITY]
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <math.h>
#include <glib/gstdio.h>
#include <fcntl.h>
-#include <osso-helplib.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-file-chooser-dialog.h>
-#include <hildon-widgets/hildon-number-editor.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-input-mode-hint.h>
-
#include <locale.h>
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-file-chooser-dialog.h>
+# include <hildon/hildon-number-editor.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-file-chooser-dialog.h>
+# include <hildon-widgets/hildon-number-editor.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-input-mode-hint.h>
+#endif
+
+
#include "types.h"
#include "data.h"
#include "defines.h"
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_REPOMAN, _osso);
/* Reset button. */
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(mapman_info.dialog), HELP_ID_MAPMAN, _osso);
/* Clear button. */
gtk_entry_set_width_chars(GTK_ENTRY(mapman_info.txt_topleft_lat), 12);
gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lat), 1.f);
g_object_set(G_OBJECT(mapman_info.txt_topleft_lat),
+#ifndef LEGACY
+ "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
g_object_set(G_OBJECT(mapman_info.txt_topleft_lat),
HILDON_AUTOCAP,
FALSE, NULL);
+#endif
gtk_table_attach(GTK_TABLE(mapman_info.tbl_area),
mapman_info.txt_topleft_lon = gtk_entry_new(),
2, 3, 3, 4, GTK_FILL, 0, 4, 0);
gtk_entry_set_width_chars(GTK_ENTRY(mapman_info.txt_topleft_lon), 12);
gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_topleft_lon), 1.f);
g_object_set(G_OBJECT(mapman_info.txt_topleft_lon),
+#ifndef LEGACY
+ "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
g_object_set(G_OBJECT(mapman_info.txt_topleft_lon),
HILDON_AUTOCAP,
FALSE, NULL);
+#endif
/* Bottom Right. */
gtk_table_attach(GTK_TABLE(mapman_info.tbl_area),
gtk_entry_set_width_chars(GTK_ENTRY(mapman_info.txt_botright_lat), 12);
gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lat), 1.f);
g_object_set(G_OBJECT(mapman_info.txt_botright_lat),
+#ifndef LEGACY
+ "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
g_object_set(G_OBJECT(mapman_info.txt_botright_lat),
HILDON_AUTOCAP,
FALSE, NULL);
+#endif
gtk_table_attach(GTK_TABLE(mapman_info.tbl_area),
mapman_info.txt_botright_lon = gtk_entry_new(),
2, 3, 4, 5, GTK_FILL, 0, 4, 0);
gtk_entry_set_width_chars(GTK_ENTRY(mapman_info.txt_botright_lat), 12);
gtk_entry_set_alignment(GTK_ENTRY(mapman_info.txt_botright_lon), 1.f);
g_object_set(G_OBJECT(mapman_info.txt_botright_lon),
+#ifndef LEGACY
+ "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
g_object_set(G_OBJECT(mapman_info.txt_botright_lon),
HILDON_AUTOCAP,
FALSE, NULL);
+#endif
/* Default action is to download by area. */
gtk_toggle_button_set_active(
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#define _GNU_SOURCE
#include <math.h>
-#include <osso-helplib.h>
-#include <hildon-widgets/hildon-program.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-input-mode-hint.h>
+
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-program.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-program.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-input-mode-hint.h>
+#endif
#include "types.h"
#include "data.h"
1, 2, 0, 1, GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(txt_lat), 16);
gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_lat), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_lat), HILDON_AUTOCAP, FALSE, NULL);
g_object_set(G_OBJECT(txt_lat), HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
+#endif
gtk_table_attach(GTK_TABLE(table),
label = gtk_label_new(_("Longitude")),
1, 2, 1, 2, GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(txt_lon), 16);
gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_lon), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_lon), HILDON_AUTOCAP, FALSE, NULL);
g_object_set(G_OBJECT(txt_lon), HILDON_INPUT_MODE_HINT,
HILDON_INPUT_MODE_HINT_ALPHANUMERICSPECIAL, NULL);
+#endif
}
/* Initialize with the current center position. */
{
printf("%s()\n", __PRETTY_FUNCTION__);
- if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(_menu_view_ac_lead_item)))
+ if(gtk_check_menu_item_get_active(
+ GTK_CHECK_MENU_ITEM(_menu_view_ac_lead_item)))
{
_center_mode = CENTER_LEAD;
MACRO_BANNER_SHOW_INFO(_window, _("Auto-Center Mode: Lead"));
{
printf("%s()\n", __PRETTY_FUNCTION__);
- if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(_menu_view_ac_none_item)))
+ if(gtk_check_menu_item_get_active(
+ GTK_CHECK_MENU_ITEM(_menu_view_ac_none_item)))
{
_center_mode = -_center_mode;
MACRO_BANNER_SHOW_INFO(_window, _("Auto-Center Off"));
{
printf("%s()\n", __PRETTY_FUNCTION__);
+#ifndef LEGACY
+ hildon_help_show(_osso, HELP_ID_INTRO, 0);
+#else
ossohelp_show(_osso, HELP_ID_INTRO, 0);
+#endif
vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
{
printf("%s()\n", __PRETTY_FUNCTION__);
+#ifndef LEGACY
+ hildon_help_show(_osso, HELP_ID_ABOUT, HILDON_HELP_SHOW_DIALOG);
+#else
ossohelp_show(_osso, HELP_ID_ABOUT, OSSO_HELP_SHOW_DIALOG);
+#endif
vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
return TRUE;
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <osso-helplib.h>
#include <bt-dbus.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-system-sound.h>
-#include <hildon-widgets/hildon-input-mode-hint.h>
#include <sqlite3.h>
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-banner.h>
+# include <hildon/hildon-sound.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-system-sound.h>
+# include <hildon-widgets/hildon-input-mode-hint.h>
+#endif
+
#include "types.h"
#include "data.h"
#include "defines.h"
{
gboolean moving = FALSE;
gboolean approaching_waypoint = FALSE;
+ gint xdiff, ydiff, dopcand;
announce_thres_unsquared = (20+_gps.speed) * _announce_notice_ratio*32;
- if(!_track.tail->unity || (_pos.unitx != _track.tail->unitx)
- || (_pos.unity != _track.tail->unity))
+ if(!_track.tail->unity
+ || ((xdiff = _pos.unitx - _track.tail->unitx), /* comma op */
+ (ydiff = _pos.unity - _track.tail->unity), /* comma op */
+ /* Check if xdiff or ydiff are huge. */
+ ((abs(xdiff) >> 12) || (abs(ydiff) >> 12)
+ /* Okay, let's see if we've moved enough to justify adding
+ * to the track. It depends on our error. I'd like to
+ * make the threshold roughly linear with respect to the
+ * P/HDOP (completely arbitrary, I know), but I also
+ * want to keep the threshold at a minimum of 2
+ * zoom-level-4 pixel, and I want dop's of less than 2 to
+ * also have a 1-pixel threshold. I also throw in some
+ * PDOP into the mix, just for fun. */
+ || ((dopcand = 8 * (_gps.pdop - 6 +(_gps.hdop*_gps.hdop))),
+ ((xdiff * xdiff) + (ydiff * ydiff)
+ >= (MAX(2, dopcand) << 8))))))
{
+ /* We moved enough to actually register a move. */
ret = TRUE;
+
/* Update the nearest-waypoint data. */
if(_route.head != _route.tail
&& (newly_fixed ? (route_find_nearest_point(), TRUE)
}
else
{
- route_dist_squared_1 = fabsf((slope * _pos.unitx)
+ route_dist_squared_1 = abs((slope * _pos.unitx)
- _pos.unity + (route_y1 - (slope * route_x1)));
route_dist_squared_1 =
route_dist_squared_1 * route_dist_squared_1
}
else
{
- route_dist_squared_2 = fabsf((slope * _pos.unitx)
+ route_dist_squared_2 = abs((slope * _pos.unitx)
- _pos.unity + (route_y1 - (slope * route_x1)));
route_dist_squared_2 =
route_dist_squared_2 * route_dist_squared_2
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_DOWNROUTE, _osso);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
oti.txt_from = gtk_entry_new(),
1, 4, 3, 4, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_from), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_from), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_from), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Destination. */
gtk_table_attach(GTK_TABLE(table),
oti.txt_to = gtk_entry_new(),
1, 4, 4, 5, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_to), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_to), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_to), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Set up auto-completion. */
g_signal_connect(G_OBJECT(oti.rad_use_text), "toggled",
G_CALLBACK(origin_type_selected), &oti);
- //gtk_widget_set_sensitive(oti.chk_auto, FALSE);
+ gtk_widget_set_sensitive(oti.chk_auto, FALSE);
}
/* Initialize fields. */
"delete from route_way",
-1, &_route_stmt_delete_way, NULL)
|| SQLITE_OK != sqlite3_prepare(_path_db,
- "insert into route_path (num, unitx, unity, time, altitude) "
+ "insert into route_path "
+ "(num, unitx, unity, time, altitude) "
"values (NULL, ?, ?, ?, ?)",
-1, &_route_stmt_insert_path, NULL)
|| SQLITE_OK != sqlite3_prepare(_path_db,
"delete from track_way",
-1, &_track_stmt_delete_way, NULL)
|| SQLITE_OK != sqlite3_prepare(_path_db,
- "insert into track_path (num, unitx, unity, time, altitude) "
+ "insert into track_path "
+ "(num, unitx, unity, time, altitude) "
"values (NULL, ?, ?, ?, ?)",
-1, &_track_stmt_insert_path, NULL)
|| SQLITE_OK != sqlite3_prepare(_path_db,
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <string.h>
#include <math.h>
-#include <osso-helplib.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-file-chooser-dialog.h>
-#include <hildon-widgets/hildon-number-editor.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-input-mode-hint.h>
+
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-file-chooser-dialog.h>
+# include <hildon/hildon-number-editor.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-file-chooser-dialog.h>
+# include <hildon-widgets/hildon-number-editor.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-input-mode-hint.h>
+#endif
#include <sqlite3.h>
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_POICAT, _osso);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
g_object_unref(G_OBJECT(store));
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(pli.dialog), HELP_ID_POILIST, _osso);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(pli.dialog)->action_area),
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_DOWNPOI, _osso);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
oti.txt_origin = gtk_entry_new(),
1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_origin), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_origin), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_origin), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Query. */
gtk_table_attach(GTK_TABLE(table2),
oti.txt_query = gtk_entry_new(),
1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_query), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_query), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_query), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Set up auto-completion. */
origin_comp = gtk_entry_completion_new();
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_BROWSEPOI, _osso);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
oti.txt_origin = gtk_entry_new(),
1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_origin), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_origin), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_origin), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Destination. */
gtk_table_attach(GTK_TABLE(table2),
oti.txt_query = gtk_entry_new(),
1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 2, 4);
gtk_entry_set_width_chars(GTK_ENTRY(oti.txt_query), 25);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(oti.txt_query), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(oti.txt_query), HILDON_AUTOCAP, FALSE, NULL);
+#endif
/* Set up auto-completion. */
origin_comp = gtk_entry_completion_new();
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <stdlib.h>
#include <string.h>
#include <math.h>
-#include <osso-helplib.h>
#include <dbus/dbus-glib.h>
#include <bt-dbus.h>
-#include <hildon-widgets/hildon-note.h>
-#include <hildon-widgets/hildon-color-button.h>
-#include <hildon-widgets/hildon-file-chooser-dialog.h>
-#include <hildon-widgets/hildon-number-editor.h>
-#include <hildon-widgets/hildon-banner.h>
-#include <hildon-widgets/hildon-input-mode-hint.h>
#include <gconf/gconf-client.h>
+#ifndef LEGACY
+# include <hildon/hildon-help.h>
+# include <hildon/hildon-note.h>
+# include <hildon/hildon-color-button.h>
+# include <hildon/hildon-file-chooser-dialog.h>
+# include <hildon/hildon-number-editor.h>
+# include <hildon/hildon-banner.h>
+#else
+# include <osso-helplib.h>
+# include <hildon-widgets/hildon-note.h>
+# include <hildon-widgets/hildon-color-button.h>
+# include <hildon-widgets/hildon-file-chooser-dialog.h>
+# include <hildon-widgets/hildon-number-editor.h>
+# include <hildon-widgets/hildon-banner.h>
+# include <hildon-widgets/hildon-input-mode-hint.h>
+#endif
+
#include "types.h"
#include "data.h"
#include "defines.h"
while(GTK_RESPONSE_ACCEPT == gtk_dialog_run(GTK_DIALOG(dialog)))
{
+#ifndef LEGACY
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_MARK]),
+ &_color[COLORABLE_MARK]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_MARK_VELOCITY]),
+ &_color[COLORABLE_MARK_VELOCITY]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_MARK_OLD]),
+ &_color[COLORABLE_MARK_OLD]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_TRACK]),
+ &_color[COLORABLE_TRACK]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_MARK]),
+ &_color[COLORABLE_TRACK_MARK]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_TRACK_BREAK]),
+ &_color[COLORABLE_TRACK_BREAK]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE]),
+ &_color[COLORABLE_ROUTE]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_WAY]),
+ &_color[COLORABLE_ROUTE_WAY]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_ROUTE_BREAK]),
+ &_color[COLORABLE_ROUTE_BREAK]);
+
+ hildon_color_button_get_color(
+ HILDON_COLOR_BUTTON(cdi.col[COLORABLE_POI]),
+ &_color[COLORABLE_POI]);
+#else
GdkColor *color;
color = hildon_color_button_get_color(
HILDON_COLOR_BUTTON(cdi.col[COLORABLE_POI]));
_color[COLORABLE_POI] = *color;
+#endif
+
update_gcs();
break;
}
NULL);
/* Enable the help button. */
+#ifndef LEGACY
+ hildon_help_dialog_help_enable(
+#else
ossohelp_dialog_help_enable(
+#endif
GTK_DIALOG(dialog), HELP_ID_SETTINGS, _osso);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
gtk_box_pack_start(GTK_BOX(hbox),
txt_gps_bt_mac = gtk_entry_new(),
TRUE, TRUE, 0);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_gps_bt_mac), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_gps_bt_mac), HILDON_AUTOCAP, FALSE, NULL);
+#endif
gtk_box_pack_start(GTK_BOX(hbox),
btn_scan = gtk_button_new_with_label(_("Scan...")),
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
txt_gps_file_path = gtk_entry_new(),
TRUE, TRUE, 0);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_gps_file_path), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_gps_file_path), HILDON_AUTOCAP, FALSE, NULL);
+#endif
gtk_box_pack_start(GTK_BOX(hbox),
btn_browse_gps = gtk_button_new_with_label(_("Browse...")),
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
txt_gps_gpsd_host = gtk_entry_new(),
TRUE, TRUE, 0);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_gps_gpsd_host), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_gps_gpsd_host), HILDON_AUTOCAP, FALSE, NULL);
+#endif
gtk_box_pack_start(GTK_BOX(hbox),
label = gtk_label_new(_("Port")),
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(hbox),
txt_poi_db = gtk_entry_new(),
TRUE, TRUE, 0);
+#ifndef LEGACY
+ g_object_set(G_OBJECT(txt_poi_db), "hildon-input-mode",
+ HILDON_GTK_INPUT_MODE_FULL, NULL);
+#else
g_object_set(G_OBJECT(txt_poi_db), HILDON_AUTOCAP, FALSE, NULL);
+#endif
gtk_box_pack_start(GTK_BOX(hbox),
btn_browse_poi = gtk_button_new_with_label(_("Browse...")),
FALSE, FALSE, 0);
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#define _GNU_SOURCE
#include <ctype.h>
#include <string.h>
#include <math.h>
-#include <hildon-widgets/hildon-note.h>
+
+#ifndef LEGACY
+# include <hildon/hildon-note.h>
+#else
+# include <hildon-widgets/hildon-note.h>
+#endif
#include "types.h"
#include "data.h"
void
force_min_visible_bars(HildonControlbar *control_bar, gint num_bars)
{
+#ifdef LEGACY
GValue val;
printf("%s()\n", __PRETTY_FUNCTION__);
memset(&val, 0, sizeof(val));
g_value_set_int(&val, num_bars);
g_object_set_property(G_OBJECT(control_bar), "minimum-visible-bars", &val);
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
+#endif
}
gboolean
* along with Maemo Mapper. If not, see <http://www.gnu.org/licenses/>.
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#ifndef MAEMO_MAPPER_UTIL_H
#define MAEMO_MAPPER_UTIL_H
-#include <hildon-widgets/hildon-controlbar.h>
+#ifndef LEGACY
+# include <hildon/hildon-controlbar.h>
+#else
+# include <hildon-widgets/hildon-controlbar.h>
+#endif
void popup_error(GtkWidget *window, const gchar *error);