35 |
|
|
36 |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
37 |
|
|
38 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
39 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
40 |
gpointer user_data); |
gpointer user_data); |
41 |
|
|
95 |
GtkWidget *dialog = gtk_message_dialog_new( |
GtkWidget *dialog = gtk_message_dialog_new( |
96 |
GTK_WINDOW(NULL), |
GTK_WINDOW(NULL), |
97 |
GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_DIALOG_DESTROY_WITH_PARENT, |
98 |
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, |
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
99 |
buf); |
GTK_MESSAGE_ERROR, |
100 |
|
#else |
101 |
|
GTK_MESSAGE_OTHER, |
102 |
|
#endif |
103 |
|
GTK_BUTTONS_CLOSE, buf); |
104 |
|
|
105 |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
106 |
|
|
142 |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
143 |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
144 |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
145 |
|
|
146 |
|
if(filename) { |
147 |
|
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
148 |
|
|
149 |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
if(!whole_dir) |
150 |
|
gpx = gpx_parse(dialog, filename); |
151 |
if(!whole_dir) |
else { |
152 |
gpx = gpx_parse(dialog, filename); |
/* cur trailing '/' if present */ |
153 |
else { |
if(strlastchr(filename) == '/') |
154 |
/* cur trailing '/' if present */ |
filename[strlen(filename)] = 0; |
155 |
if(strlastchr(filename) == '/') |
|
156 |
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 = '/'; |
|
157 |
} |
} |
158 |
|
|
159 |
|
gpx_busy_dialog_destroy(dialog); |
160 |
|
|
161 |
|
/* save path if gpx was successfully loaded */ |
162 |
|
if(gpx) { |
163 |
|
char *r = strrchr(filename, '/'); |
164 |
|
|
165 |
|
/* there is a delimiter, use everything left of it as path */ |
166 |
|
if(r && !whole_dir) { |
167 |
|
*r = 0; |
168 |
|
if(appdata->path) free(appdata->path); |
169 |
|
appdata->path = strdup(filename); |
170 |
|
/* restore path ... just in case ... */ |
171 |
|
*r = '/'; |
172 |
|
} |
173 |
|
|
174 |
|
if(whole_dir) |
175 |
|
appdata->path = strdup(filename); |
176 |
|
} else |
177 |
|
errorf(_("Load error")); |
178 |
|
|
179 |
if(whole_dir) |
g_free (filename); |
180 |
appdata->path = strdup(filename); |
} else { |
181 |
|
#ifndef USE_MAEMO |
182 |
|
errorf(_("Error accessing the file.")); |
183 |
|
#else |
184 |
|
errorf(_("Error accessing the file. This may happen if the file " |
185 |
|
"resides on a remote file system. Please copy the file onto " |
186 |
|
"the device (e.g. onto the memory card) and try again.")); |
187 |
|
#endif |
188 |
} |
} |
|
|
|
|
g_free (filename); |
|
189 |
} |
} |
190 |
|
|
191 |
gtk_widget_destroy (dialog); |
gtk_widget_destroy (dialog); |
209 |
CACHELIST_NUM_COLS |
CACHELIST_NUM_COLS |
210 |
} ; |
} ; |
211 |
|
|
212 |
void cachelist_view_onRowActivated(GtkTreeView *treeview, |
void cachelist_goto_cache(appdata_t *appdata, cache_t *cache) { |
213 |
|
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
214 |
|
cache_dialog(appdata, cache); |
215 |
|
#else |
216 |
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
217 |
|
appdata->cur_view = cache_view(appdata, cache); |
218 |
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
219 |
|
gtk_widget_show_all(appdata->vbox); |
220 |
|
|
221 |
|
crumb_add(appdata, cache->name, CRUMB_CACHE, cache); |
222 |
|
#endif |
223 |
|
} |
224 |
|
|
225 |
|
static void cachelist_view_onRowActivated(GtkTreeView *treeview, |
226 |
GtkTreePath *path, |
GtkTreePath *path, |
227 |
GtkTreeViewColumn *col, |
GtkTreeViewColumn *col, |
228 |
gpointer userdata) { |
gpointer userdata) { |
230 |
GtkTreeIter iter; |
GtkTreeIter iter; |
231 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
232 |
|
|
233 |
|
#ifdef USE_MAEMO |
234 |
|
/* check if a cache is already selected and ignore click if yes */ |
235 |
|
/* (was probably a double click) */ |
236 |
|
if(appdata->cur_cache) return; |
237 |
|
#endif |
238 |
|
|
239 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
240 |
cache_t *cache; |
cache_t *cache; |
241 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
242 |
#ifndef USE_BREAD_CRUMB_TRAIL |
cachelist_goto_cache(appdata, cache); |
|
cache_dialog(appdata, cache); |
|
|
#else |
|
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
|
|
appdata->cur_view = cache_view(appdata, cache); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
|
|
gtk_widget_show_all(appdata->vbox); |
|
|
|
|
|
crumb_add(appdata, cache->name, CRUMB_CACHE, cache); |
|
|
#endif |
|
243 |
} |
} |
244 |
} |
} |
245 |
|
|
282 |
cache_t *sel_cache); |
cache_t *sel_cache); |
283 |
|
|
284 |
void cachelist_redraw(appdata_t *appdata) { |
void cachelist_redraw(appdata_t *appdata) { |
|
#ifndef USE_MAEMO |
|
|
// gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
|
|
// appdata->cur_view = gpxlist_create_view_and_model(appdata, NULL); |
|
|
// gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
|
|
// gtk_widget_show_all(appdata->vbox); |
|
|
#else |
|
|
|
|
285 |
if(!appdata->cur_view) { |
if(!appdata->cur_view) { |
286 |
printf("cachelist redraw: no active view\n"); |
printf("cachelist redraw: no active view\n"); |
287 |
return; |
return; |
299 |
if(redraw) { |
if(redraw) { |
300 |
GtkWidget *container = appdata->vbox; |
GtkWidget *container = appdata->vbox; |
301 |
|
|
|
printf("redraw %d\n", redraw); |
|
|
|
|
302 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
303 |
HildonWindowStack *stack = hildon_window_stack_get_default(); |
HildonWindowStack *stack = hildon_window_stack_get_default(); |
304 |
container = hildon_window_stack_peek(stack); |
container = hildon_window_stack_peek(stack); |
325 |
|
|
326 |
gtk_widget_show_all(container); |
gtk_widget_show_all(container); |
327 |
} |
} |
|
#endif |
|
328 |
} |
} |
329 |
|
|
330 |
|
|
332 |
|
|
333 |
printf("cachelist timer fired!\n"); |
printf("cachelist timer fired!\n"); |
334 |
|
|
|
#ifdef USE_MAEMO |
|
335 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
336 |
|
|
337 |
if(appdata->cur_cache) |
if(appdata->cur_cache) |
338 |
return TRUE; |
return TRUE; |
339 |
|
|
340 |
|
#ifdef USE_MAEMO |
341 |
if(appdata->cachelist_disable_screensaver) |
if(appdata->cachelist_disable_screensaver) |
342 |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
343 |
fprintf(stderr, "error with display blank\n"); |
fprintf(stderr, "error with display blank\n"); |
344 |
|
#endif |
345 |
|
|
346 |
if(appdata->cachelist_update) |
if(appdata->cachelist_update) |
347 |
cachelist_redraw(appdata); |
cachelist_redraw(appdata); |
|
#endif |
|
348 |
|
|
349 |
return TRUE; |
return TRUE; |
350 |
} |
} |
591 |
} |
} |
592 |
appdata->cur_gpx = NULL; |
appdata->cur_gpx = NULL; |
593 |
|
|
594 |
|
#ifdef ENABLE_OSM_GPS_MAP |
595 |
|
map_update(appdata); |
596 |
|
#endif |
597 |
|
|
598 |
/* restore cur_view */ |
/* restore cur_view */ |
599 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
600 |
} |
} |
621 |
G_CALLBACK(on_cachelist_destroy), appdata); |
G_CALLBACK(on_cachelist_destroy), appdata); |
622 |
|
|
623 |
gtk_widget_show_all(window); |
gtk_widget_show_all(window); |
624 |
|
|
625 |
|
#ifdef ENABLE_OSM_GPS_MAP |
626 |
|
map_update(appdata); |
627 |
|
#endif |
628 |
} |
} |
629 |
#endif |
#endif |
630 |
#endif |
#endif |
728 |
gconf_save_closed_name(appdata, gpx->filename, gpx->name); |
gconf_save_closed_name(appdata, gpx->filename, gpx->name); |
729 |
} |
} |
730 |
|
|
731 |
|
void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx) { |
732 |
|
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
733 |
|
#ifdef USE_STACKABLE_WINDOW |
734 |
|
if(!appdata->cur_gpx) |
735 |
|
#endif |
736 |
|
cachelist_dialog(appdata, gpx); |
737 |
|
#ifdef USE_STACKABLE_WINDOW |
738 |
|
else |
739 |
|
printf("selected gpx, but cachelist window already present\n"); |
740 |
|
#endif |
741 |
|
#else |
742 |
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
743 |
|
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
744 |
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
745 |
|
gtk_widget_show_all(appdata->vbox); |
746 |
|
|
747 |
|
crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx); |
748 |
|
#endif |
749 |
|
} |
750 |
|
|
751 |
static void gpxlist_view_onRowActivated(GtkTreeView *treeview, |
static void gpxlist_view_onRowActivated(GtkTreeView *treeview, |
752 |
GtkTreePath *path, |
GtkTreePath *path, |
753 |
GtkTreeViewColumn *col, |
GtkTreeViewColumn *col, |
756 |
GtkTreeIter iter; |
GtkTreeIter iter; |
757 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
758 |
|
|
759 |
|
#ifdef USE_MAEMO |
760 |
|
/* check if a cache is already selected and ignore click if yes */ |
761 |
|
/* (was probably a double click) */ |
762 |
|
if(appdata->cur_gpx) return; |
763 |
|
#endif |
764 |
|
|
765 |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
766 |
gpx_t *gpx; |
gpx_t *gpx; |
767 |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
778 |
GtkWidget *dialog = gtk_message_dialog_new( |
GtkWidget *dialog = gtk_message_dialog_new( |
779 |
GTK_WINDOW(appdata->window), |
GTK_WINDOW(appdata->window), |
780 |
GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_DIALOG_DESTROY_WITH_PARENT, |
781 |
GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, |
/* this doesn't fix the text selection issues ... */ |
782 |
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >=5) |
783 |
|
GTK_MESSAGE_OTHER, |
784 |
|
#else |
785 |
|
GTK_MESSAGE_QUESTION, |
786 |
|
#endif |
787 |
|
GTK_BUTTONS_CANCEL, |
788 |
_("Do you want to close this entry only or do " |
_("Do you want to close this entry only or do " |
789 |
"you want to remove it completely from the list?")); |
"you want to remove it completely from the list?")); |
790 |
|
|
796 |
if(gpx->closed) |
if(gpx->closed) |
797 |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE); |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE); |
798 |
|
|
799 |
gtk_window_set_title(GTK_WINDOW(dialog), _("Remove entry?")); |
gtk_window_set_title(GTK_WINDOW(dialog), _("Close or remove entry?")); |
800 |
|
|
801 |
/* set the active flag again if the user answered "no" */ |
/* set the active flag again if the user answered "no" */ |
802 |
switch(gtk_dialog_run(GTK_DIALOG(dialog))) { |
switch(gtk_dialog_run(GTK_DIALOG(dialog))) { |
865 |
|
|
866 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
867 |
} |
} |
868 |
#ifndef USE_BREAD_CRUMB_TRAIL |
|
869 |
#ifdef USE_STACKABLE_WINDOW |
gpxlist_goto_cachelist(appdata, gpx); |
|
if(!appdata->cur_gpx) |
|
|
#endif |
|
|
cachelist_dialog(appdata, gpx); |
|
|
#ifdef USE_STACKABLE_WINDOW |
|
|
else |
|
|
printf("selected gpx, but cachelist window already present\n"); |
|
|
#endif |
|
|
#else |
|
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
|
|
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
|
|
gtk_widget_show_all(appdata->vbox); |
|
|
|
|
|
crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx); |
|
|
#endif |
|
870 |
} |
} |
871 |
} |
} |
872 |
} |
} |
921 |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
922 |
-1, "Icon", renderer, |
-1, "Icon", renderer, |
923 |
"pixbuf", GPXLIST_COL_ICON, |
"pixbuf", GPXLIST_COL_ICON, |
924 |
// "sensitive", GPXLIST_COL_OPEN, |
#ifdef USE_PANNABLE_AREA |
925 |
|
/* at least one entry needs to be sensitive. */ |
926 |
|
/* This is the delete icon if the PANNABLE_AREA is used */ |
927 |
|
"sensitive", GPXLIST_COL_OPEN, |
928 |
|
#endif |
929 |
NULL); |
NULL); |
930 |
|
|
931 |
/* --- "FileName" column --- */ |
/* --- "FileName" column --- */ |
981 |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
982 |
-1, "Del", renderer, |
-1, "Del", renderer, |
983 |
"pixbuf", GPXLIST_COL_DELETE, |
"pixbuf", GPXLIST_COL_DELETE, |
984 |
"sensitive", GPXLIST_COL_OPEN, |
// "sensitive", GPXLIST_COL_OPEN, |
985 |
NULL); |
NULL); |
986 |
#endif |
#endif |
987 |
|
|
1001 |
GtkTreeIter iter; |
GtkTreeIter iter; |
1002 |
gtk_list_store_append(appdata->gpxstore, &iter); |
gtk_list_store_append(appdata->gpxstore, &iter); |
1003 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
1004 |
|
|
1005 |
if(gpx == sel_gpx) { |
if(gpx == sel_gpx) { |
1006 |
sel_iter = iter; |
sel_iter = iter; |
1007 |
sel_iter_valid = TRUE; |
sel_iter_valid = TRUE; |
1061 |
|
|
1062 |
/******************** begin of menu *********************/ |
/******************** begin of menu *********************/ |
1063 |
|
|
1064 |
|
typedef struct { |
1065 |
|
appdata_t *appdata; |
1066 |
|
GtkWidget *dialog; |
1067 |
|
} about_context_t; |
1068 |
|
|
1069 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1070 |
|
void on_paypal_button_clicked(GtkButton *button, about_context_t *context) { |
1071 |
|
gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT); |
1072 |
|
browser_url(context->appdata, |
1073 |
|
"https://www.paypal.com/cgi-bin/webscr" |
1074 |
|
"?cmd=_s-xclick&hosted_button_id=7400558"); |
1075 |
|
} |
1076 |
|
#endif |
1077 |
|
|
1078 |
static void |
static void |
1079 |
cb_menu_about(GtkWidget *window, gpointer data) { |
cb_menu_about(GtkWidget *window, gpointer data) { |
1080 |
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
about_context_t context; |
1081 |
|
|
1082 |
gtk_about_dialog_set_name(about, "GPXView"); |
context.appdata = (appdata_t *)data; |
|
gtk_about_dialog_set_version(about, VERSION); |
|
1083 |
|
|
1084 |
#ifdef ENABLE_LIBLOCATION |
#ifdef ENABLE_LIBLOCATION |
1085 |
char *uses = "uses liblocation"; |
char *uses = "uses liblocation"; |
1089 |
char *uses = "uses gpsd"; |
char *uses = "uses gpsd"; |
1090 |
#endif |
#endif |
1091 |
|
|
1092 |
char *str = g_strdup_printf("%s\n\n(%s)", |
const gchar *authors[] = { |
1093 |
_("GPXView (c) 2008-2009 by\n" |
"Till Harbaum <till@harbaum.org>", |
1094 |
"Till Harbaum <till@harbaum.org>\n" |
"John Stowers <john.stowers@gmail.com>", |
1095 |
"Mailing list: gpxview-users@garage.maemo.org"), |
"GCVote: Guido Wegener <guido.wegener@gmx.de>", |
1096 |
_(uses) |
NULL }; |
1097 |
); |
|
1098 |
|
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1099 |
gtk_about_dialog_set_copyright(about, str); |
"name", "GPXView", |
1100 |
g_free(str); |
"version", VERSION, |
1101 |
|
"copyright", _("Copyright 2008-2009"), |
1102 |
gtk_about_dialog_set_website(about, |
"authors", authors, |
1103 |
_("http://www.harbaum.org/till/maemo")); |
"website", _("http://www.harbaum.org/till/maemo"), |
1104 |
|
"comments", _(uses), |
1105 |
gtk_about_dialog_set_comments(about, |
NULL); |
1106 |
_("Geocaching.com GPX file viewer")); |
|
1107 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1108 |
gtk_widget_show_all(GTK_WIDGET(about)); |
/* add a way to donate to the project */ |
1109 |
gtk_dialog_run(GTK_DIALOG(about)); |
GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0); |
1110 |
gtk_widget_destroy(GTK_WIDGET(about)); |
|
1111 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 8); |
1112 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
1113 |
|
gtk_label_new(_("Do you like GPXView?")), |
1114 |
|
FALSE, FALSE, 0); |
1115 |
|
|
1116 |
|
GtkWidget *button = gtk_button_new(); |
1117 |
|
gtk_button_set_image(GTK_BUTTON(button), |
1118 |
|
icon_get_widget(ICON_MISC, 8)); |
1119 |
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1120 |
|
g_signal_connect(button, "clicked", |
1121 |
|
G_CALLBACK(on_paypal_button_clicked), &context); |
1122 |
|
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1123 |
|
|
1124 |
|
gtk_container_add(GTK_CONTAINER(alignment), hbox); |
1125 |
|
gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox), |
1126 |
|
alignment); |
1127 |
|
|
1128 |
|
gtk_widget_show_all(alignment); |
1129 |
|
#endif |
1130 |
|
|
1131 |
|
gtk_dialog_run(GTK_DIALOG(context.dialog)); |
1132 |
|
gtk_widget_destroy(context.dialog); |
1133 |
} |
} |
1134 |
|
|
1135 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1301 |
else if(cache->long_description && (what & SEARCH_DESC) && |
else if(cache->long_description && (what & SEARCH_DESC) && |
1302 |
strcasestr(cache->long_description, phrase)) |
strcasestr(cache->long_description, phrase)) |
1303 |
hit = 1; |
hit = 1; |
1304 |
else if(cache->owner && (what & SEARCH_OWNER) && |
else if(cache->owner && cache->owner->name && (what & SEARCH_OWNER) && |
1305 |
strcasestr(cache->owner, phrase)) |
strcasestr(cache->owner->name, phrase)) |
1306 |
hit = 1; |
hit = 1; |
1307 |
|
|
1308 |
if(hit) { |
if(hit) { |
1478 |
|
|
1479 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1480 |
|
|
1481 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
1482 |
gpx_t *found = |
gpx_t *found = |
1483 |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1484 |
|
|
1512 |
gtk_widget_destroy(dialog); |
gtk_widget_destroy(dialog); |
1513 |
} |
} |
1514 |
|
|
1515 |
void on_window_destroy (GtkWidget *widget, gpointer data); |
static void on_window_destroy (GtkWidget *widget, gpointer data); |
1516 |
|
|
1517 |
#ifndef USE_MAEMO |
#ifndef USE_MAEMO |
1518 |
static void |
static void |
1574 |
notes_log_export(appdata); |
notes_log_export(appdata); |
1575 |
} |
} |
1576 |
|
|
1577 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1578 |
static void |
static void |
1579 |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1580 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1693 |
} |
} |
1694 |
|
|
1695 |
static const menu_entry_t submenu_export_entries[] = { |
static const menu_entry_t submenu_export_entries[] = { |
1696 |
|
#ifdef ENABLE_MAEMO_MAPPER |
1697 |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1698 |
G_CALLBACK(cb_menu_export_mmpoi) }, |
G_CALLBACK(cb_menu_export_mmpoi) }, |
1699 |
|
#endif |
1700 |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1701 |
G_CALLBACK(cb_menu_export_log) }, |
G_CALLBACK(cb_menu_export_log) }, |
1702 |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1718 |
} |
} |
1719 |
|
|
1720 |
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 |
|
1721 |
{ "Geomath", "Geocoordinate calculation", |
{ "Geomath", "Geocoordinate calculation", |
1722 |
G_CALLBACK(cb_menu_geomath) }, |
G_CALLBACK(cb_menu_geomath) }, |
1723 |
{ "Geotext", "Text analysis", |
{ "Geotext", "Text analysis", |
1765 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1766 |
G_CALLBACK(cb_menu_adddir), appdata); |
G_CALLBACK(cb_menu_adddir), appdata); |
1767 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1768 |
|
|
|
if(mode == MENU_GPXLIST) { |
|
1769 |
button = gtk_button_new_with_label(_("Export")); |
button = gtk_button_new_with_label(_("Export")); |
1770 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1771 |
G_CALLBACK(on_export_clicked), appdata); |
G_CALLBACK(on_export_clicked), appdata); |
1782 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1783 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1784 |
|
|
1785 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1786 |
|
button = gtk_button_new_with_label(_("Map")); |
1787 |
|
g_signal_connect_after(button, "clicked", |
1788 |
|
G_CALLBACK(cb_menu_map), appdata); |
1789 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1790 |
|
#endif |
1791 |
|
|
1792 |
#ifdef HILDON_HELP |
#ifdef HILDON_HELP |
1793 |
button = gtk_button_new_with_label(_("Help")); |
button = gtk_button_new_with_label(_("Help")); |
1794 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1806 |
GtkWidget *menu, *item; |
GtkWidget *menu, *item; |
1807 |
menu = gtk_menu_new(); |
menu = gtk_menu_new(); |
1808 |
|
|
1809 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1810 |
appdata->menu_import = |
appdata->menu_import = |
1811 |
#endif |
#endif |
1812 |
item = gtk_menu_item_new_with_label(_("Import")); |
item = gtk_menu_item_new_with_label(_("Import")); |
1836 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
1837 |
#endif |
#endif |
1838 |
|
|
1839 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1840 |
appdata->menu_export = |
appdata->menu_export = |
1841 |
#endif |
#endif |
1842 |
item = gtk_menu_item_new_with_label(_("Export")); |
item = gtk_menu_item_new_with_label(_("Export")); |
1844 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1845 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1846 |
|
|
1847 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1848 |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
1849 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1850 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1861 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1862 |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
1863 |
|
|
1864 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1865 |
appdata->menu_search = |
appdata->menu_search = |
1866 |
#endif |
#endif |
1867 |
item = gtk_menu_item_new_with_label( _("Search") ); |
item = gtk_menu_item_new_with_label( _("Search") ); |
1870 |
|
|
1871 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1872 |
|
|
|
#ifndef NO_COPY_N_PASTE |
|
1873 |
/* ----------- copy'n paste submenu ----------------- */ |
/* ----------- copy'n paste submenu ----------------- */ |
1874 |
appdata->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
#ifndef NO_COPY_N_PASTE |
|
gtk_clipboard_set_can_store(appdata->clipboard, NULL, 0); |
|
|
|
|
1875 |
item = gtk_menu_item_new_with_label(_("Edit")); |
item = gtk_menu_item_new_with_label(_("Edit")); |
1876 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1877 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1898 |
|
|
1899 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1900 |
|
|
|
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); |
|
|
|
|
1901 |
#ifdef ENABLE_OSM_GPS_MAP |
#ifdef ENABLE_OSM_GPS_MAP |
1902 |
item = gtk_menu_item_new_with_label( _("Map") ); |
item = gtk_menu_item_new_with_label( _("Map") ); |
1903 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1904 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1905 |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
1906 |
#endif |
#endif |
1907 |
|
|
1908 |
|
item = gtk_menu_item_new_with_label(_("Tools")); |
1909 |
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1910 |
|
submenu = gtk_menu_new(); |
1911 |
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1912 |
|
|
1913 |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
1914 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1915 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
2002 |
puts("everything is gone"); |
puts("everything is gone"); |
2003 |
} |
} |
2004 |
|
|
2005 |
void on_window_destroy (GtkWidget *widget, gpointer data) { |
static void on_window_destroy (GtkWidget *widget, gpointer data) { |
2006 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
2007 |
|
|
2008 |
gconf_save_state(appdata); |
gconf_save_state(appdata); |
2065 |
return handled; |
return handled; |
2066 |
} |
} |
2067 |
|
|
2068 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
2069 |
typedef struct { |
typedef struct { |
2070 |
int level; |
int level; |
2071 |
appdata_t *appdata; |
appdata_t *appdata; |
2157 |
|
|
2158 |
gtk_widget_show_all(crumb->appdata->vbox); |
gtk_widget_show_all(crumb->appdata->vbox); |
2159 |
g_free(data); |
g_free(data); |
2160 |
|
|
2161 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2162 |
|
map_update(crumb->appdata); |
2163 |
|
#endif |
2164 |
} |
} |
2165 |
|
|
2166 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
2201 |
#endif |
#endif |
2202 |
} |
} |
2203 |
|
|
2204 |
|
#ifdef USE_BREAD_CRUMB_TRAIL |
2205 |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
2206 |
name, crumb, (GDestroyNotify)crumb_back); |
name, crumb, (GDestroyNotify)crumb_back); |
2207 |
|
#else |
2208 |
|
bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back); |
2209 |
|
#endif |
2210 |
|
|
2211 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2212 |
|
map_update(appdata); |
2213 |
|
#endif |
2214 |
} |
} |
2215 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2216 |
|
|
2222 |
return; |
return; |
2223 |
} |
} |
2224 |
|
|
|
#ifndef USE_MAEMO |
|
|
// in non-maemo setup this can only affect the main screen as |
|
|
// the menu is blocked while a dialog is open. also the main |
|
|
// screen is always present |
|
|
if(appdata->gpxlist_items != appdata->cur_items) { |
|
|
/* re-do the main screen */ |
|
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
|
|
appdata->cur_view = gpxlist_create_view_and_model(appdata, NULL); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
|
|
gtk_widget_show_all(appdata->vbox); |
|
|
} |
|
|
#else |
|
2225 |
/* a cache screen cannot be changed from the settings and thus doesn't */ |
/* a cache screen cannot be changed from the settings and thus doesn't */ |
2226 |
/* need to be redrawn */ |
/* need to be redrawn */ |
2227 |
if(appdata->cur_cache) { |
if(appdata->cur_cache) { |
2276 |
|
|
2277 |
gtk_widget_show_all(container); |
gtk_widget_show_all(container); |
2278 |
} |
} |
|
#endif // USE_MAEMO |
|
2279 |
} |
} |
2280 |
|
|
2281 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
2304 |
fprintf(stderr, "error initiating osso context\n"); |
fprintf(stderr, "error initiating osso context\n"); |
2305 |
} |
} |
2306 |
|
|
2307 |
|
#ifdef ENABLE_MAEMO_MAPPER |
2308 |
dbus_register(&appdata); |
dbus_register(&appdata); |
2309 |
#endif |
#endif |
2310 |
|
#endif |
2311 |
|
|
2312 |
icons_init(); |
icons_init(); |
2313 |
|
|
2331 |
/* Create a Window. */ |
/* Create a Window. */ |
2332 |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2333 |
/* Set a decent default size for the window. */ |
/* Set a decent default size for the window. */ |
2334 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 640, 480); |
2335 |
#endif |
#endif |
2336 |
|
|
2337 |
#if MAEMO_VERSION_MAJOR == 5 |
#if MAEMO_VERSION_MAJOR == 5 |
2344 |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
2345 |
G_CALLBACK(on_window_key_press), &appdata); |
G_CALLBACK(on_window_key_press), &appdata); |
2346 |
|
|
2347 |
|
/* prepare clipboard */ |
2348 |
|
appdata.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
2349 |
|
gtk_clipboard_set_can_store(appdata.clipboard, NULL, 0); |
2350 |
|
|
2351 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2352 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
2353 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
2363 |
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0); |
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0); |
2364 |
|
|
2365 |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
2366 |
|
#else |
2367 |
|
#ifdef BCT |
2368 |
|
/* on non-hildon machines we use some custom made breadcrumbtrail */ |
2369 |
|
/* replacement */ |
2370 |
|
appdata.bct = bct_new(); |
2371 |
|
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0); |
2372 |
|
#endif |
2373 |
|
#endif |
2374 |
|
|
2375 |
|
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
2376 |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
2377 |
#endif |
#endif |
2378 |
|
|