gps-browse.c \
gps-nmea-parse.c \
gps-panels.c \
+ gps-conn.c \
cb.c \
iap.c \
route.c \
perror("ERROR: ");
return TRUE;
break;
+ case EHOSTUNREACH:
+ g_printf("*** Bluetooth/GPS device not found.\n");
+ rcvr_disconnect();
+ rcvr_connect_later();
+ return FALSE;
+ break;
default:
/* Connection failed. Disconnect and try again later. */
g_printf("### Connect failed, retrying... %d %d\n", e, r);
#include <glib/gstdio.h>
#include <gtk/gtk.h>
#include <fcntl.h>
-#include <libgnomevfs/gnome-vfs.h>
-#include <curl/multi.h>
#include <gconf/gconf-client.h>
-#include <libxml/parser.h>
#include <libintl.h>
#include <locale.h>
-#include <sqlite3.h>
-#ifdef WITH_HILDON
+#ifdef WITH_OSSO
#include <libosso.h>
#include <osso-helplib.h>
+#endif
+#ifdef WITH_HILDON
#include <hildon-widgets/hildon-program.h>
#include <hildon-widgets/hildon-controlbar.h>
#include <hildon-widgets/hildon-note.h>
g_free(desc);
- confirm =
- hildon_note_new_confirmation(GTK_WINDOW(dialog),
- _
- ("Creating a \"waypoint\" with no description actually "
+ confirm = hildon_note_new_confirmation(GTK_WINDOW(dialog),
+ _("Creating a \"waypoint\" with no description actually "
"adds a break point. Is that what you want?"));
- if (GTK_RESPONSE_OK ==
- gtk_dialog_run(GTK_DIALOG(confirm))) {
+ if (GTK_RESPONSE_OK == gtk_dialog_run(GTK_DIALOG(confirm))) {
/* There's no description. Add a break by adding a (0, 0)
* point (if necessary), and then the ordinary route point. */
if (_route.tail->unity) {
PoiInfo poi;
printf("%s()\n", __PRETTY_FUNCTION__);
- if (select_poi
- (x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) {
+ if (select_poi(x2unit(_cmenu_position_x), y2unit(_cmenu_position_y), &poi)) {
guint unitx, unity;
latlon2unit(poi.lat, poi.lon, unitx, unity);
cmenu_route_to(unitx, unity);
--- /dev/null
+#define _GNU_SOURCE
+
+#define _(String) gettext(String)
+
+#include <config.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <errno.h>
+#include <sys/wait.h>
+#include <glib/gstdio.h>
+#include <gtk/gtk.h>
+#include <fcntl.h>
+#include <dbus/dbus-glib.h>
+
+#ifdef WITH_HILDON
+#include <hildon-widgets/hildon-banner.h>
+#endif
+
+static GtkWidget *connect_banner = NULL;
+static GtkWidget *fix_banner = NULL;
+
+#include <libintl.h>
+#include <locale.h>
+
+#include "utils.h"
+#include "settings.h"
+#include "gps.h"
+#include "map.h"
+#include "bt.h"
+#include "ui-common.h"
+
+/**
+ * Set the connection state. This function controls all connection-related
+ * banners.
+ */
+void
+set_conn_state(ConnState new_conn_state)
+{
+switch (_conn_state = new_conn_state) {
+ case RCVR_OFF:
+ case RCVR_FIXED:
+ if (connect_banner) {
+ gtk_widget_destroy(connect_banner);
+ connect_banner = NULL;
+ }
+ if (fix_banner) {
+ gtk_widget_destroy(fix_banner);
+ fix_banner = NULL;
+ }
+ break;
+ case RCVR_DOWN:
+ if (fix_banner) {
+ gtk_widget_destroy(fix_banner);
+ fix_banner = NULL;
+ }
+ if (!connect_banner)
+ connect_banner = hildon_banner_show_animation(_window, NULL, _("Searching for GPS receiver"));
+ break;
+ case RCVR_UP:
+ if (connect_banner) {
+ gtk_widget_destroy(connect_banner);
+ connect_banner = NULL;
+ }
+ if (!fix_banner)
+ fix_banner = hildon_banner_show_progress(_window, NULL, _("Establishing GPS fix"));
+ break;
+ default:; /* to quell warning. */
+}
+}
+
+void
+set_fix_progress(gdouble fix)
+{
+#ifdef WITH_HILDON
+hildon_banner_set_fraction(fix_banner, fix);
+#else
+gtk_progress_bar_set_fraction(_progress_item, fix);
+#endif
+}
#include <fcntl.h>
#include <libxml/parser.h>
-#ifdef WITH_HILDON
-#include <hildon-widgets/hildon-banner.h>
-#endif
-
#include "utils.h"
#include "bt.h"
#include "gps.h"
/* This is the last message. Calculate signal strength. */
if (num_sats_used) {
if (_conn_state == RCVR_UP) {
- gdouble fraction =
- running_total * sqrt(num_sats_used)
- / num_sats_used / 100.0;
+ gdouble fraction = running_total * sqrt(num_sats_used) / num_sats_used / 100.0;
BOUND(fraction, 0.0, 1.0);
- hildon_banner_set_fraction(HILDON_BANNER(_fix_banner), fraction);
+ set_fix_progress(fraction);
}
running_total = 0;
num_sats_used = 0;
#include "mapper-types.h"
#include "ui-common.h"
-void gps_display_data(void)
+void
+gps_display_data(void)
{
gchar *buffer, litbuf[16];
printf("%s()\n", __PRETTY_FUNCTION__);
vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-void gps_show_info(void)
+void
+gps_show_info(void)
{
printf("%s()\n", __PRETTY_FUNCTION__);
return TRUE;
}
-gboolean heading_panel_expose(GtkWidget * widget, GdkEventExpose * event)
+gboolean
+heading_panel_expose(GtkWidget * widget, GdkEventExpose * event)
{
guint size, xoffset, yoffset, i, x, y;
gint dir;
return TRUE;
}
-void gps_details_dialog(void)
+void
+gps_details_dialog(void)
{
GtkWidget *dialog;
GtkWidget *hildon_file_chooser_dialog_new(GtkWindow * parent,
GtkFileChooserAction action)
{
- GtkWidget *dialog;
-
- if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
- dialog = gtk_file_chooser_dialog_new("Save", parent, action,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE,
- GTK_RESPONSE_ACCEPT, NULL);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER
- (dialog), TRUE);
- } else {
- dialog = gtk_file_chooser_dialog_new("Open", parent, action,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN,
- GTK_RESPONSE_ACCEPT, NULL);
- }
-
- return dialog;
+GtkWidget *dialog;
+
+if (action == GTK_FILE_CHOOSER_ACTION_SAVE) {
+ dialog = gtk_file_chooser_dialog_new("Save", parent, action,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_SAVE,
+ GTK_RESPONSE_ACCEPT, NULL);
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), TRUE);
+} else {
+ dialog = gtk_file_chooser_dialog_new("Open", parent, action,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN,
+ GTK_RESPONSE_ACCEPT, NULL);
+}
+return dialog;
}
static gboolean
status_bar_clear(void)
{
- gtk_statusbar_pop(_status_bar, 0);
- _sb_sid=0;
- return FALSE;
+gtk_statusbar_pop(_status_bar, 0);
+_sb_sid=0;
+return FALSE;
}
void hildon_banner_show_information(GtkWidget *w, void *t, gchar *text)
{
- gtk_statusbar_pop(GTK_STATUSBAR(_status_bar), 0);
- gtk_statusbar_push(GTK_STATUSBAR(_status_bar), 0, text);
- if (_sb_sid!=0)
- g_source_remove(_sb_sid);
- _sb_sid=g_timeout_add(6000, status_bar_clear, NULL);
+gtk_statusbar_pop(GTK_STATUSBAR(_status_bar), 0);
+gtk_statusbar_push(GTK_STATUSBAR(_status_bar), 0, text);
+if (_sb_sid!=0)
+ g_source_remove(_sb_sid);
+_sb_sid=g_timeout_add(6000, status_bar_clear, NULL);
}
GtkWidget *hildon_banner_show_progress(GtkWidget * widget, GtkProgressBar *bar,
const gchar * text)
{
- gtk_widget_show(_progress_item);
- gtk_progress_bar_set_text(_progress_item, text);
- hildon_banner_show_information(_status_bar, NULL, text);
- return NULL;
+gtk_widget_show(_progress_item);
+gtk_progress_bar_set_text(_progress_item, text);
+hildon_banner_show_information(_status_bar, NULL, text);
+return NULL;
}
GtkWidget *hildon_note_new_confirmation(GtkWidget *widget, const gchar *text)
{
- return gtk_message_dialog_new(widget,
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK_CANCEL, text);
+return gtk_message_dialog_new(widget,
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK_CANCEL, text);
}
void hildon_banner_set_fraction(GtkWidget * widget, gdouble fraction)
{
- gtk_progress_bar_set_fraction(_progress_item, fraction);
- if (fraction==1.0)
- gtk_widget_hide(_progress_item);
- else
- gtk_widget_show(_progress_item);
+gtk_progress_bar_set_fraction(_progress_item, fraction);
+if (fraction==1.0)
+ gtk_widget_hide(_progress_item);
+else
+ gtk_widget_show(_progress_item);
}
GtkWidget *hildon_banner_show_animation(GtkWidget *widget,
const gchar *animation_name,
const gchar *text)
{
- hildon_banner_show_information(_status_bar, NULL, text);
- gtk_widget_show(_progress_item);
- gtk_progress_bar_pulse(_progress_item);
- return NULL;
+hildon_banner_show_information(_status_bar, NULL, text);
+gtk_widget_show(_progress_item);
+gtk_progress_bar_pulse(_progress_item);
+return NULL;
}
void gtk_widget_tap_and_hold_setup(GtkWidget * a, GtkWidget * w, void *p, gint t)
{
-
}
GtkWidget *hildon_number_editor_new(gint min, gint max)
{
- return gtk_spin_button_new_with_range(min, max, 1);
+return gtk_spin_button_new_with_range(min, max, 1);
}
gint hildon_number_editor_get_value(GtkWidget * w)
{
- return gtk_spin_button_get_value_as_int(GTK_WIDGET(w));
+return gtk_spin_button_get_value_as_int(GTK_WIDGET(w));
}
void hildon_number_editor_set_value(GtkWidget * w, gint v)
{
- gtk_spin_button_set_value(w, v);
+gtk_spin_button_set_value(w, v);
}
void hildon_number_editor_set_range(GtkWidget * w, gint min, gint max)
{
- gtk_spin_button_set_range(w, min, max);
+gtk_spin_button_set_range(w, min, max);
}
GtkWidget *hildon_controlbar_new()
{
- return gtk_hscale_new_with_range(1, 10, 1);
+return gtk_hscale_new_with_range(1, 10, 1);
}
gint hildon_controlbar_get_value(GtkWidget * w)
{
- return gtk_range_get_value(w);
+return gtk_range_get_value(w);
}
void hildon_controlbar_set_value(GtkWidget * w, gint v)
{
- gtk_range_set_value(w, (gdouble)v);
+gtk_range_set_value(w, (gdouble)v);
}
void hildon_controlbar_set_range(GtkWidget * w, gint min, gint max)
{
- gtk_range_set_range(w, (gdouble)min, (gdouble)max);
+gtk_range_set_range(w, (gdouble)min, (gdouble)max);
}
#else
#include <config.h>
-#ifdef WITH_HILDON
+#ifdef WITH_OSSO
#include <libosso.h>
#include <osso-helplib.h>
#include <hildon-widgets/hildon-program.h>
#include <hildon-widgets/hildon-controlbar.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-system-sound.h>
#include <hildon-widgets/hildon-input-mode-hint.h>
#include <device_symbols.h>
#endif
{0, 0xa000, 0x0000, 0xa000} /* COLORABLE_POI */
};
-/**
- * Set the connection state. This function controls all connection-related
- * banners.
- */
-void set_conn_state(ConnState new_conn_state)
-{
- printf("%s(%d)\n", __PRETTY_FUNCTION__, new_conn_state);
-
- switch (_conn_state = new_conn_state) {
- case RCVR_OFF:
- case RCVR_FIXED:
-#ifdef WITH_HILDON
- if (_connect_banner) {
- gtk_widget_destroy(_connect_banner);
- _connect_banner = NULL;
- }
- if (_fix_banner) {
- gtk_widget_destroy(_fix_banner);
- _fix_banner = NULL;
- }
-#else
-
-#endif
- break;
- case RCVR_DOWN:
-#ifdef WITH_HILDON
- if (_fix_banner) {
- gtk_widget_destroy(_fix_banner);
- _fix_banner = NULL;
- }
- if (!_connect_banner)
- _connect_banner = hildon_banner_show_animation(_window, NULL,
- _("Searching for GPS receiver"));
-#else
-
-#endif
- break;
- case RCVR_UP:
-#ifdef WITH_HILDON
- if (_connect_banner) {
- gtk_widget_destroy(_connect_banner);
- _connect_banner = NULL;
- }
- if (!_fix_banner)
- _fix_banner = hildon_banner_show_progress(_window, NULL,
- _("Establishing GPS fix"));
-#else
-
-#endif
- break;
- default:; /* to quell warning. */
- }
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
-}
/**
* Save state and destroy all non-UI elements created by this program in
gtk_menu_append(submenu, _cmenu_loc_distance_to_item
= gtk_menu_item_new_with_label(_("Show Distance to")));
gtk_menu_append(submenu, _cmenu_loc_route_to_item
- =
- gtk_menu_item_new_with_label(_
- ("Download Route to...")));
+ = gtk_menu_item_new_with_label(_("Download Route to...")));
gtk_menu_append(submenu, gtk_separator_menu_item_new());
gtk_menu_append(submenu, _cmenu_loc_add_route
= gtk_menu_item_new_with_label(_("Add Route Point")));
GtkWidget *_cmenu_poi_add_way;
GtkWidget *_cmenu_poi_goto_nearpoi;
-/** BANNERS. */
-GtkWidget *_connect_banner;
-GtkWidget *_fix_banner;
+/* Banners/Progress bars */
GtkWidget *_download_banner;
GtkWidget *_status_bar;