diff options
author | Marvin W <git@larma.de> | 2022-03-30 10:36:07 -0600 |
---|---|---|
committer | Marvin W <git@larma.de> | 2022-03-30 10:36:07 -0600 |
commit | 339d1d8f557e88ef6bb5812980b8988dc8fdf10d (patch) | |
tree | bc5c509f7d3ed80cdc6bcb68a7a283dde6d73fba | |
parent | c5ed719b665938a59011913e39ce94df63690b40 (diff) | |
download | dino-339d1d8f557e88ef6bb5812980b8988dc8fdf10d.tar.gz dino-339d1d8f557e88ef6bb5812980b8988dc8fdf10d.zip |
Fix Version handling, add function to retrieve short version without git commit
-rw-r--r-- | libdino/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libdino/src/application.vala | 6 | ||||
-rw-r--r-- | main/CMakeLists.txt | 2 | ||||
-rw-r--r-- | main/src/ui/application.vala | 4 |
4 files changed, 10 insertions, 4 deletions
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt index ce836f62..20f5ffee 100644 --- a/libdino/CMakeLists.txt +++ b/libdino/CMakeLists.txt @@ -89,7 +89,7 @@ DEPENDS ${CMAKE_BINARY_DIR}/exports/dino_i18n.h ) -add_definitions(${VALA_CFLAGS} -DDINO_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}" -DG_LOG_DOMAIN="libdino") +add_definitions(${VALA_CFLAGS} -DDINO_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}" -DG_LOG_DOMAIN="libdino" -DDINO_VERSION=\"${PROJECT_VERSION}\") add_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h) add_dependencies(libdino dino-vapi) target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m) diff --git a/libdino/src/application.vala b/libdino/src/application.vala index f381c21d..9b36dd79 100644 --- a/libdino/src/application.vala +++ b/libdino/src/application.vala @@ -1,7 +1,13 @@ using Dino.Entities; namespace Dino { + extern const string VERSION; +public string get_version() { return VERSION; } +public string get_short_version() { + if (!VERSION.contains("~")) return VERSION; + return VERSION.split("~")[0] + "+"; +} public interface Application : GLib.Application { diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index e052785a..2326253c 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -212,7 +212,7 @@ OPTIONS ${MAIN_EXTRA_OPTIONS} ) -add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\" -DDINO_VERSION=\"${PROJECT_VERSION}\") +add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\") add_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET} src/emojichooser.c) add_dependencies(dino ${GETTEXT_PACKAGE}-translations) target_include_directories(dino PRIVATE src) diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 2fd5320e..6c02087f 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -42,7 +42,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { startup.connect(() => { if (print_version) { - print(@"Dino $(Dino.VERSION)\n"); + print(@"Dino $(Dino.get_version())\n"); Process.exit(0); } @@ -270,7 +270,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { } private void show_about_window() { - string? version = Dino.VERSION.strip().length == 0 ? null : Dino.VERSION; + string? version = Dino.get_version().strip().length == 0 ? null : Dino.get_version(); if (version != null && !version.contains("git")) { switch (version.substring(0, 3)) { case "0.2": version = @"$version - <span font_style='italic'>Mexican Caribbean Coral Reefs</span>"; break; |