A bunch more tweaks and added build and runtime library versions

Sat, 12 Aug 2017 16:44:50 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 12 Aug 2017 16:44:50 -0500
changeset 38661
cf4073d0d648
parent 38660
d6a4308481c7
child 38662
808d7958b434

A bunch more tweaks and added build and runtime library versions

pidgin/about.ui file | annotate | diff | comparison | revisions
pidgin/pidginabout.c file | annotate | diff | comparison | revisions
--- a/pidgin/about.ui	Thu Aug 10 23:00:22 2017 -0500
+++ b/pidgin/about.ui	Sat Aug 12 16:44:50 2017 -0500
@@ -235,6 +235,7 @@
                         <property name="can_focus">True</property>
                         <property name="model">build_info_store</property>
                         <property name="headers_visible">False</property>
+                        <property name="show_expanders">False</property>
                         <child internal-child="selection">
                           <object class="GtkTreeSelection"/>
                         </child>
--- a/pidgin/pidginabout.c	Thu Aug 10 23:00:22 2017 -0500
+++ b/pidgin/pidginabout.c	Sat Aug 12 16:44:50 2017 -0500
@@ -3,6 +3,7 @@
 
 #include "pidginabout.h"
 #include "pidginresources.h"
+#include "internal.h"
 
 #include <stdio.h>
 
@@ -24,7 +25,7 @@
 	GtkWidget *build_info_button;
 	GtkWidget *build_info_page;
 	GtkWidget *build_info_treeview;
-	GtkWidget *build_info_store;
+	GtkTreeStore *build_info_store;
 
 	gboolean switching_pages;
 };
@@ -138,33 +139,32 @@
 }
 
 static void
-_pidgin_about_dialog_add_config_args(PidginAboutDialog *about) {
-#ifdef CONFIG_ARGS
-#endif /* CONFIG_ARGS */
-}
-
-static void
-_pidgin_about_dialog_add_meson_args(PidginAboutDialog *about) {
-#ifdef MESON_ARGS
-	GtkTreeIter meson, value;
+_pidgin_about_dialog_add_build_args(
+	PidginAboutDialog *about,
+	const gchar *title,
+	const gchar *build_args
+) {
+	GtkTreeIter section, value;
 	gchar **splits = NULL;
-	gchar *split = NULL;
+	gchar *markup = NULL;
 	gint idx = 0;
 
-	gtk_tree_store_append(about->priv->build_info_store, &meson, NULL);
+	markup = g_strdup_printf("<span font-weight=\"bold\">%s</span>", title);
+	gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
 	gtk_tree_store_set(
 		about->priv->build_info_store,
-		&meson,
-		0, "<span font-weight=\"bold\">Meson Arguments</span>",
+		&section,
+		0, markup,
 		-1
 	);
+	g_free(markup);
 
 	/* now walk through the arguments and add them */
-	splits = g_strsplit(MESON_ARGS, " ", -1);
+	splits = g_strsplit(build_args, " ", -1);
 	for(idx = 0; splits[idx]; idx++) {
 		gchar **value_split = g_strsplit(splits[idx], "=", 2);
 
-		gtk_tree_store_append(about->priv->build_info_store, &value, &meson);
+		gtk_tree_store_append(about->priv->build_info_store, &value, &section);
 		gtk_tree_store_set(
 			about->priv->build_info_store,
 			&value,
@@ -177,13 +177,141 @@
 	}
 
 	g_strfreev(splits);
-#endif /* MESON_ARGS */
+}
+
+static void
+_pidgin_about_dialog_build_info_add_version(
+	GtkTreeStore *store,
+	GtkTreeIter *section,
+	const gchar *title,
+	guint major,
+	guint minor,
+	guint micro
+) {
+	GtkTreeIter item;
+	gchar *version = g_strdup_printf("%u.%u.%u", major, minor, micro);
+
+	gtk_tree_store_append(store, &item, section);
+	gtk_tree_store_set(
+		store, &item,
+		0, title,
+		1, version,
+		-1
+	);
+	g_free(version);
 }
 
 static void
 _pidgin_about_dialog_load_build_info(PidginAboutDialog *about) {
-	_pidgin_about_dialog_add_config_args(about);
-	_pidgin_about_dialog_add_meson_args(about);
+	GtkTreeIter section;
+	gchar *markup = NULL;
+
+	/* create the section */
+	markup = g_strdup_printf(
+		"<span font-weight=\"bold\">%s</span>",
+		_("Build Information")
+	);
+	gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
+	gtk_tree_store_set(
+		about->priv->build_info_store,
+		&section,
+		0, markup,
+		-1
+	);
+	g_free(markup);
+
+	/* add the purple version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("Purple Version"),
+		PURPLE_MAJOR_VERSION,
+		PURPLE_MINOR_VERSION,
+		PURPLE_MICRO_VERSION
+	);
+
+	/* add the glib version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("GLib Version"),
+		GLIB_MAJOR_VERSION,
+		GLIB_MINOR_VERSION,
+		GLIB_MICRO_VERSION
+	);
+
+	/* add the gtk version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("Gtk+ Version"),
+		GTK_MAJOR_VERSION,
+		GTK_MINOR_VERSION,
+		GTK_MICRO_VERSION
+	);
+}
+
+static void
+_pidgin_about_dialog_load_runtime_info(PidginAboutDialog *about) {
+	GtkTreeIter section;
+	gchar *markup = NULL;
+
+	/* create the section */
+	markup = g_strdup_printf(
+		"<span font-weight=\"bold\">%s</span>",
+		_("Runtime Information")
+	);
+	gtk_tree_store_append(about->priv->build_info_store, &section, NULL);
+	gtk_tree_store_set(
+		about->priv->build_info_store,
+		&section,
+		0, markup,
+		-1
+	);
+	g_free(markup);
+
+	/* add the purple version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("Purple Version"),
+		purple_major_version,
+		purple_minor_version,
+		purple_micro_version
+	);
+
+	/* add the glib version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("GLib Version"),
+		glib_major_version,
+		glib_minor_version,
+		glib_micro_version
+	);
+
+	/* add the gtk version */
+	_pidgin_about_dialog_build_info_add_version(
+		about->priv->build_info_store,
+		&section,
+		_("Gtk+ Version"),
+		gtk_major_version,
+		gtk_minor_version,
+		gtk_micro_version
+	);
+}
+
+static void
+_pidgin_about_dialog_load_build_configuration(PidginAboutDialog *about) {
+#ifdef MESON_ARGS
+	_pidgin_about_dialog_add_build_args(about, "Meson Arguments", MESON_ARGS);
+#endif /* MESON_ARGS */
+#ifdef CONFIG_ARGS
+	_pidgin_about_dialog_add_build_args(about, "Configure Arguments", CONFIG_ARGS);
+#endif /* CONFIG_ARGS */
+
+	_pidgin_about_dialog_load_build_info(about);
+	_pidgin_about_dialog_load_runtime_info(about);
 }
 
 /******************************************************************************
@@ -269,7 +397,7 @@
 		about
 	);
 
-	_pidgin_about_dialog_load_build_info(about);
+	_pidgin_about_dialog_load_build_configuration(about);
 	gtk_tree_view_expand_all(GTK_TREE_VIEW(about->priv->build_info_treeview));
 }
 

mercurial