Added license to GtkAboutDialog

It is read from the COPYING file that is now copied in glade/ folder.
This commit is contained in:
Nirgal Vourgère
2012-07-15 00:34:48 +02:00
parent c1fffc5c9e
commit f4a48d0730
2 changed files with 22 additions and 1 deletions

View File

@@ -8,7 +8,8 @@ glade_DATA = \
gmdb-schema.glade \
gmdb-prefs.glade \
gmdb-props.glade \
gmdb-tabledef.glade
gmdb-tabledef.glade \
../../../COPYING
EXTRA_DIST = $(glade_DATA)

View File

@@ -55,6 +55,9 @@ const gchar *documenters[] = {
};
GtkWidget *parent;
GdkPixbuf *pixbuf=NULL;
FILE *flicense;
guint32 licenselen;
char *license;
parent = gtk_widget_get_toplevel (button);
if (!GTK_WIDGET_TOPLEVEL (parent))
@@ -63,6 +66,21 @@ GdkPixbuf *pixbuf=NULL;
if (!pixbuf)
pixbuf = gdk_pixbuf_new_from_file (GMDB_ICONDIR "logo.xpm", NULL);
flicense = fopen(GMDB_ICONDIR "COPYING", "r");
if (flicense)
{
fseek(flicense, 0, SEEK_END);
licenselen = ftell(flicense);
fseek(flicense, 0, SEEK_SET);
license = g_malloc(licenselen+1);
fread(license, 1, licenselen, flicense);
license[licenselen] = 0;
fclose(flicense);
} else {
fprintf(stderr, "Can't open " GMDB_ICONDIR "COPYING\n");
license = NULL;
}
gtk_show_about_dialog ((GtkWindow*)parent,
"authors", authors,
"comments", _("GNOME MDB Viewer is a grapical interface to "
@@ -74,7 +92,9 @@ GdkPixbuf *pixbuf=NULL;
"program-name", _("GNOME MDB Viewer"),
"version", MDB_VERSION_NO,
"website", "http://mdbtools.sourceforge.net/",
"license", license,
NULL);
g_free(license);
}
void