Fix Version handling, add function to retrieve short version without git commit
This commit is contained in:
parent
48404edf47
commit
9646630e1e
|
@ -89,7 +89,7 @@ DEPENDS
|
||||||
${CMAKE_BINARY_DIR}/exports/dino_i18n.h
|
${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_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
|
||||||
add_dependencies(libdino dino-vapi)
|
add_dependencies(libdino dino-vapi)
|
||||||
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
|
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
using Dino.Entities;
|
using Dino.Entities;
|
||||||
|
|
||||||
namespace Dino {
|
namespace Dino {
|
||||||
|
|
||||||
extern const string VERSION;
|
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 {
|
public interface Application : GLib.Application {
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ OPTIONS
|
||||||
${MAIN_EXTRA_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_executable(dino ${MAIN_VALA_C} ${MAIN_GRESOURCES_TARGET} src/emojichooser.c)
|
||||||
add_dependencies(dino ${GETTEXT_PACKAGE}-translations)
|
add_dependencies(dino ${GETTEXT_PACKAGE}-translations)
|
||||||
target_include_directories(dino PRIVATE src)
|
target_include_directories(dino PRIVATE src)
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
|
|
||||||
startup.connect(() => {
|
startup.connect(() => {
|
||||||
if (print_version) {
|
if (print_version) {
|
||||||
print(@"Dino $(Dino.VERSION)\n");
|
print(@"Dino $(Dino.get_version())\n");
|
||||||
Process.exit(0);
|
Process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void show_about_window() {
|
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")) {
|
if (version != null && !version.contains("git")) {
|
||||||
switch (version.substring(0, 3)) {
|
switch (version.substring(0, 3)) {
|
||||||
case "0.2": version = @"$version - <span font_style='italic'>Mexican Caribbean Coral Reefs</span>"; break;
|
case "0.2": version = @"$version - <span font_style='italic'>Mexican Caribbean Coral Reefs</span>"; break;
|
||||||
|
|
Loading…
Reference in a new issue