1032 |
char *uses = "uses gpsd"; |
char *uses = "uses gpsd"; |
1033 |
#endif |
#endif |
1034 |
|
|
1035 |
char *str = g_strdup_printf("%s\n\n%s", |
char *str = g_strdup_printf("%s\n\n(%s)", |
1036 |
_("GPXView (c) 2008 by\n" |
_("GPXView (c) 2008-2009 by\n" |
1037 |
"Till Harbaum <till@harbaum.org>\n" |
"Till Harbaum <till@harbaum.org>\n" |
1038 |
"Geocaching.com: Tantil"), |
"Mailing list: gpxview-users@garage.maemo.org"), |
1039 |
_(uses) |
_(uses) |
1040 |
); |
); |
1041 |
|
|
1042 |
gtk_about_dialog_set_copyright(about, str); |
gtk_about_dialog_set_copyright(about, str); |
1043 |
g_free(str); |
g_free(str); |
1525 |
} |
} |
1526 |
|
|
1527 |
#ifdef USE_STACKABLE_WINDOW |
#ifdef USE_STACKABLE_WINDOW |
1528 |
static void on_export_destroy(GtkWidget *widget, appdata_t *appdata) { |
typedef struct { |
1529 |
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
char *label, *desc; |
1530 |
} |
GtkSignalFunc activate_cb; |
1531 |
|
} menu_entry_t; |
|
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
|
|
HildonStackableWindow *view_window; |
|
|
GtkWidget *but; |
|
|
|
|
|
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
|
|
gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Export"); |
|
|
|
|
|
/* store last "cur_view" in window */ |
|
|
g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view); |
|
|
appdata->cur_view = NULL; |
|
|
|
|
|
g_signal_connect(G_OBJECT(view_window), "destroy", |
|
|
G_CALLBACK(on_export_destroy), appdata); |
|
1532 |
|
|
1533 |
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
typedef struct { |
1534 |
|
const char *title; |
1535 |
|
const menu_entry_t *menu; |
1536 |
|
int len; |
1537 |
|
} submenu_t; |
1538 |
|
|
1539 |
|
#define COLUMNS 1 |
1540 |
|
|
1541 |
|
void on_submenu_entry_clicked(GtkButton *button, GtkWidget *menu) { |
1542 |
|
|
1543 |
|
/* force closing of submenu dialog */ |
1544 |
|
gtk_dialog_response(GTK_DIALOG(menu), GTK_RESPONSE_NONE); |
1545 |
|
gtk_widget_hide(menu); |
1546 |
|
|
1547 |
|
/* let gtk clean up */ |
1548 |
|
while(gtk_events_pending()) |
1549 |
|
gtk_main_iteration(); |
1550 |
|
} |
1551 |
|
|
1552 |
|
static GtkWidget *app_submenu_create(appdata_t *appdata, |
1553 |
|
const submenu_t *submenu) { |
1554 |
|
|
1555 |
|
/* create a oridinary dialog box */ |
1556 |
|
GtkWidget *dialog = gtk_dialog_new(); |
1557 |
|
gtk_window_set_title(GTK_WINDOW(dialog), _(submenu->title)); |
1558 |
|
gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); |
1559 |
|
gtk_window_set_transient_for(GTK_WINDOW(dialog), |
1560 |
|
GTK_WINDOW(appdata->window)); |
1561 |
|
gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
1562 |
|
|
1563 |
|
GtkWidget *table = gtk_table_new(submenu->len/COLUMNS, COLUMNS, TRUE); |
1564 |
|
int x = 0, y = 0; |
1565 |
|
|
1566 |
|
const menu_entry_t *menu_entries = submenu->menu; |
1567 |
|
while(menu_entries->label) { |
1568 |
|
GtkWidget *button = NULL; |
1569 |
|
|
1570 |
but = hildon_button_new_with_text( |
button = hildon_button_new_with_text( |
1571 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
1572 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
1573 |
_("Export to Maemo Mapper"), |
_(menu_entries->label), _(menu_entries->desc)); |
|
_("Save a Maemo Mapper POI file")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_export_mmpoi), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1574 |
|
|
1575 |
|
/* try to center both texts */ |
1576 |
|
hildon_button_set_title_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1577 |
|
hildon_button_set_value_alignment(HILDON_BUTTON(button), 0.5, 0.5); |
1578 |
|
|
1579 |
but = hildon_button_new_with_text( |
g_signal_connect(button, "clicked", |
1580 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
G_CALLBACK(on_submenu_entry_clicked), dialog); |
1581 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
1582 |
_("Export Field Notes"), |
g_signal_connect(button, "clicked", |
1583 |
_("Save a Garmin Field Notes file")); |
menu_entries->activate_cb, appdata); |
1584 |
g_signal_connect(but, "clicked", |
|
1585 |
G_CALLBACK(cb_menu_export_log), appdata); |
gtk_table_attach_defaults(GTK_TABLE(table), button, x, x+1, y, y+1); |
1586 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1587 |
|
x++; |
1588 |
|
if(x == COLUMNS) { x = 0; y++; } |
1589 |
|
|
1590 |
but = hildon_button_new_with_text( |
menu_entries++; |
1591 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
} |
|
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
|
|
_("Export Garmin GPX"), |
|
|
_("Save a GPX file containing modified waypoints")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_export_garmin), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1592 |
|
|
1593 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(dialog)->vbox), table); |
|
gtk_widget_show_all (GTK_WIDGET (view_window)); |
|
|
} |
|
1594 |
|
|
1595 |
static void on_tools_destroy(GtkWidget *widget, appdata_t *appdata) { |
return dialog; |
|
appdata->cur_view = g_object_get_data(G_OBJECT(widget), "cur_view"); |
|
1596 |
} |
} |
1597 |
|
|
1598 |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
/* popup the dialog shaped submenu */ |
1599 |
HildonStackableWindow *view_window; |
static void submenu_popup(GtkWidget *menu) { |
1600 |
GtkWidget *but; |
gtk_widget_show_all(menu); |
1601 |
|
gtk_dialog_run(GTK_DIALOG(menu)); |
1602 |
view_window = HILDON_STACKABLE_WINDOW (hildon_stackable_window_new ()); |
gtk_widget_hide(menu); |
1603 |
gtk_window_set_title (GTK_WINDOW (view_window), "GPXView - Tools"); |
} |
1604 |
|
|
1605 |
/* store last "cur_view" in window */ |
static void submenu_cleanup(GtkWidget *menu) { |
1606 |
g_object_set_data(G_OBJECT(view_window), "cur_view", appdata->cur_view); |
gtk_widget_destroy(menu); |
1607 |
appdata->cur_view = NULL; |
} |
1608 |
|
|
1609 |
g_signal_connect(G_OBJECT(view_window), "destroy", |
static const menu_entry_t submenu_export_entries[] = { |
1610 |
G_CALLBACK(on_tools_destroy), appdata); |
{ "Export to Maemo Mapper" , "Save a Maemo Mapper POI file", |
1611 |
|
G_CALLBACK(cb_menu_export_mmpoi) }, |
1612 |
|
{ "Export Field Notes", "Save a Garmin Field Notes file", |
1613 |
|
G_CALLBACK(cb_menu_export_log) }, |
1614 |
|
{ "Export Garmin GPX", "Save modified waypoints in GPX file", |
1615 |
|
G_CALLBACK(cb_menu_export_garmin) }, |
1616 |
|
{ NULL, NULL, NULL } |
1617 |
|
}; |
1618 |
|
|
1619 |
GtkVBox *contents = GTK_VBOX(gtk_vbox_new (12, FALSE)); |
static const submenu_t submenu_export = { |
1620 |
|
"Export", submenu_export_entries, |
1621 |
|
sizeof(submenu_export_entries)/sizeof(menu_entry_t)-1 |
1622 |
|
}; |
1623 |
|
|
1624 |
but = hildon_button_new_with_text( |
/* the export submenu */ |
1625 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
void on_export_clicked(GtkButton *button, appdata_t *appdata) { |
1626 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
if(!appdata->export_menu) |
1627 |
_("Geomath"), |
appdata->export_menu = app_submenu_create(appdata, &submenu_export); |
|
_("Geocoordinate calculation")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_geomath), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1628 |
|
|
1629 |
|
submenu_popup(appdata->export_menu); |
1630 |
|
} |
1631 |
|
|
1632 |
but = hildon_button_new_with_text( |
static const menu_entry_t submenu_tools_entries[] = { |
1633 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
{ "Geomath", "Geocoordinate calculation", |
1634 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
G_CALLBACK(cb_menu_geomath) }, |
1635 |
_("Geotext"), |
{ "Geotext", "Text analysis", |
1636 |
_("Text analysis, letter counting etc")); |
G_CALLBACK(cb_menu_geotext) }, |
1637 |
g_signal_connect(but, "clicked", |
{ "Precise Position", "Calculate a precise GPS position", |
1638 |
G_CALLBACK(cb_menu_geotext), appdata); |
G_CALLBACK(cb_menu_precpos) }, |
1639 |
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
{ NULL, NULL, NULL } |
1640 |
|
}; |
1641 |
|
|
1642 |
|
static const submenu_t submenu_tools = { |
1643 |
|
"Tools", submenu_tools_entries, |
1644 |
|
sizeof(submenu_tools_entries)/sizeof(menu_entry_t)-1 |
1645 |
|
}; |
1646 |
|
|
1647 |
but = hildon_button_new_with_text( |
/* the tools submenu */ |
1648 |
HILDON_SIZE_FINGER_HEIGHT | HILDON_SIZE_AUTO_WIDTH, |
void on_tools_clicked(GtkButton *button, appdata_t *appdata) { |
1649 |
HILDON_BUTTON_ARRANGEMENT_VERTICAL, |
if(!appdata->tools_menu) |
1650 |
_("Precise Position"), |
appdata->tools_menu = app_submenu_create(appdata, &submenu_tools); |
|
_("Calculate a very precise GPS position")); |
|
|
g_signal_connect(but, "clicked", |
|
|
G_CALLBACK(cb_menu_precpos), appdata); |
|
|
gtk_box_pack_start(GTK_BOX(contents), but, FALSE, FALSE, 0); |
|
1651 |
|
|
1652 |
gtk_container_add (GTK_CONTAINER (view_window), GTK_WIDGET (contents)); |
submenu_popup(appdata->tools_menu); |
|
gtk_widget_show_all (GTK_WIDGET (view_window)); |
|
1653 |
} |
} |
1654 |
|
|
1655 |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
HildonAppMenu *menu_create(appdata_t *appdata, int mode) { |
1696 |
G_CALLBACK(on_tools_clicked), appdata); |
G_CALLBACK(on_tools_clicked), appdata); |
1697 |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1698 |
|
|
1699 |
// gtk_widget_show(GTK_WIDGET(menu)); |
#ifdef HILDON_HELP |
1700 |
|
button = gtk_button_new_with_label(_("Help")); |
1701 |
|
g_signal_connect_after(button, "clicked", |
1702 |
|
G_CALLBACK(cb_menu_help), appdata); |
1703 |
|
hildon_app_menu_append(menu, GTK_BUTTON(button)); |
1704 |
|
#endif |
1705 |
|
|
1706 |
|
gtk_widget_show_all(GTK_WIDGET(menu)); |
1707 |
|
|
1708 |
return menu; |
return menu; |
1709 |
} |
} |
1872 |
if(appdata->image_path) free(appdata->image_path); |
if(appdata->image_path) free(appdata->image_path); |
1873 |
if(appdata->search_str) free(appdata->search_str); |
if(appdata->search_str) free(appdata->search_str); |
1874 |
|
|
1875 |
|
#ifdef USE_STACKABLE_WINDOW |
1876 |
|
if(appdata->export_menu) submenu_cleanup(appdata->export_menu); |
1877 |
|
if(appdata->tools_menu) submenu_cleanup(appdata->tools_menu); |
1878 |
|
#endif |
1879 |
|
|
1880 |
gnome_vfs_shutdown(); |
gnome_vfs_shutdown(); |
1881 |
icons_free(); |
icons_free(); |
1882 |
gps_release(appdata); |
gps_release(appdata); |
2248 |
|
|
2249 |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
appdata.vbox = gtk_vbox_new(FALSE, 2); |
2250 |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
gtk_container_add(GTK_CONTAINER(appdata.window), appdata.vbox); |
|
|
|
2251 |
#ifndef USE_STACKABLE_WINDOW |
#ifndef USE_STACKABLE_WINDOW |
2252 |
menu_create(&appdata); |
menu_create(&appdata); |
2253 |
#else |
#else |