#include <stdlib.h>
#include <math.h>
#include "viking.h"
-#include "vikgpslayer_pixmap.h"
+#include "icons/icons.h"
#include "babel.h"
#include <string.h>
static gchar * params_protocols[] = {"Garmin", "Magellan", NULL};
static gchar * protocols_args[] = {"garmin", "magellan"};
/*#define NUM_PROTOCOLS (sizeof(params_protocols)/sizeof(params_protocols[0]) - 1) */
+#ifdef WINDOWS
+static gchar * params_ports[] = {"com1", "usb:", NULL};
+#else
static gchar * params_ports[] = {"/dev/ttyS0", "/dev/ttyS1", "/dev/ttyUSB0", "/dev/ttyUSB1", "usb:", NULL};
+#endif
#define NUM_PORTS (sizeof(params_ports)/sizeof(params_ports[0]) - 1)
typedef enum {GPS_DOWN=0, GPS_UP} gps_dir;
VikLayerInterface vik_gps_layer_interface = {
"GPS",
- &gpslayer_pixbuf,
+ &vikgpslayer_pixbuf,
NULL,
0,
gdk_threads_enter();
g_mutex_lock(sess->mutex);
if (sess->ok) {
- g_sprintf(s, "%s %d %s...",
- (sess->direction == GPS_DOWN) ? _("Downloading") : _("Uploading"), cnt,
- (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+ const gchar *tmp_str;
+ if (sess->direction == GPS_DOWN)
+ {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Downloading %d waypoint...", "Downloading %d waypoints...", cnt);
+ else
+ tmp_str = ngettext("Downloading %d trackpoint...", "Downloading %d trackpoints...", cnt);
+ }
+ else
+ {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Uploading %d waypoint...", "Uploading %d waypoints...", cnt);
+ else
+ tmp_str = ngettext("Uploading %d trackpoint...", "Uploading %d trackpoints...", cnt);
+ }
+
+ g_snprintf(s, 128, tmp_str, cnt);
gtk_label_set_text ( GTK_LABEL(sess->progress_label), s );
gtk_widget_show ( sess->progress_label );
sess->total_count = cnt;
static void set_current_count(gint cnt, GpsSession *sess)
{
gchar s[128];
- const gchar *dir_str = (sess->direction == GPS_DOWN) ? _("Downloaded") : _("Uploaded");
+ const gchar *tmp_str;
gdk_threads_enter();
g_mutex_lock(sess->mutex);
if (sess->ok) {
if (cnt < sess->total_count) {
- g_sprintf(s, _("%s %d out of %d %s..."), dir_str, cnt, sess->total_count, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+ if (sess->direction == GPS_DOWN)
+ {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Downloaded %d out of %d waypoint...", "Downloaded %d out of %d waypoints...", sess->total_count);
+ else
+ tmp_str = ngettext("Downloaded %d out of %d trackpoint...", "Downloaded %d out of %d trackpoints...", sess->total_count);
+ }
+ else {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Uploaded %d out of %d waypoint...", "Uploaded %d out of %d waypoints...", sess->total_count);
+ else
+ tmp_str = ngettext("Uploaded %d out of %d trackpoint...", "Uploaded %d out of %d trackpoints...", sess->total_count);
+ }
+ g_snprintf(s, 128, tmp_str, cnt, sess->total_count);
} else {
- g_sprintf(s, "%s %d %s.", dir_str, cnt, (sess->progress_label == sess->wp_label) ? _("waypoints") : _("trackpoints"));
+ if (sess->direction == GPS_DOWN)
+ {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Downloaded %d waypoint", "Downloaded %d waypoints", cnt);
+ else
+ tmp_str = ngettext("Downloaded %d trackpoint", "Downloaded %d trackpoints", cnt);
+ }
+ else {
+ if (sess->progress_label == sess->wp_label)
+ tmp_str = ngettext("Uploaded %d waypoint", "Uploaded %d waypoints", cnt);
+ else
+ tmp_str = ngettext("Uploaded %d trackpoint", "Uploaded %d trackpoints", cnt);
+ }
+ g_snprintf(s, 128, tmp_str, cnt);
}
gtk_label_set_text ( GTK_LABEL(sess->progress_label), s );
}
gdk_threads_enter();
g_mutex_lock(sess->mutex);
if (sess->ok) {
- g_sprintf(s, _("GPS Device: %s"), info);
+ g_snprintf(s, 256, _("GPS Device: %s"), info);
gtk_label_set_text ( GTK_LABEL(sess->gps_label), s );
}
g_mutex_unlock(sess->mutex);