[gnome-builder] credits: include version in credits screen
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] credits: include version in credits screen
- Date: Fri, 19 Dec 2014 03:46:41 +0000 (UTC)
commit 90efa0e162ee12d956f8ae7ff0582e294f49021b
Author: Christian Hergert <christian hergert me>
Date: Thu Dec 18 19:46:35 2014 -0800
credits: include version in credits screen
build/autotools/project_info.m4 | 6 -----
configure.ac | 17 ++++++++++++++-
src/credits/gb-credits-widget.c | 16 +++++++++++---
src/resources/ui/gb-credits-widget.ui | 2 +-
src/util/.gitignore | 1 +
src/util/gb-version.h.in | 36 +++++++++++++++++++++++++++++++++
6 files changed, 66 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 3f0c0a5..b4e0b7f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,12 @@
AC_PREREQ(2.60)
-m4_include([build/autotools/project_info.m4])
+m4_define([project_name],[gnome-builder])
+m4_define([project_major_version],[0])
+m4_define([project_minor_version],[1])
+m4_define([project_micro_version],[0])
+m4_define([project_interface_age],[0])
+m4_define([project_bugreport_url],
+ [https://bugzilla.gnome.org/enter_bug.cgi?product=gnome-builder])
# Initialize autoconf and things that go with it.
m4_include([build/autotools/autoconf.d/pre-ac.m4])
@@ -30,9 +36,18 @@ m4_ifdef([GTK_DOC_CHECK],[
GTK_DOC_CHECK
])
+MAJOR_VERSION=project_major_version
+MINOR_VERSION=project_minor_version
+MICRO_VERSION=project_micro_version
+
+AC_SUBST(MAJOR_VERSION)
+AC_SUBST(MINOR_VERSION)
+AC_SUBST(MICRO_VERSION)
+
# Define our known config files.
AC_CONFIG_FILES([
Makefile
+ src/util/gb-version.h
data/icons/Makefile
data/org.gnome.builder.editor.gschema.xml
data/org.gnome.builder.editor.language.gschema.xml
diff --git a/src/credits/gb-credits-widget.c b/src/credits/gb-credits-widget.c
index 10bc090..1928fca 100644
--- a/src/credits/gb-credits-widget.c
+++ b/src/credits/gb-credits-widget.c
@@ -20,6 +20,7 @@
#include "gb-animation.h"
#include "gb-credits-widget.h"
+#include "gb-version.h"
#include "gb-widget.h"
struct _GbCreditsWidgetPrivate
@@ -27,6 +28,7 @@ struct _GbCreditsWidgetPrivate
GbAnimation *animation;
GtkGrid *grid;
GtkEventBox *event_box;
+ GtkLabel *title;
gdouble progress;
guint duration;
};
@@ -283,18 +285,24 @@ gb_credits_widget_class_init (GbCreditsWidgetClass *klass)
g_object_class_install_property (object_class, PROP_PROGRESS,
gParamSpecs [PROP_PROGRESS]);
- gtk_widget_class_set_template_from_resource (widget_class,
- "/org/gnome/builder/ui/gb-credits-widget.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GbCreditsWidget, grid);
- gtk_widget_class_bind_template_child_private (widget_class, GbCreditsWidget, event_box);
+ GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-credits-widget.ui");
+ GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, title);
+ GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, grid);
+ GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, event_box);
}
static void
gb_credits_widget_init (GbCreditsWidget *self)
{
+ gchar *label;
+
self->priv = gb_credits_widget_get_instance_private (self);
self->priv->duration = 1000 * 20;
gtk_widget_init_template (GTK_WIDGET (self));
+
+ label = g_strdup_printf (_("GNOME Builder - %s"), GB_VERSION_S);
+ gtk_label_set_label (self->priv->title, label);
+ g_free (label);
}
diff --git a/src/resources/ui/gb-credits-widget.ui b/src/resources/ui/gb-credits-widget.ui
index a14a516..e18382e 100644
--- a/src/resources/ui/gb-credits-widget.ui
+++ b/src/resources/ui/gb-credits-widget.ui
@@ -233,7 +233,7 @@ and the Friends of GNOME</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label11">
+ <object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">GNOME Builder</property>
diff --git a/src/util/.gitignore b/src/util/.gitignore
new file mode 100644
index 0000000..bef4f1c
--- /dev/null
+++ b/src/util/.gitignore
@@ -0,0 +1 @@
+gb-version.h
diff --git a/src/util/gb-version.h.in b/src/util/gb-version.h.in
new file mode 100644
index 0000000..457630b
--- /dev/null
+++ b/src/util/gb-version.h.in
@@ -0,0 +1,36 @@
+/* gb-version.h.in
+ *
+ * Copyright (C) 2014 Christian Hergert <christian hergert me>
+ *
+ * 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GB_VERSION_H
+#define GB_VERSION_H
+
+#define GB_MAJOR_VERSION (@MAJOR_VERSION@)
+#define GB_MINOR_VERSION (@MINOR_VERSION@)
+#define GB_MICRO_VERSION (@MICRO_VERSION@)
+#define GB_VERSION (@MAJOR_VERSION @MINOR_VERSION @MICRO_VERSION@)
+#define GB_VERSION_S "@MAJOR_VERSION @MINOR_VERSION @MICRO_VERSION@"
+#define GB_VERSION_HEX (GB_MAJOR_VERSION << 24 | \
+ GB_MINOR_VERSION << 16 | \
+ GB_MICRO_VERSION << 8)
+#define GB_CHECK_VERSION(major,minor,micro) \
+ (GB_MAJOR_VERSION > (major) || \
+ (GB_MAJOR_VERSION == (major) && GB_MINOR_VERSION > (minor)) || \
+ (GB_MAJOR_VERSION == (major) && GB_MINOR_VERSION == (minor) && \
+ GB_MICRO_VERSION >= (micro)))
+
+#endif /* GB_VERSION_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]