X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=belltower.c;h=802d5d336ae6d710dc6eada8812dc8cf6376c6f6;hb=e462081c257a7f62557413f9b4d2189dc8ec51e7;hp=b7b2dcb1969e4a6f7ac39d2157db6664d01d640d;hpb=8a94f2099cf5f17f684b267576092a1f617a67c1;p=belltower diff --git a/belltower.c b/belltower.c index b7b2dcb..802d5d3 100644 --- a/belltower.c +++ b/belltower.c @@ -361,6 +361,19 @@ show_tower_map (void) } static void +show_tower_directions (void) +{ + if (tower_directions) + { + show_browser (tower_directions); + } + else + { + show_message ("I don't know where you are!"); + } +} + +static void show_peals_list (void) { show_browser (peals_list); @@ -586,31 +599,9 @@ single_tower_cb (tower *details, tower_window = hildon_stackable_window_new (); - if (g_str_has_prefix (details->fields[FieldDedication], - "S ")) - { - /* FIXME: This needs to be cleverer, because we can have - * e.g. "S Peter and S Paul". - * May have to use regexps. - * Reallocation in general even when unchanged is okay, - * because it's the common case (most towers are S Something) - */ - - /* FIXME: Since we're passing this in as markup, - * we need to escape the strings. - */ - - str = g_strdup_printf("St %s, %s", - details->fields[FieldDedication]+2, - details->fields[FieldPlace]); - - } - else - { - str = g_strdup_printf("%s, %s", - details->fields[FieldDedication], - details->fields[FieldPlace]); - } + str = g_strdup_printf("%s, %s", + details->fields[FieldDedication], + details->fields[FieldPlace]); hildon_window_set_markup (HILDON_WINDOW (tower_window), str); @@ -649,7 +640,7 @@ single_tower_cb (tower *details, } add_button ("Peals", show_peals_list); add_button ("Map", show_tower_map); - add_button ("Directions", NULL); + add_button ("Directions", show_tower_directions); /* don't use a toggle button: it looks stupid */ button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT, @@ -680,6 +671,15 @@ single_tower_cb (tower *details, tower_map = g_strdup_printf ("http://maps.google.com/maps?q=%s,%s", details->fields[FieldLat], details->fields[FieldLong]); + g_free (tower_directions); + if (device->fix->fields & LOCATION_GPS_DEVICE_LATLONG_SET) + { + tower_directions = g_strdup_printf ("http://maps.google.com/maps?q=%f,%f+to+%s,%s", + device->fix->latitude, + device->fix->longitude, + details->fields[FieldLat], + details->fields[FieldLong]); + } g_free (tower_displayed); tower_displayed = g_strdup (details->fields[FieldPrimaryKey]); @@ -1245,18 +1245,28 @@ show_credits (GtkButton *source, button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL, - "View the GNU General Public Licence", - "This program is provided under the GPL, with no warranty."); + "Welcome to Belltower. The program is \xc2\xa9 2009 Thomas Thurman.", + "View the program's home page."); + g_signal_connect (button, "clicked", G_CALLBACK (show_web_page), + "http://belltower.garage.maemo.org"); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + button, + TRUE, TRUE, 0); + + button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT, + HILDON_BUTTON_ARRANGEMENT_VERTICAL, + "This program is provided under the GNU GPL, with no warranty.", + "View the GNU General Public Licence."); g_signal_connect (button, "clicked", G_CALLBACK (show_web_page), - "www.gnu.org/copyleft/gpl.html"); + "http://www.gnu.org/copyleft/gpl.html"); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), button, TRUE, TRUE, 0); button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL, - "View Dove's Guide for Church Bell Ringers", - "The source of this program's data."); + "The data comes from Dove's Guide for Church Bell Ringers.", + "View Dove's Guide."); g_signal_connect (button, "clicked", G_CALLBACK (show_web_page), "http://dove.cccbr.org.uk"); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), @@ -1265,8 +1275,8 @@ show_credits (GtkButton *source, button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT, HILDON_BUTTON_ARRANGEMENT_VERTICAL, - "View belfry photograph", - "Image \xc2\xa9 Amanda Slater, cc-by-sa."); + "The belfry image is \xc2\xa9 Amanda Slater, cc-by-sa.", + "View the original photograph."); g_signal_connect (button, "clicked", G_CALLBACK (show_web_page), "http://www.flickr.com/photos/pikerslanefarm/3398769335/"); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),