]> git.street.me.uk Git - andy/viking.git/commitdiff
Replace specific about dialog by GtkAboutDialog
authorGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Fri, 22 Aug 2008 21:48:12 +0000 (21:48 +0000)
committerGuilhem Bonnefille <guilhem.bonnefille@gmail.com>
Fri, 22 Aug 2008 21:48:12 +0000 (21:48 +0000)
ChangeLog
src/Makefile.am
src/dialog.c

index d505c00a18125a316bf70f444e41c622c51feeec..c6544daf7f85bf091b14bc2efc30d360f5d76835 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-08-22
+Guilhem Bonnefille <guilhem.bonnefille@gmail.com>:
+       * Replace specific about dialog by GtkAboutDialog
+
 2008-08-17
 Guilhem Bonnefille <guilhem.bonnefille@gmail.com>:
        * Add preferences to store OSM login/password
index dde4da2b3fa3986dfd34dad77a9931376256f38c..b033be844bbcce64ed454902b92f196b439a603b 100644 (file)
@@ -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
 
index eb5d11e2bd61d0ec5004ee9a49bc9f22be5bdcea..a811aed4c7f4e3e0677d3e8794238d329fbae6df 100644 (file)
@@ -29,6 +29,7 @@
 #include "degrees_converters.h"
 #include "authors.h"
 #include "googlesearch.h"
+#include "util.h"
 
 #include <glib/gi18n.h>
 
@@ -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 (
-    _(_("<span font_desc='20' weight='bold'>Viking %s</span>\n\n"
-    "GPS Data and Topo Analyzer, Explorer, and Manager.\n\n"
-    "<small>(C) 2003-2008, Evan Battaglia</small>\n\n"
-    "<small>Web site: %s</small>")),
-    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)