diff src/preferences.c @ 2573:3e5919841759

Update secondary user documentation Use standard gtk_about_dialog for Help About Move contributers to AUTHORS file so that they appear in the Credits dialog Change gen_changelog.sh to create ChangeLog.html Include ChangeLog on Help menu Make presence of README.html and ChangeLog.html mandatory It would be better to generate above html files from automake. gtk_about_dialog uses msgid _("translator-credits"), but the translators do not use it.
author Colin Clark <colin.clark@cclark.uk>
date Tue, 08 Aug 2017 19:30:01 +0100
parents 78518b422e23
children c6f9494f6be1
line wrap: on
line diff
--- a/src/preferences.c	Sun Aug 06 20:17:44 2017 +0100
+++ b/src/preferences.c	Tue Aug 08 19:30:01 2017 +0100
@@ -2561,72 +2561,88 @@
 	help_window_show("credits");
 }
 
-void show_about_window(void)
+void show_about_window(LayoutWindow *lw)
 {
-	GtkWidget *vbox;
-	GtkWidget *hbox;
-	GtkWidget *label;
-	GtkWidget *button;
-	GdkPixbuf *pixbuf;
-
-	gchar *buf;
-
-	if (about)
+	GdkPixbuf *pixbuf_logo;
+	GdkPixbuf *pixbuf_icon;
+	gchar *authors[1000];
+	gchar *comment;
+	gint i_authors = 0;
+	gchar *path;
+	FILE *fp = NULL;
+#define LINE_LENGTH 1000
+	gchar line[LINE_LENGTH];
+
+#if !GTK_CHECK_VERSION(3,0,0)
+	GString *copyright;
+
+	copyright = g_string_new(NULL);
+	path = g_build_filename(GQ_HELPDIR, "COPYING", NULL);
+	fp = fopen(path, "r");
+	if (fp)
 		{
-		gtk_window_present(GTK_WINDOW(about));
-		return;
+		while(fgets(line, LINE_LENGTH, fp))
+			{
+			copyright = g_string_append(copyright, line);
+			}
+		fclose(fp);
 		}
-
-	about = window_new(GTK_WINDOW_TOPLEVEL, "about", NULL, NULL, _("About"));
-	gtk_window_set_type_hint(GTK_WINDOW(about), GDK_WINDOW_TYPE_HINT_DIALOG);
-	g_signal_connect(G_OBJECT(about), "delete_event",
-			 G_CALLBACK(about_delete_cb), NULL);
-
-	gtk_container_set_border_width(GTK_CONTAINER(about), PREF_PAD_BORDER);
-
-	vbox = gtk_vbox_new(FALSE, PREF_PAD_SPACE);
-	gtk_container_add(GTK_CONTAINER(about), vbox);
-	gtk_widget_show(vbox);
-
-	pixbuf = pixbuf_inline(PIXBUF_INLINE_LOGO);
-	button = gtk_image_new_from_pixbuf(pixbuf);
-	g_object_unref(pixbuf);
-	gtk_box_pack_start(GTK_BOX(vbox), button, TRUE, TRUE, 0);
-	gtk_widget_show(button);
-
-	buf = g_strdup_printf(_("%s %s\n\nCopyright (c) 2006 John Ellis\nCopyright (c) %s The Geeqie Team\nwebsite: %s\nemail: %s\n\nReleased under the GNU General Public License"),
-			      GQ_APPNAME,
-			      VERSION,
-			      "2008 - 2016",
-			      GQ_WEBSITE,
-			      GQ_EMAIL_ADDRESS);
-	label = gtk_label_new(buf);
-	g_free(buf);
-
-	gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
-	gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
-	gtk_widget_show(label);
-
-	hbox = gtk_hbutton_box_new();
-	gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_END);
-	gtk_box_set_spacing(GTK_BOX(hbox), PREF_PAD_BUTTON_GAP);
-	gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
-	gtk_widget_show(hbox);
-
-	button = pref_button_new(NULL, NULL, _("Credits..."), FALSE,
-				 G_CALLBACK(about_credits_cb), NULL);
-	gtk_container_add(GTK_CONTAINER(hbox), button);
-	gtk_widget_set_can_default(button, TRUE);
-	gtk_widget_show(button);
-
-	button = pref_button_new(NULL, GTK_STOCK_CLOSE, NULL, FALSE,
-				 G_CALLBACK(about_window_close), NULL);
-	gtk_container_add(GTK_CONTAINER(hbox), button);
-	gtk_widget_set_can_default(button, TRUE);
-	gtk_widget_grab_default(button);
-	gtk_widget_show(button);
-
-	gtk_widget_show(about);
+	g_free(path);
+#endif
+
+	authors[0] = NULL;
+	path = g_build_filename(GQ_HELPDIR, "AUTHORS", NULL);
+	fp = fopen(path, "r");
+	if (fp)
+		{
+		while(fgets(line, LINE_LENGTH, fp))
+			{
+			/* get rid of ending \n from fgets */
+			line[strlen(line) - 1] = '\0';
+			authors[i_authors] = g_strdup(line);
+			i_authors++;
+			}
+		authors[i_authors] = NULL;
+		fclose(fp);
+		}
+	g_free(path);
+
+	comment = g_strconcat("Development and bug reports:\n", GQ_EMAIL_ADDRESS,
+						"\nhttps://github.com/BestImageViewer/geeqie/issues",NULL);
+
+	pixbuf_logo = pixbuf_inline(PIXBUF_INLINE_LOGO);
+	pixbuf_icon = pixbuf_inline(PIXBUF_INLINE_ICON);
+	gtk_show_about_dialog(GTK_WINDOW(lw->window),
+		"title", _("About Geeqie"),
+		"resizable", TRUE,
+		"program-name", GQ_APPNAME,
+		"version", VERSION,
+		"logo", pixbuf_logo,
+		"icon", pixbuf_icon,
+		"website", GQ_WEBSITE,
+		"website-label", "Website",
+		"comments", comment,
+		"authors", authors,
+		"translator-credits", _("translator-credits"),
+#if GTK_CHECK_VERSION(3,0,0)
+		"license-type", GTK_LICENSE_GPL_2_0,
+#else
+		"license",  copyright->str,
+#endif
+		NULL);
+
+#if !GTK_CHECK_VERSION(3,0,0)
+	g_string_free(copyright, TRUE);
+#endif
+	gint n = 0;
+	while(n < i_authors)
+		{
+		g_free(authors[n]);
+		n++;
+		}
+	g_free(comment);
+
+	return;
 }
 
 static void image_overlay_set_text_colours()