Skip to content
This repository has been archived by the owner on Jun 4, 2022. It is now read-only.

Commit

Permalink
Make libappstream and GCR3 optional.
Browse files Browse the repository at this point in the history
Though I'd heavily discourage dropping the latter, and I quite value the former.
  • Loading branch information
alcinnz committed May 27, 2019
1 parent db9fe9b commit 588dd6c
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 14 deletions.
3 changes: 2 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('nofts5', type: 'boolean', value: false)
option('appstream', type: 'boolean', value: true, description: 'Use appstream to recommend compatible apps')
option('gcr', type: 'boolean', value: true, description: 'Use GCR to show certificate details, HEAVILY RECOMMENDED')
9 changes: 9 additions & 0 deletions src/Services/Prosody/misc/AppStream.vala
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ And given I can link to app descriptions where they can be installed via simple
URLs, it looks quite trivial to write that UI in Prosody. The
challenging bit is getting at the data, which is what's done here. */
namespace Odysseus.Templating.xAppStream {
#if HAVE_APPSTREAM
using AppStream;

public class AppStreamBuilder : TagBuilder, Object {
Expand Down Expand Up @@ -61,6 +62,7 @@ namespace Odysseus.Templating.xAppStream {
}
}
}

private class AppStreamTag : Template {
private AppStream.Pool pool;
private Variable[] vars;
Expand Down Expand Up @@ -138,4 +140,11 @@ namespace Odysseus.Templating.xAppStream {
yield renderer.exec(data, output);
}
}
#else
public class AppStreamBuilder : TagBuilder, Object {
public Template? build(Parser parser, WordIter args) throws SyntaxError {
return null;
}
}
#endif
}
4 changes: 4 additions & 0 deletions src/Traits/status/https.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,18 @@ namespace Odysseus.Traits {
scrolled.add(list);
list.selection_mode = Gtk.SelectionMode.NONE;

#if HAVE_GCR3
// FIXME the commented out code hangs.
//for (var chain = cert; chain != null; chain = cert.get_issuer()) {
var gcr = new Gcr.SimpleCertificate (cert.certificate.data);
list.add(build_certificate_row(gcr));
//}
#endif

return ret;
}

#if HAVE_GCR3
private Gtk.Widget build_certificate_row(Gcr.Certificate cert) {
var ret = new Gtk.Grid();
ret.column_spacing = 10; ret.row_spacing = 10;
Expand All @@ -107,4 +110,5 @@ namespace Odysseus.Traits {
ret.halign = Gtk.Align.START;
return ret;
}
#endif
}
36 changes: 23 additions & 13 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,33 @@ endforeach
c_args = ['-DGCR_API_SUBJECT_TO_CHANGE', '-include', 'config.h']
posix_dep = meson.get_compiler('vala').find_library('posix')

dependencies = [
dependency('gtk+-3.0'),
dependency('granite'),
dependency('webkit2gtk-4.0'),
dependency('json-glib-1.0'),
dependency('gee-0.8'),
dependency('libsoup-2.4'),
dependency('sqlite3'),
posix_dep,
dependency('libxml-2.0'),
]
vala_args = []
if get_option('appstream')
dependencies += [dependency('appstream')]
vala_args += ['--define=HAVE_APPSTREAM']
endif
if get_option('gcr')
dependencies += [dependency('gcr-3')]
vala_args += ['--define=HAVE_GCR3']
endif

executable('com.github.alcinnz.odysseus',
source_files,

c_args: c_args,
link_args: ['-lm'],
dependencies: [
dependency('gtk+-3.0'),
dependency('granite'),
dependency('webkit2gtk-4.0'),
dependency('json-glib-1.0'),
dependency('gee-0.8'),
dependency('libsoup-2.4'),
dependency('sqlite3'),
dependency('appstream'),
posix_dep,
dependency('libxml-2.0'),
dependency('gcr-3')
],
vala_args: vala_args,
dependencies: dependencies,
install: true
)

0 comments on commit 588dd6c

Please sign in to comment.