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> |
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, |
|
#if !defined(USE_MAEMO) || (MAEMO_VERSION_MAJOR < 5) |
|
105 |
GTK_MESSAGE_ERROR, |
GTK_MESSAGE_ERROR, |
|
#else |
|
|
GTK_MESSAGE_OTHER, |
|
|
#endif |
|
106 |
GTK_BUTTONS_CLOSE, 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); |
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); |
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, |
|
/* this doesn't fix the text selection issues ... */ |
|
|
#if defined(USE_MAEMO) && (MAEMO_VERSION_MAJOR >=5) |
|
|
GTK_MESSAGE_OTHER, |
|
|
#else |
|
789 |
GTK_MESSAGE_QUESTION, |
GTK_MESSAGE_QUESTION, |
|
#endif |
|
790 |
GTK_BUTTONS_CANCEL, |
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?")); |
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), _("Close or 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 |
|
|
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 |
|
|
1128 |
const gchar *authors[] = { |
const gchar *authors[] = { |
1129 |
"Till Harbaum <till@harbaum.org>", |
"Till Harbaum <till@harbaum.org>", |
1130 |
"John Stowers <john.stowers@gmail.com>", |
"John Stowers <john.stowers@gmail.com>", |
1131 |
|
"GCVote: Guido Wegener <guido.wegener@gmx.de>", |
1132 |
NULL }; |
NULL }; |
1133 |
|
|
1134 |
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
context.dialog = g_object_new(GTK_TYPE_ABOUT_DIALOG, |
1151 |
|
|
1152 |
GtkWidget *button = gtk_button_new(); |
GtkWidget *button = gtk_button_new(); |
1153 |
gtk_button_set_image(GTK_BUTTON(button), |
gtk_button_set_image(GTK_BUTTON(button), |
1154 |
icon_get_widget(ICON_MISC, 8)); |
icon_get_widget(ICON_MISC, 5)); |
1155 |
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); |
1156 |
g_signal_connect(button, "clicked", |
g_signal_connect(button, "clicked", |
1157 |
G_CALLBACK(on_paypal_button_clicked), &context); |
G_CALLBACK(on_paypal_button_clicked), &context); |
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; |
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, |