Replace custom help->about dialog with gtk_show_about_dialog
authorHugo Villeneuve <hugo@hugovil.com>
Thu, 10 Oct 2013 01:51:31 +0000 (21:51 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Wed, 6 Nov 2013 02:50:16 +0000 (21:50 -0500)
src/helpmenu.c
src/options.c
src/options.h

index 3bde4ce..4a8d9dc 100644 (file)
@@ -23,6 +23,8 @@
 #  include "config.h"
 #endif
 
+#include <stdbool.h>
+
 #if STDC_HEADERS
 #  include <string.h>
 #elif HAVE_STRINGS_H
@@ -37,6 +39,8 @@
 #include "messagebox.h"
 #include "helpmenu.h"
 
+#define PACKAGE_COPYRIGHT "(c) Hugo Villeneuve"
+
 static void
 HelpCommandsEvent(gchar *string)
 {
@@ -45,10 +49,45 @@ HelpCommandsEvent(gchar *string)
 }
 
 static void
-HelpAboutEvent(gchar *string)
+HelpAboutEvent(GtkWidget *widget, gpointer data)
 {
-       ShowMessage("About", VERSION_STRING, GTK_JUSTIFY_CENTER,
-                   MESSAGE_DIALOG_NORMAL_FONT);
+       const char *authors[] = {
+               "Hugo Villeneuve <hugo@hugovil.com>",
+               "Jonathan St-AndrĂ©",
+               "Pascal Fecteau",
+               "Jimmy Ringuette",
+               NULL,
+       };
+
+       const char *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, see\n"
+               "   <http://www.gnu.org/licenses/>";
+
+       gtk_show_about_dialog(
+               NULL,
+               "name", PACKAGE_NAME,
+               "title", "About Dialog",
+               "version", PACKAGE_VERSION,
+               "logo-icon-name", PACKAGE_TARNAME,
+               "comments", get_package_description(),
+               "authors", authors,
+               "website", PACKAGE_URL,
+               "copyright", PACKAGE_COPYRIGHT,
+               "license", license,
+               "wrap-license", true,
+               NULL);
 }
 
 void
index 6cd0de7..8cb065a 100644 (file)
@@ -55,6 +55,12 @@ DisplayUsage(void)
        printf(COMMAND_LINE_OPTIONS);
 }
 
+const char *
+get_package_description(void)
+{
+       return "Emulator for 8051 family microcontrollers";
+}
+
 /*******************************************************************************
  * Display version information and exit
  ******************************************************************************/
index 2a1a1bc..4c38439 100644 (file)
   "  -h                    display this help and exit\n" \
   "  -version              display version information and exit\n"
 
-#define VERSION_STRING \
-  PACKAGE "\n" \
-  "Version " VERSION "\n" \
-  "\n" \
-  "Written by\n" \
-  "Hugo Villeneuve\n" \
-  "Jonathan St-AndrĂ©\n" \
-  "Pascal Fecteau"
-
 void
 ParseCommandLineOptions(int argc, char *argv[]);
 
 char *
 get_hex_filename(void);
 
+const char *
+get_package_description(void);
+
 #endif /* OPTIONS_H */