summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-10-21 21:42:27 -0300
committerJuan Pablo Ugarte <juanpablougarte@gmail.com>2020-10-21 21:42:27 -0300
commit36b3c71fc42b56b8f1dfbd9d50e9da02afafe477 (patch)
treee558c46b3c2f50e5dce70faae8de036b226063c1
parentf855dae999b23594e9ae199ee78bdc4c38ca73c3 (diff)
downloadglade-36b3c71fc42b56b8f1dfbd9d50e9da02afafe477.tar.gz
GladeWindow: disable survey if there is no TLS support
Closses issue #371 "Glade user survey not working (TLS error)"
-rw-r--r--README.md3
-rw-r--r--meson.build15
-rw-r--r--src/glade-window.c7
3 files changed, 23 insertions, 2 deletions
diff --git a/README.md b/README.md
index e3ee9db9..b3b86971 100644
--- a/README.md
+++ b/README.md
@@ -49,6 +49,7 @@ Requirements
Optional dependencies:
+* glib-networking plugins for TLS support (Needed for survey)
* libwebkit2gtk-4.0 - For Webkit plugin
* python-gi - For Python plugin
* libgjs - For JavaScript plugin
@@ -59,7 +60,7 @@ Download sources from git and build using meson/ninja
sudo apt install gcc meson libgtk-3-dev libxml2-dev libgirepository1.0-dev xsltproc
# Optional dependencies
- sudo apt install libgjs-dev libwebkit2gtk-4.0-dev python-gi-dev
+ sudo apt install libgjs-dev libwebkit2gtk-4.0-dev python-gi-dev glib-networking
# Clone the source repository or download tarball
git clone https://gitlab.gnome.org/GNOME/glade.git
diff --git a/meson.build b/meson.build
index 32a9b4a2..fc4c4492 100644
--- a/meson.build
+++ b/meson.build
@@ -113,6 +113,7 @@ add_project_arguments(common_flags, language: 'c')
# Check required libraries
glib_dep = dependency('glib-2.0', version: '>= 2.64.0')
+gio_dep = dependency('gio-2.0', version: '>= 2.64.0')
gmodule_dep = dependency('gmodule-2.0')
gmodule_export_dep = dependency('gmodule-export-2.0')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.24.0')
@@ -214,6 +215,17 @@ meson.add_install_script(
glade_datadir,
)
+tls_backend_support_src = '''
+#include <stdio.h>
+#include <gio/gio.h>
+int main(int argc, char **argv)
+{
+ printf ("%s\n", g_tls_backend_supports_tls (g_tls_backend_get_default ()) ? "true" : "false");
+ return 0;
+}
+'''
+tls_backend_support = cc.run(tls_backend_support_src, dependencies: gio_dep).stdout()
+
output = '\nConfiguration:\n\n'
output += '\tCompiler: ' + cc.get_id() + '\n'
output += '\tSource code location: ' + source_root + '\n'
@@ -225,5 +237,6 @@ output += '\tGladeui Catalog: ' + enable_gladeui.to_string() + '\n'
output += '\tWebKit2GTK+ Catalog: ' + have_webkit2gtk.to_string() + '\n'
output += '\tIntrospection Data: ' + enable_introspection.to_string() + '\n\n'
output += '\tBuild Reference Manual: ' + enable_gtk_doc.to_string() + '\n'
-output += '\tBuild Manual Pages: ' + enable_man.to_string()
+output += '\tBuild Manual Pages: ' + enable_man.to_string() + '\n'
+output += '\tTLS backend support: ' + tls_backend_support
message(output)
diff --git a/src/glade-window.c b/src/glade-window.c
index c4b8145f..9fdbef1f 100644
--- a/src/glade-window.c
+++ b/src/glade-window.c
@@ -2497,6 +2497,13 @@ glade_window_registration_notify_user (GladeWindow *window)
g_return_if_fail (GLADE_IS_WINDOW (window));
priv = window->priv;
+ if (!g_tls_backend_supports_tls (g_tls_backend_get_default ()))
+ {
+ g_message ("No TLS support in GIO, Registration & User Survey disabled. (missing glib-networking package)");
+ actions_set_enabled (window, "registration", FALSE);
+ return;
+ }
+
g_object_get (priv->registration,
"completed", &completed,
"skip-reminder", &skip_reminder,