From: Guilhem Bonnefille Date: Fri, 22 Aug 2008 21:48:12 +0000 (+0000) Subject: Replace specific about dialog by GtkAboutDialog X-Git-Url: https://git.street.me.uk/andy/viking.git/commitdiff_plain/85beadba62b8c2da3817f74c32ed67cd631ac443?ds=sidebyside Replace specific about dialog by GtkAboutDialog --- diff --git a/ChangeLog b/ChangeLog index d505c00a..c6544daf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-08-22 +Guilhem Bonnefille : + * Replace specific about dialog by GtkAboutDialog + 2008-08-17 Guilhem Bonnefille : * Add preferences to store OSM login/password diff --git a/src/Makefile.am b/src/Makefile.am index dde4da2b..b033be84 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,8 +10,9 @@ noinst_LIBRARIES = libviking.a authors.h: ../AUTHORS rm -f $@ echo "/* Generated file. */" >> $@ - echo "#define AUTHORS \\" >> $@ - sed -e "s/ \*\*.*//" -e 's/^/"/' -e 's/$$/\\n"\\/' -e '$$s/\\$$//' $< >> $@ + echo "const gchar *AUTHORS[] = {\\" >> $@ + sed -e "s/ \*\*.*//" -e 's/^/"/' -e 's/$$/",\\/' -e '$$s/\\$$//' $< >> $@ + echo "NULL};" >> $@ BUILT_SOURCES = authors.h diff --git a/src/dialog.c b/src/dialog.c index eb5d11e2..a811aed4 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 @@ -572,32 +573,21 @@ gboolean a_dialog_time_threshold ( GtkWindow *parent, gchar *title_text, gchar * return FALSE; } +static void activate_url (GtkAboutDialog *about, + const gchar *link, + gpointer data) +{ + open_url(GTK_WINDOW(about), link); +} 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-2008, 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." @@ -609,10 +599,21 @@ 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 (activate_url, 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)