51 |
|
|
52 |
if(!isnan(pos.lat) && !isnan(pos.lon)) { |
if(!isnan(pos.lat) && !isnan(pos.lon)) { |
53 |
gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf( |
gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_pixbuf( |
54 |
icon_bearing(refpos, pos)),TRUE,FALSE,0); |
icon_bearing(refpos, pos)),TRUE,FALSE,0); |
55 |
|
|
56 |
if(!isnan(refpos.lat) && !isnan(refpos.lon)) { |
if(!isnan(refpos.lat) && !isnan(refpos.lon)) { |
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), |
|
|
GTK_LABEL_SMALL((char*)pos_get_bearing_str(refpos, pos))); |
|
|
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(" ")); |
|
57 |
snprintf(str, sizeof(str), _("%.1f°"), |
snprintf(str, sizeof(str), _("%.1f°"), |
58 |
gpx_pos_get_bearing(refpos, pos)); |
gpx_pos_get_bearing(refpos, pos)); |
59 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str)); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(str)); |
61 |
refpos, pos, appdata->imperial); |
refpos, pos, appdata->imperial); |
62 |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(" ")); |
gtk_box_pack_start_defaults(GTK_BOX(hbox), GTK_LABEL_SMALL(" ")); |
63 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
64 |
gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
gtk_label_attrib(str, SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
65 |
} else |
} else |
66 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
67 |
gtk_label_attrib(_("(no position)"), |
gtk_label_attrib(_("(no position)"), |
68 |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
69 |
} else |
} else |
70 |
gtk_box_pack_start(GTK_BOX(hbox), |
gtk_box_pack_start(GTK_BOX(hbox), |
71 |
gtk_label_attrib(_("(invalid position in notes)"), |
gtk_label_attrib(_("(invalid position in notes)"), |
72 |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
SIZE_SMALL, STRIKETHROUGH_NONE),TRUE,FALSE,0); |
73 |
} |
} |
74 |
|
|
75 |
/* this function sets everything related to the coordinate. used to */ |
/* this function sets everything related to the coordinate. used to */ |
742 |
/* striked out coordinate may need update */ |
/* striked out coordinate may need update */ |
743 |
overview_coordinate_update(context); |
overview_coordinate_update(context); |
744 |
} |
} |
|
|
|
|
if(strcasecmp(name, _("Goto")) == 0) { |
|
|
/* redo coo_button since state of overwritten coordinate may have changed */ |
|
|
preset_coordinate_picker_update(context->appdata, context->gotoc.coo_popup); |
|
|
} |
|
745 |
} |
} |
746 |
|
|
747 |
static void on_notebook_destroy(GtkWidget *widget, gpointer user_data ) { |
static void on_notebook_destroy(GtkWidget *widget, gpointer user_data ) { |
763 |
gtk_timeout_remove(context->handler_id); |
gtk_timeout_remove(context->handler_id); |
764 |
#endif |
#endif |
765 |
|
|
766 |
|
#ifdef USE_STACKABLE_WINDOW |
767 |
|
if(context->notes_have_been_changed) { |
768 |
|
printf("notes changed -> cachelist redraw\n"); |
769 |
|
|
770 |
|
/* now the cachelist is visible again. so redraw it since it may */ |
771 |
|
/* have changed */ |
772 |
|
cachelist_redraw(context->appdata); |
773 |
|
} |
774 |
|
#endif |
775 |
|
|
776 |
printf("freeing cache context\n"); |
printf("freeing cache context\n"); |
777 |
|
context->appdata->cache_context = NULL; |
778 |
g_free(context); |
g_free(context); |
779 |
} |
} |
780 |
|
|
876 |
GtkWidget *notebook; |
GtkWidget *notebook; |
877 |
|
|
878 |
cache_context_t *cache_context = g_new0(cache_context_t, 1); |
cache_context_t *cache_context = g_new0(cache_context_t, 1); |
879 |
|
appdata->cache_context = cache_context; |
880 |
cache_context->appdata = appdata; |
cache_context->appdata = appdata; |
881 |
cache_context->cache = cache; |
cache_context->cache = cache; |
882 |
|
|
954 |
static void on_cache_destroy (GtkWidget *widget, appdata_t *appdata) { |
static void on_cache_destroy (GtkWidget *widget, appdata_t *appdata) { |
955 |
appdata->cur_cache = NULL; |
appdata->cur_cache = NULL; |
956 |
|
|
957 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
958 |
|
appdata->window = HILDON_WINDOW(hildon_window_stack_peek(stack)); |
959 |
|
|
960 |
/* restore cur_view */ |
/* restore cur_view */ |
961 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
962 |
} |
} |
963 |
|
|
964 |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
void cache_dialog(appdata_t *appdata, cache_t *cache) { |
965 |
GtkWidget *window = hildon_stackable_window_new(); |
GtkWidget *window = hildon_stackable_window_new(); |
966 |
|
appdata->window = HILDON_WINDOW(window); |
967 |
|
|
968 |
/* store last "cur_view" in window */ |
/* store last "cur_view" in window */ |
969 |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
g_object_set_data(G_OBJECT(window), "cur_view", appdata->cur_view); |
970 |
|
|
971 |
appdata->cur_cache = cache; |
appdata->cur_cache = cache; |
972 |
char *title = g_strdup_printf("%s - GPXView", cache->name); |
gtk_window_set_title(GTK_WINDOW(window), cache->name); |
|
gtk_window_set_title(GTK_WINDOW(window), title); |
|
|
g_free(title); |
|
973 |
|
|
974 |
/* create cache visualization widget */ |
/* create cache visualization widget */ |
975 |
appdata->cur_view = cache_view(appdata, cache); |
appdata->cur_view = cache_view(appdata, cache); |