#define MAX_FIELDS 50
GtkWidget *window;
-
LocationGPSDevice *device;
+GKeyFile *static_content;
typedef enum {
/** stop scanning the database */
show_message ("This is not yet implemented.");
}
+/**
+ * Loads the content of the static data file. Possibly puts
+ * up a warning if we can't load it.
+ */
+static void
+load_static_content (void)
+{
+ static_content = g_key_file_new ();
+
+ if (!g_key_file_load_from_file (static_content,
+ "/usr/share/belltower/static.ini",
+ G_KEY_FILE_NONE,
+ NULL))
+ {
+ show_message ("Could not load static content. Attempting to continue.");
+ }
+}
+
+/**
+ * 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;
+
+ 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,
+ "View the GNU General Public Licence",
+ "This program is provided under the GPL, with no warranty.");
+ g_signal_connect (button, "clicked", G_CALLBACK (show_web_page),
+ "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.");
+ 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,
+ "View belfry photograph",
+ "Image \xc2\xa9 Amanda Slater, cc-by-sa.");
+ 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));
+}
+
int
main(int argc, char **argv)
{
/* extra buttons for the app menu */
button = gtk_button_new_with_label ("Credits");
- hildon_app_menu_append (menu, GTK_BUTTON (button));
+ g_signal_connect (button, "clicked", G_CALLBACK (show_credits), NULL);
hildon_app_menu_append (menu, GTK_BUTTON (button));
gtk_widget_show_all (GTK_WIDGET (menu));
gtk_container_add (GTK_CONTAINER (window), hbox);
gtk_widget_show_all (GTK_WIDGET (window));
+ load_static_content ();
+ show_credits (NULL, NULL);
+
gtk_main ();
return EXIT_SUCCESS;