19 |
#include <string.h> |
#include <string.h> |
20 |
#include <math.h> |
#include <math.h> |
21 |
|
|
22 |
|
#include <curl/curl.h> |
23 |
|
|
24 |
#include <time.h> |
#include <time.h> |
25 |
#include <sys/time.h> |
#include <sys/time.h> |
26 |
|
|
31 |
|
|
32 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
33 |
#include <hildon/hildon-banner.h> |
#include <hildon/hildon-banner.h> |
34 |
|
#if MAEMO_VERSION_MAJOR >= 5 |
35 |
|
#include <hildon/hildon-note.h> |
36 |
|
#include <hildon/hildon-check-button.h> |
37 |
|
#endif |
38 |
#endif |
#endif |
39 |
|
|
40 |
#include <locale.h> |
#include <locale.h> |
41 |
|
|
42 |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
extern char *strcasestr (__const char *__haystack, __const char *__needle); |
43 |
|
|
44 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
45 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
46 |
gpointer user_data); |
gpointer user_data); |
47 |
|
|
98 |
} |
} |
99 |
} |
} |
100 |
|
|
101 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
102 |
GtkWidget *dialog = gtk_message_dialog_new( |
GtkWidget *dialog = gtk_message_dialog_new( |
103 |
GTK_WINDOW(NULL), |
GTK_WINDOW(NULL), |
104 |
GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_DIALOG_DESTROY_WITH_PARENT, |
105 |
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, |
GTK_MESSAGE_ERROR, |
106 |
buf); |
GTK_BUTTONS_CLOSE, buf); |
107 |
|
|
108 |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
gtk_window_set_title(GTK_WINDOW(dialog), _("ERROR")); |
109 |
|
#else |
110 |
|
GtkWidget *dialog = |
111 |
|
hildon_note_new_information(GTK_WINDOW(NULL), buf); |
112 |
|
#endif |
113 |
|
|
114 |
gtk_dialog_run(GTK_DIALOG(dialog)); |
gtk_dialog_run(GTK_DIALOG(dialog)); |
115 |
gtk_widget_destroy(dialog); |
gtk_widget_destroy(dialog); |
149 |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
gtk_widget_show_all (GTK_WIDGET(dialog)); |
150 |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
if (gtk_dialog_run (GTK_DIALOG(dialog)) == GTK_FM_OK) { |
151 |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
char *filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); |
152 |
|
|
153 |
|
if(filename) { |
154 |
|
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
155 |
|
|
156 |
gpx_dialog_t *dialog = gpx_busy_dialog_new(GTK_WIDGET(appdata->window)); |
if(!whole_dir) |
157 |
|
gpx = gpx_parse(dialog, filename); |
158 |
if(!whole_dir) |
else { |
159 |
gpx = gpx_parse(dialog, filename); |
/* cur trailing '/' if present */ |
160 |
else { |
if(strlastchr(filename) == '/') |
161 |
/* cur trailing '/' if present */ |
filename[strlen(filename)] = 0; |
162 |
if(strlastchr(filename) == '/') |
|
163 |
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 = '/'; |
|
164 |
} |
} |
165 |
|
|
166 |
|
gpx_busy_dialog_destroy(dialog); |
167 |
|
|
168 |
|
/* save path if gpx was successfully loaded */ |
169 |
|
if(gpx) { |
170 |
|
char *r = strrchr(filename, '/'); |
171 |
|
|
172 |
|
/* there is a delimiter, use everything left of it as path */ |
173 |
|
if(r && !whole_dir) { |
174 |
|
*r = 0; |
175 |
|
if(appdata->path) free(appdata->path); |
176 |
|
appdata->path = strdup(filename); |
177 |
|
/* restore path ... just in case ... */ |
178 |
|
*r = '/'; |
179 |
|
} |
180 |
|
|
181 |
|
if(whole_dir) |
182 |
|
appdata->path = strdup(filename); |
183 |
|
} else |
184 |
|
errorf(_("Load error")); |
185 |
|
|
186 |
if(whole_dir) |
g_free (filename); |
187 |
appdata->path = strdup(filename); |
} else { |
188 |
|
#ifndef USE_MAEMO |
189 |
|
errorf(_("Error accessing the file.")); |
190 |
|
#else |
191 |
|
errorf(_("Error accessing the file. This may happen if the file " |
192 |
|
"resides on a remote file system. Please copy the file onto " |
193 |
|
"the device (e.g. onto the memory card) and try again.")); |
194 |
|
#endif |
195 |
} |
} |
|
|
|
|
g_free (filename); |
|
196 |
} |
} |
197 |
|
|
198 |
gtk_widget_destroy (dialog); |
gtk_widget_destroy (dialog); |
216 |
CACHELIST_NUM_COLS |
CACHELIST_NUM_COLS |
217 |
} ; |
} ; |
218 |
|
|
219 |
void cachelist_view_onRowActivated(GtkTreeView *treeview, |
void cachelist_goto_cache(appdata_t *appdata, cache_t *cache) { |
220 |
|
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
221 |
|
cache_dialog(appdata, cache); |
222 |
|
#else |
223 |
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
224 |
|
appdata->cur_view = cache_view(appdata, cache); |
225 |
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
226 |
|
gtk_widget_show_all(appdata->vbox); |
227 |
|
|
228 |
|
crumb_add(appdata, cache->name, CRUMB_CACHE, cache); |
229 |
|
#endif |
230 |
|
} |
231 |
|
|
232 |
|
static void cachelist_view_onRowActivated(GtkTreeView *treeview, |
233 |
GtkTreePath *path, |
GtkTreePath *path, |
234 |
GtkTreeViewColumn *col, |
GtkTreeViewColumn *col, |
235 |
gpointer userdata) { |
gpointer userdata) { |
237 |
GtkTreeIter iter; |
GtkTreeIter iter; |
238 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
239 |
|
|
240 |
|
#ifdef USE_MAEMO |
241 |
|
/* check if a cache is already selected and ignore click if yes */ |
242 |
|
/* (was probably a double click) */ |
243 |
|
if(appdata->cur_cache) return; |
244 |
|
#endif |
245 |
|
|
246 |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
if(gtk_tree_model_get_iter(model, &iter, path)) { |
247 |
cache_t *cache; |
cache_t *cache; |
248 |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
gtk_tree_model_get(model, &iter, CACHELIST_COL_DATA, &cache, -1); |
249 |
#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 |
|
250 |
} |
} |
251 |
} |
} |
252 |
|
|
289 |
cache_t *sel_cache); |
cache_t *sel_cache); |
290 |
|
|
291 |
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 |
|
|
|
|
292 |
if(!appdata->cur_view) { |
if(!appdata->cur_view) { |
293 |
printf("cachelist redraw: no active view\n"); |
printf("cachelist redraw: no active view\n"); |
294 |
return; |
return; |
306 |
if(redraw) { |
if(redraw) { |
307 |
GtkWidget *container = appdata->vbox; |
GtkWidget *container = appdata->vbox; |
308 |
|
|
|
printf("redraw %d\n", redraw); |
|
|
|
|
309 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
310 |
HildonWindowStack *stack = hildon_window_stack_get_default(); |
HildonWindowStack *stack = hildon_window_stack_get_default(); |
311 |
container = hildon_window_stack_peek(stack); |
container = hildon_window_stack_peek(stack); |
332 |
|
|
333 |
gtk_widget_show_all(container); |
gtk_widget_show_all(container); |
334 |
} |
} |
|
#endif |
|
335 |
} |
} |
336 |
|
|
337 |
|
|
339 |
|
|
340 |
printf("cachelist timer fired!\n"); |
printf("cachelist timer fired!\n"); |
341 |
|
|
|
#ifdef USE_MAEMO |
|
342 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
343 |
|
|
344 |
if(appdata->cur_cache) |
if(appdata->cur_cache) |
345 |
return TRUE; |
return TRUE; |
346 |
|
|
347 |
|
#ifdef USE_MAEMO |
348 |
if(appdata->cachelist_disable_screensaver) |
if(appdata->cachelist_disable_screensaver) |
349 |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
if (osso_display_blanking_pause(appdata->osso_context) != OSSO_OK) |
350 |
fprintf(stderr, "error with display blank\n"); |
fprintf(stderr, "error with display blank\n"); |
351 |
|
#endif |
352 |
|
|
353 |
if(appdata->cachelist_update) |
if(appdata->cachelist_update) |
354 |
cachelist_redraw(appdata); |
cachelist_redraw(appdata); |
|
#endif |
|
355 |
|
|
356 |
return TRUE; |
return TRUE; |
357 |
} |
} |
598 |
} |
} |
599 |
appdata->cur_gpx = NULL; |
appdata->cur_gpx = NULL; |
600 |
|
|
601 |
|
#ifdef ENABLE_OSM_GPS_MAP |
602 |
|
map_update(appdata); |
603 |
|
#endif |
604 |
|
|
605 |
/* restore cur_view */ |
/* restore cur_view */ |
606 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
607 |
} |
} |
628 |
G_CALLBACK(on_cachelist_destroy), appdata); |
G_CALLBACK(on_cachelist_destroy), appdata); |
629 |
|
|
630 |
gtk_widget_show_all(window); |
gtk_widget_show_all(window); |
631 |
|
|
632 |
|
#ifdef ENABLE_OSM_GPS_MAP |
633 |
|
map_update(appdata); |
634 |
|
#endif |
635 |
} |
} |
636 |
#endif |
#endif |
637 |
#endif |
#endif |
689 |
GPXLIST_COL_OPEN, !gpx->closed, |
GPXLIST_COL_OPEN, !gpx->closed, |
690 |
GPXLIST_COL_CACHES, gpx->closed?NULL:cnum, |
GPXLIST_COL_CACHES, gpx->closed?NULL:cnum, |
691 |
#ifdef USE_PANNABLE_AREA |
#ifdef USE_PANNABLE_AREA |
692 |
GPXLIST_COL_DELETE, icon_get(ICON_MISC, 7), |
GPXLIST_COL_DELETE, icon_get(ICON_MISC, 4), |
693 |
#endif |
#endif |
694 |
GPXLIST_COL_DATA, gpx, |
GPXLIST_COL_DATA, gpx, |
695 |
-1); |
-1); |
735 |
gconf_save_closed_name(appdata, gpx->filename, gpx->name); |
gconf_save_closed_name(appdata, gpx->filename, gpx->name); |
736 |
} |
} |
737 |
|
|
738 |
|
void gpxlist_goto_cachelist(appdata_t *appdata, gpx_t *gpx) { |
739 |
|
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
740 |
|
#ifdef USE_STACKABLE_WINDOW |
741 |
|
if(!appdata->cur_gpx) |
742 |
|
#endif |
743 |
|
cachelist_dialog(appdata, gpx); |
744 |
|
#ifdef USE_STACKABLE_WINDOW |
745 |
|
else |
746 |
|
printf("selected gpx, but cachelist window already present\n"); |
747 |
|
#endif |
748 |
|
#else |
749 |
|
gtk_container_remove(GTK_CONTAINER(appdata->vbox), appdata->cur_view); |
750 |
|
appdata->cur_view = cachelist_create(appdata, gpx, NULL); |
751 |
|
gtk_box_pack_start_defaults(GTK_BOX(appdata->vbox), appdata->cur_view); |
752 |
|
gtk_widget_show_all(appdata->vbox); |
753 |
|
|
754 |
|
crumb_add(appdata, gpx->name, CRUMB_CACHELIST, gpx); |
755 |
|
#endif |
756 |
|
} |
757 |
|
|
758 |
static void gpxlist_view_onRowActivated(GtkTreeView *treeview, |
static void gpxlist_view_onRowActivated(GtkTreeView *treeview, |
759 |
GtkTreePath *path, |
GtkTreePath *path, |
760 |
GtkTreeViewColumn *col, |
GtkTreeViewColumn *col, |
763 |
GtkTreeIter iter; |
GtkTreeIter iter; |
764 |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
GtkTreeModel *model = gtk_tree_view_get_model(treeview); |
765 |
|
|
766 |
|
#ifdef USE_MAEMO |
767 |
|
/* check if a cache is already selected and ignore click if yes */ |
768 |
|
/* (was probably a double click) */ |
769 |
|
if(appdata->cur_gpx) return; |
770 |
|
#endif |
771 |
|
|
772 |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
if (gtk_tree_model_get_iter(model, &iter, path)) { |
773 |
gpx_t *gpx; |
gpx_t *gpx; |
774 |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
gtk_tree_model_get(model, &iter, GPXLIST_COL_DATA, &gpx, -1); |
781 |
if(col_name && !strcmp(col_name, "Del")) { |
if(col_name && !strcmp(col_name, "Del")) { |
782 |
printf("clicked delete\n"); |
printf("clicked delete\n"); |
783 |
|
|
784 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
785 |
/* ask user what he wants */ |
/* ask user what he wants */ |
786 |
GtkWidget *dialog = gtk_message_dialog_new( |
GtkWidget *dialog = gtk_message_dialog_new( |
787 |
GTK_WINDOW(appdata->window), |
GTK_WINDOW(appdata->window), |
788 |
GTK_DIALOG_DESTROY_WITH_PARENT, |
GTK_DIALOG_DESTROY_WITH_PARENT, |
789 |
GTK_MESSAGE_QUESTION, GTK_BUTTONS_CANCEL, |
GTK_MESSAGE_QUESTION, |
790 |
|
GTK_BUTTONS_CANCEL, |
791 |
_("Do you want to close this entry only or do " |
_("Do you want to close this entry only or do " |
792 |
"you want to remove it completely from the list?")); |
"you want to remove it completely from the list?")); |
793 |
|
|
796 |
_("Close"), 2, |
_("Close"), 2, |
797 |
NULL); |
NULL); |
798 |
|
|
799 |
|
gtk_window_set_title(GTK_WINDOW(dialog), _("Close or remove entry?")); |
800 |
|
#else |
801 |
|
|
802 |
|
GtkWidget *dialog = |
803 |
|
gtk_dialog_new_with_buttons(_("Close or remove entry?"), |
804 |
|
GTK_WINDOW(appdata->window), |
805 |
|
GTK_DIALOG_DESTROY_WITH_PARENT, |
806 |
|
GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, |
807 |
|
_("Remove"), 1, |
808 |
|
_("Close"), 2, |
809 |
|
NULL); |
810 |
|
|
811 |
|
GtkWidget *content_area = |
812 |
|
gtk_dialog_get_content_area (GTK_DIALOG (dialog)); |
813 |
|
|
814 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 0); |
815 |
|
|
816 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
817 |
|
gtk_image_new_from_stock( GTK_STOCK_DIALOG_QUESTION, |
818 |
|
GTK_ICON_SIZE_DIALOG), |
819 |
|
FALSE, FALSE, 0); |
820 |
|
|
821 |
|
GtkWidget *label = gtk_label_new( |
822 |
|
_("Do you want to close this entry only or do " |
823 |
|
"you want to remove it completely from the list?")); |
824 |
|
|
825 |
|
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
826 |
|
gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD); |
827 |
|
|
828 |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), label); |
829 |
|
gtk_container_add (GTK_CONTAINER (content_area), hbox); |
830 |
|
|
831 |
|
gtk_widget_show_all (dialog); |
832 |
|
#endif |
833 |
|
|
834 |
if(gpx->closed) |
if(gpx->closed) |
835 |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE); |
gtk_dialog_set_response_sensitive(GTK_DIALOG(dialog), 2, FALSE); |
836 |
|
|
|
gtk_window_set_title(GTK_WINDOW(dialog), _("Remove entry?")); |
|
|
|
|
837 |
/* set the active flag again if the user answered "no" */ |
/* set the active flag again if the user answered "no" */ |
838 |
switch(gtk_dialog_run(GTK_DIALOG(dialog))) { |
switch(gtk_dialog_run(GTK_DIALOG(dialog))) { |
839 |
|
|
901 |
|
|
902 |
gpx_busy_dialog_destroy(dialog); |
gpx_busy_dialog_destroy(dialog); |
903 |
} |
} |
904 |
#ifndef USE_BREAD_CRUMB_TRAIL |
|
905 |
#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 |
|
906 |
} |
} |
907 |
} |
} |
908 |
} |
} |
957 |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
958 |
-1, "Icon", renderer, |
-1, "Icon", renderer, |
959 |
"pixbuf", GPXLIST_COL_ICON, |
"pixbuf", GPXLIST_COL_ICON, |
960 |
// "sensitive", GPXLIST_COL_OPEN, |
#ifdef USE_PANNABLE_AREA |
961 |
|
/* at least one entry needs to be sensitive. */ |
962 |
|
/* This is the delete icon if the PANNABLE_AREA is used */ |
963 |
|
"sensitive", GPXLIST_COL_OPEN, |
964 |
|
#endif |
965 |
NULL); |
NULL); |
966 |
|
|
967 |
/* --- "FileName" column --- */ |
/* --- "FileName" column --- */ |
1017 |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(appdata->gpxview), |
1018 |
-1, "Del", renderer, |
-1, "Del", renderer, |
1019 |
"pixbuf", GPXLIST_COL_DELETE, |
"pixbuf", GPXLIST_COL_DELETE, |
1020 |
"sensitive", GPXLIST_COL_OPEN, |
// "sensitive", GPXLIST_COL_OPEN, |
1021 |
NULL); |
NULL); |
1022 |
#endif |
#endif |
1023 |
|
|
1037 |
GtkTreeIter iter; |
GtkTreeIter iter; |
1038 |
gtk_list_store_append(appdata->gpxstore, &iter); |
gtk_list_store_append(appdata->gpxstore, &iter); |
1039 |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
gpxlist_set(appdata->gpxstore, &iter, gpx); |
1040 |
|
|
1041 |
if(gpx == sel_gpx) { |
if(gpx == sel_gpx) { |
1042 |
sel_iter = iter; |
sel_iter = iter; |
1043 |
sel_iter_valid = TRUE; |
sel_iter_valid = TRUE; |
1097 |
|
|
1098 |
/******************** begin of menu *********************/ |
/******************** begin of menu *********************/ |
1099 |
|
|
1100 |
|
typedef struct { |
1101 |
|
appdata_t *appdata; |
1102 |
|
GtkWidget *dialog; |
1103 |
|
} about_context_t; |
1104 |
|
|
1105 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1106 |
|
void on_paypal_button_clicked(GtkButton *button, about_context_t *context) { |
1107 |
|
gtk_dialog_response(GTK_DIALOG(context->dialog), GTK_RESPONSE_ACCEPT); |
1108 |
|
browser_url(context->appdata, |
1109 |
|
"https://www.paypal.com/cgi-bin/webscr" |
1110 |
|
"?cmd=_s-xclick&hosted_button_id=7400558"); |
1111 |
|
} |
1112 |
|
#endif |
1113 |
|
|
1114 |
static void |
static void |
1115 |
cb_menu_about(GtkWidget *window, gpointer data) { |
cb_menu_about(GtkWidget *window, gpointer data) { |
1116 |
GtkAboutDialog *about = GTK_ABOUT_DIALOG(gtk_about_dialog_new()); |
about_context_t context; |
1117 |
|
|
1118 |
gtk_about_dialog_set_name(about, "GPXView"); |
context.appdata = (appdata_t *)data; |
|
gtk_about_dialog_set_version(about, VERSION); |
|
1119 |
|
|
1120 |
#ifdef ENABLE_LIBLOCATION |
#ifdef ENABLE_LIBLOCATION |
1121 |
char *uses = "uses liblocation"; |
char *uses = "uses liblocation"; |
1125 |
char *uses = "uses gpsd"; |
char *uses = "uses gpsd"; |
1126 |
#endif |
#endif |
1127 |
|
|
1128 |
char *str = g_strdup_printf("%s\n\n(%s)", |
const gchar *authors[] = { |
1129 |
_("GPXView (c) 2008-2009 by\n" |
"Till Harbaum <till@harbaum.org>", |
1130 |
"Till Harbaum <till@harbaum.org>\n" |
"John Stowers <john.stowers@gmail.com>", |
1131 |
"Mailing list: gpxview-users@garage.maemo.org"), |
"GCVote: Guido Wegener <guido.wegener@gmx.de>", |
1132 |
_(uses) |
NULL }; |
1133 |
); |
|
1134 |
|
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1135 |
gtk_about_dialog_set_copyright(about, str); |
"name", "GPXView", |
1136 |
g_free(str); |
"version", VERSION, |
1137 |
|
"copyright", _("Copyright 2008-2009"), |
1138 |
gtk_about_dialog_set_website(about, |
"authors", authors, |
1139 |
_("http://www.harbaum.org/till/maemo")); |
"website", _("http://www.harbaum.org/till/maemo"), |
1140 |
|
"comments", _(uses), |
1141 |
gtk_about_dialog_set_comments(about, |
NULL); |
1142 |
_("Geocaching.com GPX file viewer")); |
|
1143 |
|
#ifdef ENABLE_BROWSER_INTERFACE |
1144 |
gtk_widget_show_all(GTK_WIDGET(about)); |
/* add a way to donate to the project */ |
1145 |
gtk_dialog_run(GTK_DIALOG(about)); |
GtkWidget *alignment = gtk_alignment_new(0.5, 0, 0, 0); |
1146 |
gtk_widget_destroy(GTK_WIDGET(about)); |
|
1147 |
|
GtkWidget *hbox = gtk_hbox_new(FALSE, 8); |
1148 |
|
gtk_box_pack_start(GTK_BOX(hbox), |
1149 |
|
gtk_label_new(_("Do you like GPXView?")), |
1150 |
|
FALSE, FALSE, 0); |
1151 |
|
|
1152 |
|
GtkWidget *button = gtk_button_new(); |
1153 |
|
gtk_button_set_image(GTK_BUTTON(button), |
1154 |
|
icon_get_widget(ICON_MISC, 5)); |
1155 |
|
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1156 |
|
g_signal_connect(button, "clicked", |
1157 |
|
G_CALLBACK(on_paypal_button_clicked), &context); |
1158 |
|
gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1159 |
|
|
1160 |
|
gtk_container_add(GTK_CONTAINER(alignment), hbox); |
1161 |
|
gtk_box_pack_start_defaults(GTK_BOX((GTK_DIALOG(context.dialog))->vbox), |
1162 |
|
alignment); |
1163 |
|
|
1164 |
|
gtk_widget_show_all(alignment); |
1165 |
|
#endif |
1166 |
|
|
1167 |
|
gtk_dialog_run(GTK_DIALOG(context.dialog)); |
1168 |
|
gtk_widget_destroy(context.dialog); |
1169 |
} |
} |
1170 |
|
|
1171 |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
#if defined(USE_MAEMO) && defined(HILDON_HELP) |
1337 |
else if(cache->long_description && (what & SEARCH_DESC) && |
else if(cache->long_description && (what & SEARCH_DESC) && |
1338 |
strcasestr(cache->long_description, phrase)) |
strcasestr(cache->long_description, phrase)) |
1339 |
hit = 1; |
hit = 1; |
1340 |
else if(cache->owner && (what & SEARCH_OWNER) && |
else if(cache->owner && cache->owner->name && (what & SEARCH_OWNER) && |
1341 |
strcasestr(cache->owner, phrase)) |
strcasestr(cache->owner->name, phrase)) |
1342 |
hit = 1; |
hit = 1; |
1343 |
|
|
1344 |
if(hit) { |
if(hit) { |
1367 |
GtkWidget *in_id, *in_name, *in_desc, *in_owner, *in_finds; |
GtkWidget *in_id, *in_name, *in_desc, *in_owner, *in_finds; |
1368 |
} search_context_t; |
} search_context_t; |
1369 |
|
|
1370 |
|
|
1371 |
|
static GtkWidget *check_button_new_with_label(char *label) { |
1372 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
1373 |
|
return gtk_check_button_new_with_label(label); |
1374 |
|
#else |
1375 |
|
GtkWidget *cbut = |
1376 |
|
hildon_check_button_new(HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH); |
1377 |
|
gtk_button_set_label(GTK_BUTTON(cbut), label); |
1378 |
|
return cbut; |
1379 |
|
#endif |
1380 |
|
} |
1381 |
|
|
1382 |
|
static void check_button_set_active(GtkWidget *button, gboolean active) { |
1383 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
1384 |
|
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), active); |
1385 |
|
#else |
1386 |
|
hildon_check_button_set_active(HILDON_CHECK_BUTTON(button), active); |
1387 |
|
#endif |
1388 |
|
} |
1389 |
|
|
1390 |
|
static gboolean check_button_get_active(GtkWidget *button) { |
1391 |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
1392 |
|
return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); |
1393 |
|
#else |
1394 |
|
return hildon_check_button_get_active(HILDON_CHECK_BUTTON(button)); |
1395 |
|
#endif |
1396 |
|
} |
1397 |
|
|
1398 |
static void callback_finds_toggled(GtkWidget *widget, gpointer data ) { |
static void callback_finds_toggled(GtkWidget *widget, gpointer data ) { |
1399 |
search_context_t *context = (search_context_t*)data; |
search_context_t *context = (search_context_t*)data; |
1400 |
|
|
1401 |
gboolean in_finds = gtk_toggle_button_get_active( |
gboolean in_finds = check_button_get_active(context->in_finds); |
|
GTK_TOGGLE_BUTTON(context->in_finds)); |
|
1402 |
|
|
1403 |
gtk_widget_set_sensitive(context->entry, !in_finds); |
gtk_widget_set_sensitive(context->entry, !in_finds); |
1404 |
gtk_widget_set_sensitive(context->in_id, !in_finds); |
gtk_widget_set_sensitive(context->in_id, !in_finds); |
1428 |
GtkWidget *table = gtk_table_new(2, 2, TRUE); |
GtkWidget *table = gtk_table_new(2, 2, TRUE); |
1429 |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8); |
gtk_table_set_col_spacing(GTK_TABLE(table), 0, 8); |
1430 |
|
|
1431 |
context.in_id = gtk_check_button_new_with_label(_("Waypoint IDs")); |
context.in_id = check_button_new_with_label(_("Waypoint IDs")); |
1432 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_id), |
check_button_set_active(context.in_id, appdata->search & SEARCH_ID); |
|
appdata->search & SEARCH_ID); |
|
1433 |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_id, 0, 1, 0, 1); |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_id, 0, 1, 0, 1); |
1434 |
|
|
1435 |
context.in_name = gtk_check_button_new_with_label(_("Names")); |
context.in_name = check_button_new_with_label(_("Names")); |
1436 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_name), |
check_button_set_active(context.in_name, appdata->search & SEARCH_NAME); |
|
appdata->search & SEARCH_NAME); |
|
1437 |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_name, 1, 2, 0, 1); |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_name, 1, 2, 0, 1); |
1438 |
|
|
1439 |
context.in_desc = gtk_check_button_new_with_label(_("Descriptions")); |
context.in_desc = check_button_new_with_label(_("Descriptions")); |
1440 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_desc), |
check_button_set_active(context.in_desc, appdata->search & SEARCH_DESC); |
|
appdata->search & SEARCH_DESC); |
|
1441 |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_desc, 0, 1, 1, 2); |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_desc, 0, 1, 1, 2); |
1442 |
|
|
1443 |
context.in_owner = gtk_check_button_new_with_label(_("Owner")); |
context.in_owner = check_button_new_with_label(_("Owner")); |
1444 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_owner), |
check_button_set_active(context.in_owner, appdata->search & SEARCH_OWNER); |
|
appdata->search & SEARCH_OWNER); |
|
1445 |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_owner, 1, 2, 1, 2); |
gtk_table_attach_defaults(GTK_TABLE(table), context.in_owner, 1, 2, 1, 2); |
1446 |
|
|
1447 |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table); |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table); |
1462 |
|
|
1463 |
GtkWidget *hbox = gtk_hbox_new(FALSE, 5); |
GtkWidget *hbox = gtk_hbox_new(FALSE, 5); |
1464 |
|
|
1465 |
context.in_finds = gtk_check_button_new_with_label(_("Search finds for")); |
context.in_finds = check_button_new_with_label(_("Search finds for")); |
1466 |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(context.in_finds), |
check_button_set_active(context.in_finds, appdata->search & SEARCH_FINDS); |
|
appdata->search & SEARCH_FINDS); |
|
1467 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context.in_finds); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), context.in_finds); |
1468 |
g_signal_connect(G_OBJECT(context.in_finds), "toggled", |
g_signal_connect(G_OBJECT(context.in_finds), "toggled", |
1469 |
G_CALLBACK(callback_finds_toggled), &context); |
G_CALLBACK(callback_finds_toggled), &context); |
1503 |
HILDON_NUMBER_EDITOR(context.spinner)); |
HILDON_NUMBER_EDITOR(context.spinner)); |
1504 |
#endif |
#endif |
1505 |
|
|
1506 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_finds))) |
if(check_button_get_active(context.in_finds)) |
1507 |
appdata->search |= SEARCH_FINDS; |
appdata->search |= SEARCH_FINDS; |
1508 |
else |
else |
1509 |
appdata->search &= ~SEARCH_FINDS; |
appdata->search &= ~SEARCH_FINDS; |
1510 |
|
|
1511 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_id))) |
if(check_button_get_active(context.in_id)) |
1512 |
appdata->search |= SEARCH_ID; |
appdata->search |= SEARCH_ID; |
1513 |
else |
else |
1514 |
appdata->search &= ~SEARCH_ID; |
appdata->search &= ~SEARCH_ID; |
1515 |
|
|
1516 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_name))) |
if(check_button_get_active(context.in_name)) |
1517 |
appdata->search |= SEARCH_NAME; |
appdata->search |= SEARCH_NAME; |
1518 |
else |
else |
1519 |
appdata->search &= ~SEARCH_NAME; |
appdata->search &= ~SEARCH_NAME; |
1520 |
|
|
1521 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_desc))) |
if(check_button_get_active(context.in_desc)) |
1522 |
appdata->search |= SEARCH_DESC; |
appdata->search |= SEARCH_DESC; |
1523 |
else |
else |
1524 |
appdata->search &= ~SEARCH_DESC; |
appdata->search &= ~SEARCH_DESC; |
1525 |
|
|
1526 |
if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(context.in_owner))) |
if(check_button_get_active(context.in_owner)) |
1527 |
appdata->search |= SEARCH_OWNER; |
appdata->search |= SEARCH_OWNER; |
1528 |
else |
else |
1529 |
appdata->search &= ~SEARCH_OWNER; |
appdata->search &= ~SEARCH_OWNER; |
1536 |
|
|
1537 |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
printf("Search for %s (flags = %x)...\n", p, appdata->search); |
1538 |
|
|
1539 |
#ifndef USE_BREAD_CRUMB_TRAIL |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
1540 |
gpx_t *found = |
gpx_t *found = |
1541 |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
search_do(appdata, appdata->gpx, p, appdata->search, FALSE); |
1542 |
|
|
1632 |
notes_log_export(appdata); |
notes_log_export(appdata); |
1633 |
} |
} |
1634 |
|
|
1635 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1636 |
static void |
static void |
1637 |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
cb_menu_export_mmpoi(GtkWidget *widget, gpointer data) { |
1638 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
1751 |
} |
} |
1752 |
|
|
1753 |
static const menu_entry_t submenu_export_entries[] = { |
static const menu_entry_t submenu_export_entries[] = { |
1754 |
|
#ifdef ENABLE_MAEMO_MAPPER |
1755 |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1756 |
G_CALLBACK(cb_menu_export_mmpoi) }, |
G_CALLBACK(cb_menu_export_mmpoi) }, |
1757 |
|
#endif |
1758 |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1759 |
G_CALLBACK(cb_menu_export_log) }, |
G_CALLBACK(cb_menu_export_log) }, |
1760 |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1776 |
} |
} |
1777 |
|
|
1778 |
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 |
|
1779 |
{ "Geomath", "Geocoordinate calculation", |
{ "Geomath", "Geocoordinate calculation", |
1780 |
G_CALLBACK(cb_menu_geomath) }, |
G_CALLBACK(cb_menu_geomath) }, |
1781 |
{ "Geotext", "Text analysis", |
{ "Geotext", "Text analysis", |
1823 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1824 |
G_CALLBACK(cb_menu_adddir), appdata); |
G_CALLBACK(cb_menu_adddir), appdata); |
1825 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
|
} |
|
1826 |
|
|
|
if(mode == MENU_GPXLIST) { |
|
1827 |
button = gtk_button_new_with_label(_("Export")); |
button = gtk_button_new_with_label(_("Export")); |
1828 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1829 |
G_CALLBACK(on_export_clicked), appdata); |
G_CALLBACK(on_export_clicked), appdata); |
1840 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1841 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1842 |
|
|
1843 |
|
#ifdef ENABLE_OSM_GPS_MAP |
1844 |
|
button = gtk_button_new_with_label(_("Map")); |
1845 |
|
g_signal_connect_after(button, "clicked", |
1846 |
|
G_CALLBACK(cb_menu_map), appdata); |
1847 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1848 |
|
#endif |
1849 |
|
|
1850 |
#ifdef HILDON_HELP |
#ifdef HILDON_HELP |
1851 |
button = gtk_button_new_with_label(_("Help")); |
button = gtk_button_new_with_label(_("Help")); |
1852 |
g_signal_connect_after(button, "clicked", |
g_signal_connect_after(button, "clicked", |
1864 |
GtkWidget *menu, *item; |
GtkWidget *menu, *item; |
1865 |
menu = gtk_menu_new(); |
menu = gtk_menu_new(); |
1866 |
|
|
1867 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1868 |
appdata->menu_import = |
appdata->menu_import = |
1869 |
#endif |
#endif |
1870 |
item = gtk_menu_item_new_with_label(_("Import")); |
item = gtk_menu_item_new_with_label(_("Import")); |
1894 |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
g_signal_connect(item, "activate", GTK_SIGNAL_FUNC(cb_menu_remove), appdata); |
1895 |
#endif |
#endif |
1896 |
|
|
1897 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1898 |
appdata->menu_export = |
appdata->menu_export = |
1899 |
#endif |
#endif |
1900 |
item = gtk_menu_item_new_with_label(_("Export")); |
item = gtk_menu_item_new_with_label(_("Export")); |
1902 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1903 |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1904 |
|
|
1905 |
#ifdef USE_MAEMO |
#ifdef ENABLE_MAEMO_MAPPER |
1906 |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
item = gtk_menu_item_new_with_label( _("Maemo Mapper POI") ); |
1907 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1908 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1919 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1920 |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
GTK_SIGNAL_FUNC(cb_menu_export_garmin), appdata); |
1921 |
|
|
1922 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
1923 |
appdata->menu_search = |
appdata->menu_search = |
1924 |
#endif |
#endif |
1925 |
item = gtk_menu_item_new_with_label( _("Search") ); |
item = gtk_menu_item_new_with_label( _("Search") ); |
1928 |
|
|
1929 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1930 |
|
|
|
#ifndef NO_COPY_N_PASTE |
|
1931 |
/* ----------- copy'n paste submenu ----------------- */ |
/* ----------- copy'n paste submenu ----------------- */ |
1932 |
appdata->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
#ifndef NO_COPY_N_PASTE |
|
gtk_clipboard_set_can_store(appdata->clipboard, NULL, 0); |
|
|
|
|
1933 |
item = gtk_menu_item_new_with_label(_("Edit")); |
item = gtk_menu_item_new_with_label(_("Edit")); |
1934 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1935 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
1956 |
|
|
1957 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1958 |
|
|
|
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); |
|
|
|
|
1959 |
#ifdef ENABLE_OSM_GPS_MAP |
#ifdef ENABLE_OSM_GPS_MAP |
1960 |
item = gtk_menu_item_new_with_label( _("Map") ); |
item = gtk_menu_item_new_with_label( _("Map") ); |
1961 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1962 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
1963 |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
GTK_SIGNAL_FUNC(cb_menu_map), appdata); |
1964 |
#endif |
#endif |
1965 |
|
|
1966 |
|
item = gtk_menu_item_new_with_label(_("Tools")); |
1967 |
|
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1968 |
|
submenu = gtk_menu_new(); |
1969 |
|
gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), submenu); |
1970 |
|
|
1971 |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
item = gtk_menu_item_new_with_label( _("Geomath") ); |
1972 |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
gtk_menu_append(GTK_MENU_SHELL(submenu), item); |
1973 |
g_signal_connect(item, "activate", |
g_signal_connect(item, "activate", |
2123 |
return handled; |
return handled; |
2124 |
} |
} |
2125 |
|
|
2126 |
#ifdef USE_BREAD_CRUMB_TRAIL |
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
2127 |
typedef struct { |
typedef struct { |
2128 |
int level; |
int level; |
2129 |
appdata_t *appdata; |
appdata_t *appdata; |
2215 |
|
|
2216 |
gtk_widget_show_all(crumb->appdata->vbox); |
gtk_widget_show_all(crumb->appdata->vbox); |
2217 |
g_free(data); |
g_free(data); |
2218 |
|
|
2219 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2220 |
|
map_update(crumb->appdata); |
2221 |
|
#endif |
2222 |
} |
} |
2223 |
|
|
2224 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
2259 |
#endif |
#endif |
2260 |
} |
} |
2261 |
|
|
2262 |
|
#ifdef USE_BREAD_CRUMB_TRAIL |
2263 |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
hildon_bread_crumb_trail_push_text(HILDON_BREAD_CRUMB_TRAIL(appdata->bct), |
2264 |
name, crumb, (GDestroyNotify)crumb_back); |
name, crumb, (GDestroyNotify)crumb_back); |
2265 |
|
#else |
2266 |
|
bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back); |
2267 |
|
#endif |
2268 |
|
|
2269 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2270 |
|
map_update(appdata); |
2271 |
|
#endif |
2272 |
} |
} |
2273 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2274 |
|
|
2280 |
return; |
return; |
2281 |
} |
} |
2282 |
|
|
|
#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 |
|
2283 |
/* 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 */ |
2284 |
/* need to be redrawn */ |
/* need to be redrawn */ |
2285 |
if(appdata->cur_cache) { |
if(appdata->cur_cache) { |
2334 |
|
|
2335 |
gtk_widget_show_all(container); |
gtk_widget_show_all(container); |
2336 |
} |
} |
|
#endif // USE_MAEMO |
|
2337 |
} |
} |
2338 |
|
|
2339 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
2354 |
|
|
2355 |
gtk_init (&argc, &argv); |
gtk_init (&argc, &argv); |
2356 |
|
|
2357 |
|
curl_global_init(CURL_GLOBAL_ALL); |
2358 |
|
|
2359 |
#ifdef USE_MAEMO |
#ifdef USE_MAEMO |
2360 |
printf("Installing osso context for \"org.harbaum." APP "\"\n"); |
printf("Installing osso context for \"org.harbaum." APP "\"\n"); |
2361 |
appdata.osso_context = osso_initialize("org.harbaum."APP, |
appdata.osso_context = osso_initialize("org.harbaum."APP, |
2364 |
fprintf(stderr, "error initiating osso context\n"); |
fprintf(stderr, "error initiating osso context\n"); |
2365 |
} |
} |
2366 |
|
|
2367 |
|
#ifdef ENABLE_MAEMO_MAPPER |
2368 |
dbus_register(&appdata); |
dbus_register(&appdata); |
2369 |
#endif |
#endif |
2370 |
|
#endif |
2371 |
|
|
2372 |
icons_init(); |
icons_init(); |
2373 |
|
|
2391 |
/* Create a Window. */ |
/* Create a Window. */ |
2392 |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2393 |
/* Set a decent default size for the window. */ |
/* Set a decent default size for the window. */ |
2394 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 640, 480); |
2395 |
#endif |
#endif |
2396 |
|
|
2397 |
#if MAEMO_VERSION_MAJOR == 5 |
#if MAEMO_VERSION_MAJOR == 5 |
2404 |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
2405 |
G_CALLBACK(on_window_key_press), &appdata); |
G_CALLBACK(on_window_key_press), &appdata); |
2406 |
|
|
2407 |
|
/* prepare clipboard */ |
2408 |
|
appdata.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
2409 |
|
gtk_clipboard_set_can_store(appdata.clipboard, NULL, 0); |
2410 |
|
|
2411 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2412 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
2413 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
2423 |
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); |
2424 |
|
|
2425 |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
hildon_bread_crumb_trail_clear(HILDON_BREAD_CRUMB_TRAIL(appdata.bct)); |
2426 |
|
#else |
2427 |
|
#ifdef BCT |
2428 |
|
/* on non-hildon machines we use some custom made breadcrumbtrail */ |
2429 |
|
/* replacement */ |
2430 |
|
appdata.bct = bct_new(); |
2431 |
|
gtk_box_pack_start(GTK_BOX(appdata.vbox), appdata.bct, FALSE,FALSE,0); |
2432 |
|
#endif |
2433 |
|
#endif |
2434 |
|
|
2435 |
|
#if defined(USE_BREAD_CRUMB_TRAIL) || defined(BCT) |
2436 |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
crumb_add(&appdata, "GPX", CRUMB_GPXLIST, NULL); |
2437 |
#endif |
#endif |
2438 |
|
|