+ parse_dove (get_group_of_towers_cb,
+ CONFIG_RECENT_GROUP,
+ "Towers you have recently viewed");
+}
+
+/**
+ * Displays a web page.
+ * (Perhaps this should be merged with show_browser().)
+ *
+ * \param url The URL.
+ */
+static void
+show_web_page (GtkButton *dummy,
+ gpointer url)
+{
+ show_browser (url);
+}
+
+/**
+ * Shows the credits.
+ *
+ * \param source If non-null, we were called from a button press,
+ * so always show the credits. If null, we were called
+ * automatically on startup, so show the credits if
+ * they haven't already been seen.
+ */
+static void
+show_credits (GtkButton *source,
+ gpointer dummy)
+{
+ gboolean from_button = (source!=NULL);
+ GtkWidget *dialog, *label, *button;
+
+ if (!from_button &&
+ g_key_file_get_boolean (config,
+ CONFIG_GENERAL_GROUP,
+ CONFIG_SEEN_CREDITS_KEY,
+ NULL))
+ {
+ return;
+ }
+
+
+ dialog = gtk_dialog_new_with_buttons ("Credits",
+ GTK_WINDOW (window),
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+ NULL
+ );
+
+ button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ "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),
+ "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,
+ "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),
+ button,
+ TRUE, TRUE, 0);
+
+ button = hildon_button_new_with_text (HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
+ HILDON_BUTTON_ARRANGEMENT_VERTICAL,
+ "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),
+ button,
+ TRUE, TRUE, 0);
+
+ gtk_widget_show_all (GTK_WIDGET (dialog));
+
+ g_key_file_set_boolean (config,
+ CONFIG_GENERAL_GROUP,
+ CONFIG_SEEN_CREDITS_KEY,
+ TRUE);
+ save_config ();
+}
+
+static void
+settings_dialogue (GtkButton *source,
+ gpointer dummy)
+{
+ GtkWidget *dialog, *button;
+ GtkWidget *selector[G_N_ELEMENTS (settings)];
+ gint i;
+
+ dialog = gtk_dialog_new_with_buttons ("Settings",
+ GTK_WINDOW (window),
+ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
+ NULL
+ );
+
+ for (i=0; i<G_N_ELEMENTS (settings); i++)
+ {
+ char **cursor = settings[i]+2;
+ selector[i] = hildon_touch_selector_new_text ();
+
+ while (*cursor)
+ {
+ hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector[i]), *cursor);
+ cursor++;
+ }
+
+ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector[i]), 0, settings_value[i]);
+
+ button = hildon_picker_button_new (HILDON_SIZE_AUTO, HILDON_BUTTON_ARRANGEMENT_VERTICAL);
+ hildon_button_set_title (HILDON_BUTTON (button), settings[i][1]);
+ hildon_picker_button_set_selector (HILDON_PICKER_BUTTON (button),
+ HILDON_TOUCH_SELECTOR (selector[i]));
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox),
+ button,
+ TRUE, TRUE, 0);
+ }
+
+ gtk_widget_show_all (GTK_WIDGET (dialog));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+
+ for (i=0; i<G_N_ELEMENTS (settings); i++)
+ {
+ GList *rows = hildon_touch_selector_get_selected_rows (HILDON_TOUCH_SELECTOR (selector[i]),
+ 0);
+ GtkTreePath *path = (GtkTreePath*) rows->data;
+ gint *indices = gtk_tree_path_get_indices (path);
+
+ g_key_file_set_string (config,
+ CONFIG_GENERAL_GROUP,
+ settings[i][0],
+ hildon_touch_selector_get_current_text (HILDON_TOUCH_SELECTOR (selector[i])));
+
+ settings_value[i] = *indices;
+ }
+ save_config ();
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));