168 |
|
|
169 |
if(whole_dir) |
if(whole_dir) |
170 |
appdata->path = strdup(filename); |
appdata->path = strdup(filename); |
171 |
} |
} else |
172 |
|
errorf(_("Load error")); |
173 |
|
|
174 |
g_free (filename); |
g_free (filename); |
175 |
} |
} |
203 |
GtkTreeIter iter; |
GtkTreeIter iter; |
204 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
205 |
|
|
206 |
|
#ifdef USE_MAEMO |
207 |
|
/* check if a cache is already selected and ignore click if yes */ |
208 |
|
/* (was probably a double click) */ |
209 |
|
if(appdata->cur_cache) return; |
210 |
|
#endif |
211 |
|
|
212 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
213 |
cache_t *cache; |
cache_t *cache; |
214 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
720 |
GtkTreeIter iter; |
GtkTreeIter iter; |
721 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
722 |
|
|
723 |
|
#ifdef USE_MAEMO |
724 |
|
/* check if a cache is already selected and ignore click if yes */ |
725 |
|
/* (was probably a double click) */ |
726 |
|
if(appdata->cur_gpx) return; |
727 |
|
#endif |
728 |
|
|
729 |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
730 |
gpx_t *gpx; |
gpx_t *gpx; |
731 |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
967 |
GtkTreeIter sel_iter; |
GtkTreeIter sel_iter; |
968 |
gboolean sel_iter_valid = FALSE; |
gboolean sel_iter_valid = FALSE; |
969 |
while(gpx) { |
while(gpx) { |
970 |
GtkTreeIter iter; |
/* don't display entries that failed at load */ |
971 |
gtk_list_store_append(appdata->gpxstore, &iter); |
if(!gpx->failed) { |
972 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
GtkTreeIter iter; |
973 |
|
gtk_list_store_append(appdata->gpxstore, &iter); |
974 |
if(gpx == sel_gpx) { |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
975 |
sel_iter = iter; |
|
976 |
sel_iter_valid = TRUE; |
if(gpx == sel_gpx) { |
977 |
|
sel_iter = iter; |
978 |
|
sel_iter_valid = TRUE; |
979 |
|
} |
980 |
} |
} |
981 |
|
|
982 |
gpx = gpx->next; |
gpx = gpx->next; |
1033 |
|
|
1034 |
/******************** begin of menu *********************/ |
/******************** begin of menu *********************/ |
1035 |
|
|
1036 |
|
typedef struct { |
1037 |
|
appdata_t *appdata; |
1038 |
|
GtkWidget *dialog; |
1039 |
|
} about_context_t; |
1040 |
|
|
1041 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1042 |
|
void on_paypal_button_clicked(GtkButton *button, about_context_t *context) { |
1043 |
|
gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT); |
1044 |
|
browser_url(context->appdata, |
1045 |
|
"https://www.paypal.com/cgi-bin/webscr" |
1046 |
|
"?cmd=_s-xclick&hosted_button_id=7400558"); |
1047 |
|
} |
1048 |
|
#endif |
1049 |
|
|
1050 |
static void |
static void |
1051 |
cb_menu_about(GtkWidget *window, gpointer data) { |
cb_menu_about(GtkWidget *window, gpointer data) { |
1052 |
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
about_context_t context; |
1053 |
|
|
1054 |
gtk_about_dialog_set_name(about, "GPXView"); |
context.appdata = (appdata_t *)data; |
|
gtk_about_dialog_set_version(about, VERSION); |
|
1055 |
|
|
1056 |
#ifdef ENABLE_LIBLOCATION |
#ifdef ENABLE_LIBLOCATION |
1057 |
char *uses = "uses liblocation"; |
char *uses = "uses liblocation"; |
1061 |
char *uses = "uses gpsd"; |
char *uses = "uses gpsd"; |
1062 |
#endif |
#endif |
1063 |
|
|
1064 |
char *str = g_strdup_printf("%s\n\n(%s)", |
const gchar *authors[] = { |
1065 |
_("GPXView (c) 2008-2009 by\n" |
"Till Harbaum <till@harbaum.org>", |
1066 |
"Till Harbaum <till@harbaum.org>\n" |
"John Stowers <john.stowers@gmail.com>", |
1067 |
"Mailing list: gpxview-users@garage.maemo.org"), |
NULL }; |
1068 |
_(uses) |
|
1069 |
); |
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1070 |
|
"name", "GPXView", |
1071 |
gtk_about_dialog_set_copyright(about, str); |
"version", VERSION, |
1072 |
g_free(str); |
"copyright", _("Copyright 2008-2009"), |
1073 |
|
"authors", authors, |
1074 |
gtk_about_dialog_set_website(about, |
"website", _("http://www.harbaum.org/till/maemo"), |
1075 |
_("http://www.harbaum.org/till/maemo")); |
"comments", _(uses), |
1076 |
|
NULL); |
1077 |
gtk_about_dialog_set_comments(about, |
|
1078 |
_("Geocaching.com GPX file viewer")); |
#ifdef ENABLE_BROWSER_INTERFACE |
1079 |
|
/* add a way to donate to the project */ |
1080 |
gtk_widget_show_all(GTK_WIDGET(about)); |
GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0); |
1081 |
gtk_dialog_run(GTK_DIALOG(about)); |
|
1082 |
gtk_widget_destroy(GTK_WIDGET(about)); |
GtkWidget *hbox = gtk_hbox_new(FALSE, 8); |
1083 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
1084 |
|
gtk_label_new(_("Do you like GPXView?")), |
1085 |
|
FALSE, FALSE, 0); |
1086 |
|
|
1087 |
|
GtkWidget *button = gtk_button_new(); |
1088 |
|
gtk_button_set_image(GTK_BUTTON(button), |
1089 |
|
icon_get_widget(ICON_MISC, 8)); |
1090 |
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1091 |
|
g_signal_connect(button, "clicked", |
1092 |
|
G_CALLBACK(on_paypal_button_clicked), &context); |
1093 |
|
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1094 |
|
|
1095 |
|
gtk_container_add(GTK_CONTAINER(alignment), hbox); |
1096 |
|
gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox), |
1097 |
|
alignment); |
1098 |
|
|
1099 |
|
gtk_widget_show_all(alignment); |
1100 |
|
#endif |
1101 |
|
|
1102 |
|
gtk_dialog_run(GTK_DIALOG(context.dialog)); |
1103 |
|
gtk_widget_destroy(context.dialog); |
1104 |
} |
} |
1105 |
|
|
1106 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1687 |
} |
} |
1688 |
|
|
1689 |
static const menu_entry_t submenu_tools_entries[] = { |
static const menu_entry_t submenu_tools_entries[] = { |
|
#ifdef ENABLE_OSM_GPS_MAP |
|
|
{ "Map", "Display an interactive world map", |
|
|
G_CALLBACK(cb_menu_map) }, |
|
|
#endif |
|
1690 |
{ "Geomath", "Geocoordinate calculation", |
{ "Geomath", "Geocoordinate calculation", |
1691 |
G_CALLBACK(cb_menu_geomath) }, |
G_CALLBACK(cb_menu_geomath) }, |
1692 |
{ "Geotext", "Text analysis", |
{ "Geotext", "Text analysis", |
1734 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1735 |
G_CALLBACK(cb_menu_adddir), appdata); |
G_CALLBACK(cb_menu_adddir), appdata); |
1736 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1737 |
|
|
|
if(mode == MENU_GPXLIST) { |
|
1738 |
button = gtk_button_new_with_label(_("Export")); |
button = gtk_button_new_with_label(_("Export")); |
1739 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1740 |
G_CALLBACK(on_export_clicked), appdata); |
G_CALLBACK(on_export_clicked), appdata); |
1751 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1752 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1753 |
|
|
1754 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1755 |
|
if((mode == MENU_GPXLIST) || (mode == MENU_CACHELIST)) { |
1756 |
|
button = gtk_button_new_with_label(_("Map")); |
1757 |
|
g_signal_connect_after(button, "clicked", |
1758 |
|
G_CALLBACK(cb_menu_map), appdata); |
1759 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1760 |
|
} |
1761 |
|
#endif |
1762 |
|
|
1763 |
#ifdef HILDON_HELP |
#ifdef HILDON_HELP |
1764 |
button = gtk_button_new_with_label(_("Help")); |
button = gtk_button_new_with_label(_("Help")); |
1765 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1872 |
|
|
1873 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1874 |
|
|
|
item = gtk_menu_item_new_with_label(_("Tools")); |
|
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
|
|
submenu = gtk_menu_new(); |
|
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
|
|
|
|
1875 |
#ifdef ENABLE_OSM_GPS_MAP |
#ifdef ENABLE_OSM_GPS_MAP |
1876 |
item = gtk_menu_item_new_with_label( _("Map") ); |
item = gtk_menu_item_new_with_label( _("Map") ); |
1877 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1878 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1879 |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
1880 |
#endif |
#endif |
1881 |
|
|
1882 |
|
item = gtk_menu_item_new_with_label(_("Tools")); |
1883 |
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1884 |
|
submenu = gtk_menu_new(); |
1885 |
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1886 |
|
|
1887 |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
1888 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1889 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |