+
+static void split_spin_focused ( GtkSpinButton *spin, GtkWidget *pass_along[1] )
+{
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(pass_along[0]), 1);
+}
+
+gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar *label_text, guint *thr )
+{
+ GtkWidget *dialog = gtk_dialog_new_with_buttons (title_text,
+ parent,
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_REJECT,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_ACCEPT,
+ NULL);
+ GtkWidget *table, *t1, *t2, *t3, *t4, *spin, *label;
+ GtkWidget *pass_along[1];
+
+ table = gtk_table_new ( 4, 2, FALSE );
+ gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), table, TRUE, TRUE, 0 );
+
+ label = gtk_label_new (label_text);
+
+ t1 = gtk_radio_button_new_with_label ( NULL, _("1 min") );
+ t2 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t1), _("1 hour") );
+ t3 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t2), _("1 day") );
+ t4 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON(t3), _("Custom (in minutes):") );
+
+ pass_along[0] = t4;
+
+ spin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( *thr, 0, 65536, 1, 5, 5 ), 1, 0 );
+
+ gtk_table_attach_defaults ( GTK_TABLE(table), label, 0, 2, 0, 1 );
+ gtk_table_attach_defaults ( GTK_TABLE(table), t1, 0, 1, 1, 2 );
+ gtk_table_attach_defaults ( GTK_TABLE(table), t2, 0, 1, 2, 3 );
+ gtk_table_attach_defaults ( GTK_TABLE(table), t3, 0, 1, 3, 4 );
+ gtk_table_attach_defaults ( GTK_TABLE(table), t4, 0, 1, 4, 5 );
+ gtk_table_attach_defaults ( GTK_TABLE(table), spin, 1, 2, 4, 5 );
+
+ gtk_widget_show_all ( table );
+
+ g_signal_connect ( G_OBJECT(spin), "grab-focus", G_CALLBACK(split_spin_focused), pass_along );
+
+ if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT )
+ {
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t1))) {
+ *thr = 1;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t2))) {
+ *thr = 60;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t3))) {
+ *thr = 60 * 24;
+ } else if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(t4))) {
+ *thr = gtk_spin_button_get_value ( GTK_SPIN_BUTTON(spin) );
+ }
+ gtk_widget_destroy ( dialog );
+ return TRUE;
+ }
+ gtk_widget_destroy ( dialog );
+ return FALSE;
+}
+
+static void about_url_hook (GtkAboutDialog *about,
+ const gchar *link,
+ gpointer data)
+{
+ open_url (GTK_WINDOW(about), link);
+}
+
+static void about_email_hook (GtkAboutDialog *about,
+ const gchar *email,
+ gpointer data)
+{
+ new_email (GTK_WINDOW(about), email);
+}
+
+void a_dialog_about ( GtkWindow *parent )
+{
+ const gchar *program_name = PACKAGE_NAME;
+ const gchar *version = VIKING_VERSION;
+ const gchar *website = VIKING_URL;
+ const gchar *copyright = "2003-2008, Evan Battaglia";
+ const gchar *comments = _("GPS Data and Topo Analyzer, Explorer, and Manager.");
+ const gchar *license = _("This program is free software; you can redistribute it and/or modify "
+ "it under the terms of the GNU General Public License as published by "
+ "the Free Software Foundation; either version 2 of the License, or "
+ "(at your option) any later version."
+ "\n\n"
+ "This program is distributed in the hope that it will be useful, "
+ "but WITHOUT ANY WARRANTY; without even the implied warranty of "
+ "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the "
+ "GNU General Public License for more details."
+ "\n\n"
+ "You should have received a copy of the GNU General Public License "
+ "along with this program; if not, write to the Free Software "
+ "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA");
+
+ gtk_about_dialog_set_url_hook (about_url_hook, NULL, NULL);
+ gtk_about_dialog_set_email_hook (about_email_hook, NULL, NULL);
+ gtk_show_about_dialog (parent,
+ /* TODO do not set program-name and correctly set info for g_get_application_name */
+ "program-name", program_name,
+ "version", version,
+ "website", website,
+ "comments", comments,
+ "copyright", copyright,
+ "license", license,
+ "wrap-license", TRUE,
+ /* logo automatically retrieved via gtk_window_get_default_icon_list */
+ "authors", AUTHORS,
+ NULL);
+}
+
+gboolean a_dialog_map_n_zoom(GtkWindow *parent, gchar *mapnames[], gint default_map, gchar *zoom_list[], gint default_zoom, gint *selected_map, gint *selected_zoom)
+{
+ gchar **s;
+
+ GtkWidget *dialog = gtk_dialog_new_with_buttons ( _("Download along track"), parent, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL );
+
+ GtkWidget *map_label = gtk_label_new(_("Map type:"));
+ GtkComboBox *map_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
+ for (s = mapnames; *s; s++)
+ gtk_combo_box_append_text(map_combo, *s);
+ gtk_combo_box_set_active (map_combo, default_map);
+ GtkWidget *zoom_label = gtk_label_new(_("Zoom level:"));
+ GtkComboBox *zoom_combo = GTK_COMBO_BOX(gtk_combo_box_new_text());
+ for (s = zoom_list; *s; s++)
+ gtk_combo_box_append_text(zoom_combo, *s);
+ gtk_combo_box_set_active (zoom_combo, default_zoom);
+
+ GtkTable *box = GTK_TABLE(gtk_table_new(2, 2, FALSE));
+ gtk_table_attach_defaults(box, GTK_WIDGET(map_label), 0, 1, 0, 1);
+ gtk_table_attach_defaults(box, GTK_WIDGET(map_combo), 1, 2, 0, 1);
+ gtk_table_attach_defaults(box, GTK_WIDGET(zoom_label), 0, 1, 1, 2);
+ gtk_table_attach_defaults(box, GTK_WIDGET(zoom_combo), 1, 2, 1, 2);
+
+ gtk_box_pack_start ( GTK_BOX(GTK_DIALOG(dialog)->vbox), GTK_WIDGET(box), FALSE, FALSE, 5 );
+
+ gtk_widget_show_all ( dialog );
+ if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) != GTK_RESPONSE_ACCEPT ) {
+ gtk_widget_destroy(dialog);
+ return FALSE;
+ }
+
+ *selected_map = gtk_combo_box_get_active(map_combo);
+ *selected_zoom = gtk_combo_box_get_active(zoom_combo);
+
+ gtk_widget_destroy(dialog);
+ return TRUE;
+}