X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/a8fe53f82dd0ca7b1bb431e69413fc119476d2aa..80471a6a905e00bf80ad04fa2061f88ea81f15cb:/src/dialog.c diff --git a/src/dialog.c b/src/dialog.c index e8f4d009..91f7e667 100644 --- a/src/dialog.c +++ b/src/dialog.c @@ -29,6 +29,7 @@ #include "degrees_converters.h" #include "authors.h" #include "googlesearch.h" +#include "util.h" #include @@ -297,12 +298,8 @@ gboolean a_dialog_new_waypoint ( GtkWindow *parent, gchar **dest, VikWaypoint *w if ( strlen(constname) == 0 ) /* TODO: other checks (isalpha or whatever ) */ a_dialog_info_msg ( parent, _("Please enter a name for the waypoint.") ); else { - int i; gchar *name = g_strdup ( constname ); - for ( i = strlen ( name ) - 1; i >= 0; i-- ) - name[i] = toupper(name[i]); /* all caps for stardandization */ - if ( g_hash_table_lookup ( waypoints, name ) && !a_dialog_overwrite ( parent, _("The waypoint \"%s\" exists, do you want to overwrite it?"), name ) ) g_free ( name ); else @@ -401,10 +398,6 @@ gchar *a_dialog_new_track ( GtkWindow *parent, GHashTable *tracks ) a_dialog_info_msg ( parent, _("Please enter a name for the track.") ); else { gchar *name = g_strdup ( constname ); - gint i; - - for ( i = strlen ( name ) - 1; i >= 0; i-- ) - name[i] = toupper(name[i]); /* all caps for stardandization */ if ( g_hash_table_lookup( tracks, name ) && !a_dialog_overwrite ( parent, _("The track \"%s\" exists, do you want to overwrite it?"), gtk_entry_get_text ( GTK_ENTRY(entry) ) ) ) { @@ -580,32 +573,28 @@ gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar * 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 ) { - int re; - char *msg = g_markup_printf_escaped ( - _(_("Viking %s\n\n" - "GPS Data and Topo Analyzer, Explorer, and Manager.\n\n" - "(C) 2003-2007, Evan Battaglia\n\n" - "Web site: %s")), - VIKING_VERSION, VIKING_URL); - GtkWidget *msgbox = gtk_message_dialog_new_with_markup ( parent, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_INFO, - GTK_BUTTONS_NONE, - msg); - - gtk_dialog_add_buttons (GTK_DIALOG(msgbox), _("Credits"), 1, _("License"), 2, _("Close"), 3, NULL, NULL); - - while ((re = gtk_dialog_run ( GTK_DIALOG(msgbox))) != 3) { - if (re==1) { - /* creds */ - a_dialog_info_msg(parent, AUTHORS); - } - if (re==2) { - a_dialog_info_msg(parent, _("\n\n" - "This program is free software; you can redistribute it and/or modify " + 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." @@ -617,10 +606,22 @@ void a_dialog_about ( GtkWindow *parent ) "\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_widget_destroy ( msgbox ); + "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)