[gnome-photos] Mention the latest commit in the version for non-release builds



commit eac6711f1284e9d6c2b767b5d597aac39873e50b
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Mar 13 23:22:54 2017 +0100

    Mention the latest commit in the version for non-release builds
    
    Now that we are shipping nightly Flatpaks, it is important to know
    the latest commit ID that is part of the build. Otherwise, it will be
    hard to separate one nightly Flatpak from another.

 configure.ac             |    6 ++++++
 src/photos-application.c |    5 ++++-
 src/photos-main-window.c |    6 +++++-
 src/photos-utils.c       |   15 +++++++++++++++
 src/photos-utils.h       |    2 ++
 5 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e44514c..98da994 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,12 @@ AX_IS_RELEASE([git-directory])
 AX_CHECK_ENABLE_DEBUG([yes],,, [$ax_is_release])
 AX_COMPILER_FLAGS([WARN_CFLAGS], [WARN_LDFLAGS], [$ax_is_release])
 
+AS_IF([test "x$ax_is_release" != "xyes"], [PACKAGE_COMMIT_ID=$(git describe)])
+AS_IF([test -n "$PACKAGE_COMMIT_ID"],
+      [AC_DEFINE_UNQUOTED([PACKAGE_COMMIT_ID],
+                          ["$PACKAGE_COMMIT_ID"],
+                          [Define to the description of this package's latest commit.])])
+
 AC_CANONICAL_HOST
 AC_PROG_CC
 AC_PROG_CC_C_O
diff --git a/src/photos-application.c b/src/photos-application.c
index 5d74c3a..a798d7c 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -1610,7 +1610,10 @@ photos_application_handle_local_options (GApplication *application, GVariantDict
 
   if (g_variant_dict_contains (options, "version"))
     {
-      g_print ("%s %s\n", PACKAGE_TARNAME, PACKAGE_VERSION);
+      const gchar *version;
+
+      version = photos_utils_get_version ();
+      g_print ("%s %s\n", PACKAGE_TARNAME, version);
       ret_val = EXIT_SUCCESS;
     }
 
diff --git a/src/photos-main-window.c b/src/photos-main-window.c
index 6f06260..66a3c13 100644
--- a/src/photos-main-window.c
+++ b/src/photos-main-window.c
@@ -36,6 +36,7 @@
 #include "photos-preview-view.h"
 #include "photos-search-context.h"
 #include "photos-selection-controller.h"
+#include "photos-utils.h"
 
 
 struct _PhotosMainWindow
@@ -481,10 +482,13 @@ photos_main_window_show_about (PhotosMainWindow *self)
 {
   GApplication *app;
   const gchar *app_id;
+  const gchar *version;
 
   app = g_application_get_default ();
   app_id = g_application_get_application_id (app);
 
+  version = photos_utils_get_version ();
+
   gtk_show_about_dialog (GTK_WINDOW (self),
                          "artists", PHOTOS_ARTISTS,
                          "authors", PHOTOS_AUTHORS,
@@ -495,7 +499,7 @@ photos_main_window_show_about (PhotosMainWindow *self)
                          "license-type", GTK_LICENSE_GPL_2_0,
                          "logo-icon-name", app_id,
                          "program-name", _(PACKAGE_NAME),
-                         "version", PACKAGE_VERSION,
+                         "version", version,
                          "website", PACKAGE_URL,
                          "wrap-license", TRUE,
                          /* Translators: Put your names here */
diff --git a/src/photos-utils.c b/src/photos-utils.c
index bd05cfb..17d6a8d 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -1139,6 +1139,21 @@ photos_utils_get_urns_from_items (GList *items)
 }
 
 
+const gchar *
+photos_utils_get_version (void)
+{
+  const gchar *ret_val = NULL;
+
+#ifdef PACKAGE_COMMIT_ID
+  ret_val = PACKAGE_COMMIT_ID;
+#else
+  ret_val = PACKAGE_VERSION;
+#endif
+
+  return ret_val;
+}
+
+
 GIcon *
 photos_utils_icon_from_rdf_type (const gchar *type)
 {
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 7ef2f2b..f1da60a 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -147,6 +147,8 @@ gchar           *photos_utils_get_thumbnail_path_for_uri  (const gchar *uri);
 
 GList           *photos_utils_get_urns_from_items         (GList *items);
 
+const gchar     *photos_utils_get_version                 (void);
+
 GIcon           *photos_utils_icon_from_rdf_type          (const gchar *type);
 
 void             photos_utils_list_box_header_func        (GtkListBoxRow *row,


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