138 |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
139 |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
140 |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
141 |
|
|
142 |
|
if(filename) { |
143 |
|
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
144 |
|
|
145 |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
if(!whole_dir) |
146 |
|
gpx = gpx_parse(dialog, filename); |
147 |
if(!whole_dir) |
else { |
148 |
gpx = gpx_parse(dialog, filename); |
/* cur trailing '/' if present */ |
149 |
else { |
if(strlastchr(filename) == '/') |
150 |
/* cur trailing '/' if present */ |
filename[strlen(filename)] = 0; |
151 |
if(strlastchr(filename) == '/') |
|
152 |
filename[strlen(filename)] = 0; |
gpx = gpx_parse_dir(dialog, filename); |
|
|
|
|
gpx = gpx_parse_dir(dialog, filename); |
|
|
} |
|
|
|
|
|
gpx_busy_dialog_destroy(dialog); |
|
|
|
|
|
/* save path if gpx was successfully loaded */ |
|
|
if(gpx) { |
|
|
char *r = strrchr(filename, '/'); |
|
|
|
|
|
/* there is a delimiter, use everything left of it as path */ |
|
|
if(r && !whole_dir) { |
|
|
*r = 0; |
|
|
if(appdata->path) free(appdata->path); |
|
|
appdata->path = strdup(filename); |
|
|
/* restore path ... just in case ... */ |
|
|
*r = '/'; |
|
153 |
} |
} |
154 |
|
|
155 |
|
gpx_busy_dialog_destroy(dialog); |
156 |
|
|
157 |
|
/* save path if gpx was successfully loaded */ |
158 |
|
if(gpx) { |
159 |
|
char *r = strrchr(filename, '/'); |
160 |
|
|
161 |
|
/* there is a delimiter, use everything left of it as path */ |
162 |
|
if(r && !whole_dir) { |
163 |
|
*r = 0; |
164 |
|
if(appdata->path) free(appdata->path); |
165 |
|
appdata->path = strdup(filename); |
166 |
|
/* restore path ... just in case ... */ |
167 |
|
*r = '/'; |
168 |
|
} |
169 |
|
|
170 |
|
if(whole_dir) |
171 |
|
appdata->path = strdup(filename); |
172 |
|
} else |
173 |
|
errorf(_("Load error")); |
174 |
|
|
175 |
if(whole_dir) |
g_free (filename); |
176 |
appdata->path = strdup(filename); |
} else { |
177 |
|
#ifndef USE_MAEMO |
178 |
|
errorf(_("Error accessing the file.")); |
179 |
|
#else |
180 |
|
errorf(_("Error accessing the file. This may happen if the file " |
181 |
|
"resides on a remote file system. Please copy the file onto " |
182 |
|
"the device (e.g. onto the memory card) and try again.")); |
183 |
|
#endif |
184 |
} |
} |
|
|
|
|
g_free (filename); |
|
185 |
} |
} |
186 |
|
|
187 |
gtk_widget_destroy (dialog); |
gtk_widget_destroy (dialog); |
213 |
GtkTreeIter iter; |
GtkTreeIter iter; |
214 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
215 |
|
|
216 |
|
#ifdef USE_MAEMO |
217 |
|
/* check if a cache is already selected and ignore click if yes */ |
218 |
|
/* (was probably a double click) */ |
219 |
|
if(appdata->cur_cache) return; |
220 |
|
#endif |
221 |
|
|
222 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
223 |
cache_t *cache; |
cache_t *cache; |
224 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
346 |
|
|
347 |
if(appdata->cachelist_update) |
if(appdata->cachelist_update) |
348 |
cachelist_redraw(appdata); |
cachelist_redraw(appdata); |
349 |
|
|
350 |
#endif |
#endif |
351 |
|
|
352 |
return TRUE; |
return TRUE; |
605 |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
606 |
|
|
607 |
appdata->cur_gpx = gpx; |
appdata->cur_gpx = gpx; |
608 |
char *title = g_strdup_printf("GPXView - %s", gpx->name); |
char *title = g_strdup_printf("%s - GPXView", gpx->name); |
609 |
gtk_window_set_title(GTK_WINDOW(window), title); |
gtk_window_set_title(GTK_WINDOW(window), title); |
610 |
g_free(title); |
g_free(title); |
611 |
|
|
731 |
GtkTreeIter iter; |
GtkTreeIter iter; |
732 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
733 |
|
|
734 |
|
#ifdef USE_MAEMO |
735 |
|
/* check if a cache is already selected and ignore click if yes */ |
736 |
|
/* (was probably a double click) */ |
737 |
|
if(appdata->cur_gpx) return; |
738 |
|
#endif |
739 |
|
|
740 |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
741 |
gpx_t *gpx; |
gpx_t *gpx; |
742 |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
835 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
836 |
} |
} |
837 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
838 |
|
#ifdef USE_STACKABLE_WINDOW |
839 |
if(!appdata->cur_gpx) |
if(!appdata->cur_gpx) |
840 |
|
#endif |
841 |
cachelist_dialog(appdata, gpx); |
cachelist_dialog(appdata, gpx); |
842 |
|
#ifdef USE_STACKABLE_WINDOW |
843 |
else |
else |
844 |
printf("selected gpx, but cachelist window already present\n"); |
printf("selected gpx, but cachelist window already present\n"); |
845 |
|
#endif |
846 |
#else |
#else |
847 |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
848 |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
981 |
GtkTreeIter iter; |
GtkTreeIter iter; |
982 |
gtk_list_store_append(appdata->gpxstore, &iter); |
gtk_list_store_append(appdata->gpxstore, &iter); |
983 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
984 |
|
|
985 |
if(gpx == sel_gpx) { |
if(gpx == sel_gpx) { |
986 |
sel_iter = iter; |
sel_iter = iter; |
987 |
sel_iter_valid = TRUE; |
sel_iter_valid = TRUE; |
1041 |
|
|
1042 |
/******************** begin of menu *********************/ |
/******************** begin of menu *********************/ |
1043 |
|
|
1044 |
|
typedef struct { |
1045 |
|
appdata_t *appdata; |
1046 |
|
GtkWidget *dialog; |
1047 |
|
} about_context_t; |
1048 |
|
|
1049 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1050 |
|
void on_paypal_button_clicked(GtkButton *button, about_context_t *context) { |
1051 |
|
gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT); |
1052 |
|
browser_url(context->appdata, |
1053 |
|
"https://www.paypal.com/cgi-bin/webscr" |
1054 |
|
"?cmd=_s-xclick&hosted_button_id=7400558"); |
1055 |
|
} |
1056 |
|
#endif |
1057 |
|
|
1058 |
static void |
static void |
1059 |
cb_menu_about(GtkWidget *window, gpointer data) { |
cb_menu_about(GtkWidget *window, gpointer data) { |
1060 |
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
about_context_t context; |
1061 |
|
|
1062 |
|
context.appdata = (appdata_t *)data; |
1063 |
|
|
1064 |
|
#ifdef ENABLE_LIBLOCATION |
1065 |
|
char *uses = "uses liblocation"; |
1066 |
|
#elif defined(ENABLE_GPSBT) |
1067 |
|
char *uses = "uses gpsbt and gpsd"; |
1068 |
|
#else |
1069 |
|
char *uses = "uses gpsd"; |
1070 |
|
#endif |
1071 |
|
|
1072 |
|
const gchar *authors[] = { |
1073 |
|
"Till Harbaum <till@harbaum.org>", |
1074 |
|
"John Stowers <john.stowers@gmail.com>", |
1075 |
|
NULL }; |
1076 |
|
|
1077 |
|
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1078 |
|
"name", "GPXView", |
1079 |
|
"version", VERSION, |
1080 |
|
"copyright", _("Copyright 2008-2009"), |
1081 |
|
"authors", authors, |
1082 |
|
"website", _("http://www.harbaum.org/till/maemo"), |
1083 |
|
"comments", _(uses), |
1084 |
|
NULL); |
1085 |
|
|
1086 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1087 |
|
/* add a way to donate to the project */ |
1088 |
|
GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0); |
1089 |
|
|
1090 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 8); |
1091 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
1092 |
|
gtk_label_new(_("Do you like GPXView?")), |
1093 |
|
FALSE, FALSE, 0); |
1094 |
|
|
1095 |
|
GtkWidget *button = gtk_button_new(); |
1096 |
|
gtk_button_set_image(GTK_BUTTON(button), |
1097 |
|
icon_get_widget(ICON_MISC, 8)); |
1098 |
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1099 |
|
g_signal_connect(button, "clicked", |
1100 |
|
G_CALLBACK(on_paypal_button_clicked), &context); |
1101 |
|
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1102 |
|
|
1103 |
|
gtk_container_add(GTK_CONTAINER(alignment), hbox); |
1104 |
|
gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox), |
1105 |
|
alignment); |
1106 |
|
|
1107 |
gtk_about_dialog_set_name(about, "GPXView"); |
gtk_widget_show_all(alignment); |
1108 |
gtk_about_dialog_set_version(about, VERSION); |
#endif |
1109 |
gtk_about_dialog_set_copyright(about, |
|
1110 |
_("GPXView (c) 2008 by\n" |
gtk_dialog_run(GTK_DIALOG(context.dialog)); |
1111 |
"Till Harbaum <till@harbaum.org>\n" |
gtk_widget_destroy(context.dialog); |
|
"Geocaching.com: Tantil")); |
|
|
|
|
|
gtk_about_dialog_set_website(about, |
|
|
_("http://www.harbaum.org/till/maemo")); |
|
|
|
|
|
gtk_about_dialog_set_comments(about, |
|
|
_("Geocaching.com GPX file viewer")); |
|
|
|
|
|
gtk_widget_show_all(GTK_WIDGET(about)); |
|
|
gtk_dialog_run(GTK_DIALOG(about)); |
|
|
gtk_widget_destroy(GTK_WIDGET(about)); |
|
1112 |
} |
} |
1113 |
|
|
1114 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1458 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1459 |
|
|
1460 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#ifndef USE_BREAD_CRUMB_TRAIL |
1461 |
appdata->search_results = |
gpx_t *found = |
1462 |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1463 |
|
|
1464 |
/* do search result dialog here ... */ |
/* do search result dialog here ... */ |
1465 |
cachelist_dialog(appdata, appdata->search_results); |
cachelist_dialog(appdata, found); |
1466 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
1467 |
search_result_free(appdata->search_results); |
search_result_free(found); |
1468 |
appdata->search_results = NULL; |
#else |
1469 |
|
appdata->search_results = found; |
1470 |
#endif |
#endif |
1471 |
#else |
#else |
1472 |
gpx_t *found = NULL; |
gpx_t *found = NULL; |
1491 |
gtk_widget_destroy(dialog); |
gtk_widget_destroy(dialog); |
1492 |
} |
} |
1493 |
|
|
1494 |
void on_window_destroy (GtkWidget *widget, gpointer data); |
static void on_window_destroy (GtkWidget *widget, gpointer data); |
1495 |
|
|
1496 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
1497 |
static void |
static void |
1553 |
notes_log_export(appdata); |
notes_log_export(appdata); |
1554 |
} |
} |
1555 |
|
|
1556 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1557 |
static void |
static void |
1558 |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1559 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1567 |
garmin_export(appdata); |
garmin_export(appdata); |
1568 |
} |
} |
1569 |
|
|
1570 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1571 |
|
static void |
1572 |
|
cb_menu_map(GtkWidget *window, gpointer data) { |
1573 |
|
map((appdata_t *)data); |
1574 |
|
} |
1575 |
|
#endif |
1576 |
|
|
1577 |
static void |
static void |
1578 |
cb_menu_geomath(GtkWidget *window, gpointer data) { |
cb_menu_geomath(GtkWidget *window, gpointer data) { |
1579 |
geomath_dialog((appdata_t *)data); |
geomath_dialog((appdata_t *)data); |
1590 |
} |
} |
1591 |
|
|
1592 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
1593 |
static void on_export_destroy(GtkWidget *widget, appdata_t *appdata) { |
typedef struct { |
1594 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
char *label, *desc; |
1595 |
} |
GtkSignalFunc activate_cb; |
1596 |
|
} menu_entry_t; |
1597 |
|
|
1598 |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
typedef struct { |
1599 |
HildonStackableWindow *view_window; |
const char *title; |
1600 |
GtkWidget *but; |
const menu_entry_t *menu; |
1601 |
|
int len; |
1602 |
|
} submenu_t; |
1603 |
|
|
1604 |
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
#define COLUMNS 1 |
|
gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Export"); |
|
1605 |
|
|
1606 |
/* store last "cur_view" in window */ |
void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) { |
|
g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view); |
|
|
appdata->cur_view = NULL; |
|
1607 |
|
|
1608 |
g_signal_connect(G_OBJECT(view_window), "destroy", |
/* force closing of submenu dialog */ |
1609 |
G_CALLBACK(on_export_destroy), appdata); |
gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE); |
1610 |
|
gtk_widget_hide(menu); |
1611 |
|
|
1612 |
|
/* let gtk clean up */ |
1613 |
|
while(gtk_events_pending()) |
1614 |
|
gtk_main_iteration(); |
1615 |
|
} |
1616 |
|
|
1617 |
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
static GtkWidget *app_submenu_create(appdata_t *appdata, |
1618 |
|
const submenu_t *submenu) { |
1619 |
|
|
1620 |
but = hildon_button_new_with_text( |
/* create a oridinary dialog box */ |
1621 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
GtkWidget *dialog = gtk_dialog_new(); |
1622 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title)); |
1623 |
_("Export to Maemo Mapper"), |
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
1624 |
_("Save a Maemo Mapper POI file")); |
gtk_window_set_transient_for(GTK_WINDOW(dialog), |
1625 |
g_signal_connect(but, "clicked", |
GTK_WINDOW(appdata->window)); |
1626 |
G_CALLBACK(cb_menu_export_mmpoi), appdata); |
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1627 |
|
|
1628 |
|
GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE); |
1629 |
|
int x = 0, y = 0; |
1630 |
|
|
1631 |
but = hildon_button_new_with_text( |
const menu_entry_t *menu_entries = submenu->menu; |
1632 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
while(menu_entries->label) { |
1633 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
GtkWidget *button = NULL; |
|
_("Export Field Notes"), |
|
|
_("Save a Garmin Field Notes file")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_export_log), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
|
|
|
1634 |
|
|
1635 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1636 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1637 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1638 |
_("Export Garmin GPX"), |
_(menu_entries->label), _(menu_entries->desc)); |
|
_("Save a GPX file containing modified waypoints")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_export_garmin), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1639 |
|
|
1640 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
/* try to center both texts */ |
1641 |
gtk_widget_show_all (GTK_WIDGET (view_window)); |
hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1642 |
} |
hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1643 |
|
|
1644 |
static void on_tools_destroy(GtkWidget *widget, appdata_t *appdata) { |
g_signal_connect(button, "clicked", |
1645 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
G_CALLBACK(on_submenu_entry_clicked), dialog); |
1646 |
} |
|
1647 |
|
g_signal_connect(button, "clicked", |
1648 |
|
menu_entries->activate_cb, appdata); |
1649 |
|
|
1650 |
|
gtk_table_attach_defaults(GTK_TABLE(table), button, x, x+1, y, y+1); |
1651 |
|
|
1652 |
|
x++; |
1653 |
|
if(x == COLUMNS) { x = 0; y++; } |
1654 |
|
|
1655 |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
menu_entries++; |
1656 |
HildonStackableWindow *view_window; |
} |
|
GtkWidget *but; |
|
1657 |
|
|
1658 |
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table); |
|
gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Tools"); |
|
1659 |
|
|
1660 |
/* store last "cur_view" in window */ |
return dialog; |
1661 |
g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view); |
} |
|
appdata->cur_view = NULL; |
|
1662 |
|
|
1663 |
g_signal_connect(G_OBJECT(view_window), "destroy", |
/* popup the dialog shaped submenu */ |
1664 |
G_CALLBACK(on_tools_destroy), appdata); |
static void submenu_popup(GtkWidget *menu) { |
1665 |
|
gtk_widget_show_all(menu); |
1666 |
|
gtk_dialog_run(GTK_DIALOG(menu)); |
1667 |
|
gtk_widget_hide(menu); |
1668 |
|
} |
1669 |
|
|
1670 |
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
static void submenu_cleanup(GtkWidget *menu) { |
1671 |
|
gtk_widget_destroy(menu); |
1672 |
|
} |
1673 |
|
|
1674 |
but = hildon_button_new_with_text( |
static const menu_entry_t submenu_export_entries[] = { |
1675 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
#ifdef ENABLE_MAEMO_MAPPER |
1676 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1677 |
_("Geomath"), |
G_CALLBACK(cb_menu_export_mmpoi) }, |
1678 |
_("Geocoordinate calculation")); |
#endif |
1679 |
g_signal_connect(but, "clicked", |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1680 |
G_CALLBACK(cb_menu_geomath), appdata); |
G_CALLBACK(cb_menu_export_log) }, |
1681 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1682 |
|
G_CALLBACK(cb_menu_export_garmin) }, |
1683 |
|
{ NULL, NULL, NULL } |
1684 |
|
}; |
1685 |
|
|
1686 |
|
static const submenu_t submenu_export = { |
1687 |
|
"Export", submenu_export_entries, |
1688 |
|
sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1 |
1689 |
|
}; |
1690 |
|
|
1691 |
but = hildon_button_new_with_text( |
/* the export submenu */ |
1692 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
1693 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
if(!appdata->export_menu) |
1694 |
_("Geotext"), |
appdata->export_menu = app_submenu_create(appdata, &submenu_export); |
|
_("Text analysis, letter counting etc")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_geotext), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
|
|
|
1695 |
|
|
1696 |
but = hildon_button_new_with_text( |
submenu_popup(appdata->export_menu); |
1697 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
} |
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
|
_("Precise Position"), |
|
|
_("Calculate a very precise GPS position")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_precpos), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1698 |
|
|
1699 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
static const menu_entry_t submenu_tools_entries[] = { |
1700 |
gtk_widget_show_all (GTK_WIDGET (view_window)); |
{ "Geomath", "Geocoordinate calculation", |
1701 |
|
G_CALLBACK(cb_menu_geomath) }, |
1702 |
|
{ "Geotext", "Text analysis", |
1703 |
|
G_CALLBACK(cb_menu_geotext) }, |
1704 |
|
{ "Precise Position", "Calculate a precise GPS position", |
1705 |
|
G_CALLBACK(cb_menu_precpos) }, |
1706 |
|
{ NULL, NULL, NULL } |
1707 |
|
}; |
1708 |
|
|
1709 |
|
static const submenu_t submenu_tools = { |
1710 |
|
"Tools", submenu_tools_entries, |
1711 |
|
sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1 |
1712 |
|
}; |
1713 |
|
|
1714 |
|
/* the tools submenu */ |
1715 |
|
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
1716 |
|
if(!appdata->tools_menu) |
1717 |
|
appdata->tools_menu = app_submenu_create(appdata, &submenu_tools); |
1718 |
|
|
1719 |
|
submenu_popup(appdata->tools_menu); |
1720 |
} |
} |
1721 |
|
|
1722 |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
1744 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1745 |
G_CALLBACK(cb_menu_adddir), appdata); |
G_CALLBACK(cb_menu_adddir), appdata); |
1746 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1747 |
|
|
|
if(mode == MENU_GPXLIST) { |
|
1748 |
button = gtk_button_new_with_label(_("Export")); |
button = gtk_button_new_with_label(_("Export")); |
1749 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1750 |
G_CALLBACK(on_export_clicked), appdata); |
G_CALLBACK(on_export_clicked), appdata); |
1761 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1762 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1763 |
|
|
1764 |
gtk_widget_show(GTK_WIDGET(menu)); |
#ifdef ENABLE_OSM_GPS_MAP |
1765 |
|
button = gtk_button_new_with_label(_("Map")); |
1766 |
|
g_signal_connect_after(button, "clicked", |
1767 |
|
G_CALLBACK(cb_menu_map), appdata); |
1768 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1769 |
|
#endif |
1770 |
|
|
1771 |
|
#ifdef HILDON_HELP |
1772 |
|
button = gtk_button_new_with_label(_("Help")); |
1773 |
|
g_signal_connect_after(button, "clicked", |
1774 |
|
G_CALLBACK(cb_menu_help), appdata); |
1775 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1776 |
|
#endif |
1777 |
|
|
1778 |
|
gtk_widget_show_all(GTK_WIDGET(menu)); |
1779 |
|
|
1780 |
return menu; |
return menu; |
1781 |
} |
} |
1823 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1824 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1825 |
|
|
1826 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1827 |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
1828 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1829 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1880 |
|
|
1881 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1882 |
|
|
1883 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1884 |
|
item = gtk_menu_item_new_with_label( _("Map") ); |
1885 |
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1886 |
|
g_signal_connect(item, "activate", |
1887 |
|
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
1888 |
|
#endif |
1889 |
|
|
1890 |
item = gtk_menu_item_new_with_label(_("Tools")); |
item = gtk_menu_item_new_with_label(_("Tools")); |
1891 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1892 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1951 |
if(appdata->image_path) free(appdata->image_path); |
if(appdata->image_path) free(appdata->image_path); |
1952 |
if(appdata->search_str) free(appdata->search_str); |
if(appdata->search_str) free(appdata->search_str); |
1953 |
|
|
1954 |
|
#ifdef USE_STACKABLE_WINDOW |
1955 |
|
if(appdata->export_menu) submenu_cleanup(appdata->export_menu); |
1956 |
|
if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu); |
1957 |
|
#endif |
1958 |
|
|
1959 |
gnome_vfs_shutdown(); |
gnome_vfs_shutdown(); |
1960 |
icons_free(); |
icons_free(); |
1961 |
gps_release(appdata); |
gps_release(appdata); |
1984 |
puts("everything is gone"); |
puts("everything is gone"); |
1985 |
} |
} |
1986 |
|
|
1987 |
void on_window_destroy (GtkWidget *widget, gpointer data) { |
static void on_window_destroy (GtkWidget *widget, gpointer data) { |
1988 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1989 |
|
|
1990 |
gconf_save_state(appdata); |
gconf_save_state(appdata); |
2287 |
fprintf(stderr, "error initiating osso context\n"); |
fprintf(stderr, "error initiating osso context\n"); |
2288 |
} |
} |
2289 |
|
|
2290 |
|
#ifdef ENABLE_MAEMO_MAPPER |
2291 |
dbus_register(&appdata); |
dbus_register(&appdata); |
2292 |
#endif |
#endif |
2293 |
|
#endif |
2294 |
|
|
2295 |
icons_init(); |
icons_init(); |
2296 |
|
|
2317 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
2318 |
#endif |
#endif |
2319 |
|
|
2320 |
|
#if MAEMO_VERSION_MAJOR == 5 |
2321 |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
gtk_window_set_title(GTK_WINDOW(appdata.window), "GPXView"); |
2322 |
|
#endif |
2323 |
|
|
2324 |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
g_signal_connect(G_OBJECT(appdata.window), "destroy", |
2325 |
G_CALLBACK(on_window_destroy), &appdata); |
G_CALLBACK(on_window_destroy), &appdata); |
2326 |
|
|
2329 |
|
|
2330 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2331 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
|
|
|
2332 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
2333 |
menu_create(&appdata); |
menu_create(&appdata); |
2334 |
#else |
#else |