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) { |
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 |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
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); |
348 |
|
|
|
#endif |
|
|
|
|
349 |
return TRUE; |
return TRUE; |
350 |
} |
} |
351 |
|
|
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, |
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 |
#if !defined(USE_BREAD_CRUMB_TRAIL) && !defined(BCT) |
|
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 |
} |
} |
1865 |
|
|
1866 |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
gtk_menu_append(GTK_MENU_SHELL(menu), gtk_separator_menu_item_new()); |
1867 |
|
|
|
#ifndef NO_COPY_N_PASTE |
|
1868 |
/* ----------- copy'n paste submenu ----------------- */ |
/* ----------- copy'n paste submenu ----------------- */ |
1869 |
appdata->clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
#ifndef NO_COPY_N_PASTE |
|
gtk_clipboard_set_can_store(appdata->clipboard, NULL, 0); |
|
|
|
|
1870 |
item = gtk_menu_item_new_with_label(_("Edit")); |
item = gtk_menu_item_new_with_label(_("Edit")); |
1871 |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
gtk_menu_append(GTK_MENU_SHELL(menu), item); |
1872 |
submenu = gtk_menu_new(); |
submenu = gtk_menu_new(); |
2152 |
|
|
2153 |
gtk_widget_show_all(crumb->appdata->vbox); |
gtk_widget_show_all(crumb->appdata->vbox); |
2154 |
g_free(data); |
g_free(data); |
2155 |
|
|
2156 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2157 |
|
map_update(crumb->appdata); |
2158 |
|
#endif |
2159 |
} |
} |
2160 |
|
|
2161 |
static void crumb_add(appdata_t *appdata, char *name, int level, |
static void crumb_add(appdata_t *appdata, char *name, int level, |
2202 |
#else |
#else |
2203 |
bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back); |
bct_push_text(appdata->bct, name, crumb, (GDestroyNotify)crumb_back); |
2204 |
#endif |
#endif |
2205 |
|
|
2206 |
|
#ifdef ENABLE_OSM_GPS_MAP |
2207 |
|
map_update(appdata); |
2208 |
|
#endif |
2209 |
} |
} |
2210 |
#endif // USE_BREAD_CRUMB_TRAIL |
#endif // USE_BREAD_CRUMB_TRAIL |
2211 |
|
|
2217 |
return; |
return; |
2218 |
} |
} |
2219 |
|
|
|
#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 |
|
2220 |
/* 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 */ |
2221 |
/* need to be redrawn */ |
/* need to be redrawn */ |
2222 |
if(appdata->cur_cache) { |
if(appdata->cur_cache) { |
2271 |
|
|
2272 |
gtk_widget_show_all(container); |
gtk_widget_show_all(container); |
2273 |
} |
} |
|
#endif // USE_MAEMO |
|
2274 |
} |
} |
2275 |
|
|
2276 |
int main(int argc, char *argv[]) { |
int main(int argc, char *argv[]) { |
2326 |
/* Create a Window. */ |
/* Create a Window. */ |
2327 |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
appdata.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
2328 |
/* Set a decent default size for the window. */ |
/* Set a decent default size for the window. */ |
2329 |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 500, 300); |
gtk_window_set_default_size(GTK_WINDOW(appdata.window), 640, 480); |
2330 |
#endif |
#endif |
2331 |
|
|
2332 |
#if MAEMO_VERSION_MAJOR == 5 |
#if MAEMO_VERSION_MAJOR == 5 |
2339 |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
g_signal_connect(G_OBJECT(appdata.window), "key_press_event", |
2340 |
G_CALLBACK(on_window_key_press), &appdata); |
G_CALLBACK(on_window_key_press), &appdata); |
2341 |
|
|
2342 |
|
/* prepare clipboard */ |
2343 |
|
appdata.clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD); |
2344 |
|
gtk_clipboard_set_can_store(appdata.clipboard, NULL, 0); |
2345 |
|
|
2346 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2347 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
2348 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |