Adding support for building in both postmarketos and flatpak.

Neat trick with dlsym employed.
This commit is contained in:
sergiotarxz 2021-11-22 20:18:56 +01:00
parent 155d08ac4c
commit 07537a71f1
2 changed files with 18 additions and 4 deletions

View File

@ -29,9 +29,14 @@ sources = [
'src/main.c',
]
link_arguments = [
'-ldl'
]
executable('openmg',
sources,
dependencies : openmgdeps,
include_directories : inc,
install : true
install : true,
link_args : link_arguments
)

View File

@ -1,3 +1,5 @@
#include <dlfcn.h>
#include <gtk/gtk.h>
#include <adwaita.h>
@ -26,7 +28,14 @@ activate (AdwApplication *app,
GtkListView *list_view;
GtkWidget *scroll;
AdwLeaflet *views_leaflet = ADW_LEAFLET (adw_leaflet_new ());
adw_leaflet_set_can_swipe_back (views_leaflet, 1);
typedef void (*swipe_back_t)(AdwLeaflet *, gboolean);
swipe_back_t swipe_back = (swipe_back_t) dlsym
(NULL, "adw_leaflet_set_can_navigate_back");
if (!swipe_back) {
swipe_back = (swipe_back_t) dlsym
(NULL, "adw_leaflet_set_can_swipe_back");
}
swipe_back (views_leaflet, 1);
create_headerbar (box, views_leaflet);