[gtranslator] Make API_URL configurable



commit c80a7c40771f74fdfab4d34ad7080749cc8e20cc
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Sat Mar 12 20:36:43 2022 +0100

    Make API_URL configurable

 meson.build            | 1 +
 meson_options.txt      | 6 ++++++
 src/gtr-actions-file.c | 2 --
 src/gtr-dl-teams.c     | 2 --
 4 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 2ffc5b99..b748afa8 100644
--- a/meson.build
+++ b/meson.build
@@ -64,6 +64,7 @@ set_defines = [
   ['PROFILE', get_option('profile')],
   # i18
   ['GETTEXT_PACKAGE', meson.project_name()],
+  ['API_URL', get_option('dl_endpoint')],
 ]
 
 foreach define: set_defines
diff --git a/meson_options.txt b/meson_options.txt
index 80f18fb6..8319aef7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,3 +8,9 @@ option (
   ],
   value: 'default'
 )
+option (
+  'dl_endpoint',
+  type: 'string',
+  value: 'https://l10n.gnome.org/api/v1/',
+  description: 'Damned lies API endpoint'
+)
diff --git a/src/gtr-actions-file.c b/src/gtr-actions-file.c
index da381213..866d8a5b 100644
--- a/src/gtr-actions-file.c
+++ b/src/gtr-actions-file.c
@@ -46,8 +46,6 @@
 #define GTR_TAB_SAVE_AS    "gtr-tab-save-as"
 #define GTR_IS_CLOSING_ALL "gtr-is-closing-all"
 
-#define API_URL "https://l10n.gnome.org/api/v1/";
-
 static void load_file_list (GtrWindow * window, const GSList * uris);
 static GList * get_modified_documents (GtrWindow * window);
 
diff --git a/src/gtr-dl-teams.c b/src/gtr-dl-teams.c
index 60d07925..aef10451 100644
--- a/src/gtr-dl-teams.c
+++ b/src/gtr-dl-teams.c
@@ -33,8 +33,6 @@
 
 #include <glib/gi18n.h>
 
-#define API_URL "https://l10n.gnome.org/api/v1/";
-
 typedef struct
 {
   GtkWidget *titlebar;


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