[glade] GladeWindow: use VCS version in development series



commit d09d5690a11d6ded682975ad3c505d351b16d8db
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Thu Sep 17 08:55:51 2020 -0300

    GladeWindow: use VCS version in development series
    
    Closes issue #472 "gnome-nightly: About dialog should display git commit rev"

 src/glade-window.c | 8 ++++++--
 src/main.c         | 7 ++++++-
 src/meson.build    | 2 ++
 src/version.h.in   | 1 +
 4 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/glade-window.c b/src/glade-window.c
index c4b8145f..c71e56d8 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -26,6 +26,7 @@
 
 #include <config.h>
 
+#include "version.h"
 #include "glade-window.h"
 #include "glade-resources.h"
 #include "glade-preferences.h"
@@ -1456,8 +1457,6 @@ on_about_action_activate (GSimpleAction *action,
   GladeWindow *window = data;
   GladeWindowPrivate *priv = window->priv;
 
-  gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (priv->about_dialog), PACKAGE_VERSION);
-
   gtk_window_present (priv->about_dialog);
 }
 
@@ -2105,6 +2104,11 @@ glade_window_init (GladeWindow *window)
   /* Add Gdk backend as a class */
   ctx = gtk_widget_get_style_context (GTK_WIDGET (window));
   gtk_style_context_add_class (ctx, glade_window_get_gdk_backend ());
+
+  /* Check if this is a development version */
+  if (GLADE_MINOR_VERSION % 2)
+    gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (priv->about_dialog),
+                                  VCS_VERSION);
 }
 
 static void
diff --git a/src/main.c b/src/main.c
index a5cc4fe6..c743e3d8 100644
--- a/src/main.c
+++ b/src/main.c
@@ -23,6 +23,7 @@
 
 #include <config.h>
 
+#include "version.h"
 #include "glade-window.h"
 #include "glade-resources.h"
 
@@ -67,7 +68,11 @@ handle_local_options (GApplication *application,
   if (version != FALSE)
     {
       /* Print version information and exit */
-      g_print ("%s\n", PACKAGE_STRING);
+      if (GLADE_MINOR_VERSION % 2)
+        g_print (PACKAGE_NAME" "VCS_VERSION"\n");
+      else
+        g_print (PACKAGE_STRING"\n");
+
       return 0;
     }
 
diff --git a/src/meson.build b/src/meson.build
index e1d3c779..0b30027c 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,3 +1,5 @@
+vcs_tag(input: 'version.h.in', output: 'version.h')
+
 sources = files(
   'glade-http.c',
   'glade-intro.c',
diff --git a/src/version.h.in b/src/version.h.in
new file mode 100644
index 00000000..ff534dbb
--- /dev/null
+++ b/src/version.h.in
@@ -0,0 +1 @@
+#define VCS_VERSION "@VCS_TAG@"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]