diff options
| author | lukefromdc <[email protected]> | 2026-01-19 22:23:16 -0500 |
|---|---|---|
| committer | Luke from DC <[email protected]> | 2026-01-20 19:45:10 +0000 |
| commit | 9e9b24cdeff07e6d8908ad3e4f74555c24521d2e (patch) | |
| tree | 5d1209c4e4135b6c366cc77f675dd8b029cb9fcf | |
| parent | 5db7d1d3d2cfe5c1869a88708c07b8a981f98786 (diff) | |
| download | eom-9e9b24cdeff07e6d8908ad3e4f74555c24521d2e.tar.bz2 eom-9e9b24cdeff07e6d8908ad3e4f74555c24521d2e.tar.xz | |
plugins: Support building against newer libpeas1 versions
This commit allows and requires building against libpeas1 versions that
contain the fix for gobject-introspection 1.80 or later
| -rw-r--r-- | configure.ac | 5 | ||||
| -rw-r--r-- | meson.build | 5 | ||||
| -rw-r--r-- | src/eom-plugin-engine.c | 20 | ||||
| -rw-r--r-- | src/main.c | 8 |
4 files changed, 38 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 62dc453..b2985a7 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,11 @@ GOBJECT_INTROSPECTION_CHECK([0.9.3]) if test "$found_introspection" = "yes"; then have_introspection=yes AC_DEFINE([HAVE_INTROSPECTION], [1], [Define to enable GObject Introspection]) + + # Check for girepository-2.0 API (moved to glib in version 1.80+) + PKG_CHECK_EXISTS([girepository-2.0], + [AC_DEFINE([HAVE_GIREPOSITORY_2], [1], [Using girepository-2.0 API])], + []) else have_introspection=no fi diff --git a/meson.build b/meson.build index 608e62b..b638676 100644 --- a/meson.build +++ b/meson.build @@ -177,6 +177,11 @@ endif # Enable GObject Introspection if gobject_introspection.found() conf.set('HAVE_INTROSPECTION', 1) + # Check for girepository-2.0 API (moved to glib in version 1.80+) + girepository2 = dependency('girepository-2.0', required: false) + if girepository2.found() + conf.set('HAVE_GIREPOSITORY_2', 1) + endif endif conf_file = configure_file(output : 'config.h', configuration : conf) diff --git a/src/eom-plugin-engine.c b/src/eom-plugin-engine.c index dc434f2..5b93de3 100644 --- a/src/eom-plugin-engine.c +++ b/src/eom-plugin-engine.c @@ -34,7 +34,11 @@ #include <glib/gi18n.h> #include <glib.h> #include <gio/gio.h> +#ifdef HAVE_GIREPOSITORY_2 +#include <girepository/girepository.h> +#else #include <girepository.h> +#endif #define USER_EOM_PLUGINS_LOCATION "plugins/" @@ -87,25 +91,41 @@ eom_plugin_engine_new (void) private_path = g_build_filename (LIBDIR, "girepository-1.0", NULL); /* This should be moved to libpeas */ +#ifdef HAVE_GIREPOSITORY_2 + if (gi_repository_require (gi_repository_dup_default (), + "Peas", "1.0", 0, &error) == NULL) +#else if (g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error) == NULL) +#endif { g_warning ("Error loading Peas typelib: %s\n", error->message); g_clear_error (&error); } +#ifdef HAVE_GIREPOSITORY_2 + if (gi_repository_require (gi_repository_dup_default (), + "PeasGtk", "1.0", 0, &error) == NULL) +#else if (g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error) == NULL) +#endif { g_warning ("Error loading PeasGtk typelib: %s\n", error->message); g_clear_error (&error); } +#ifdef HAVE_GIREPOSITORY_2 + if (gi_repository_require_private (gi_repository_dup_default (), + private_path, "Eom", "1.0", 0, + &error) == NULL) +#else if (g_irepository_require_private (g_irepository_get_default (), private_path, "Eom", "1.0", 0, &error) == NULL) +#endif { g_warning ("Error loading Eom typelib: %s\n", error->message); @@ -27,8 +27,12 @@ #include "config.h" #endif #ifdef HAVE_INTROSPECTION +#ifdef HAVE_GIREPOSITORY_2 +#include <girepository/girepository.h> +#else #include <girepository.h> #endif +#endif #include "eom-session.h" #include "eom-debug.h" @@ -116,8 +120,12 @@ main (int argc, char **argv) * Using gtk_get_option_group here initializes gtk during parsing */ g_option_context_add_group (ctx, gtk_get_option_group (TRUE)); #ifdef HAVE_INTROSPECTION +#ifdef HAVE_GIREPOSITORY_2 + g_option_context_add_group (ctx, gi_repository_get_option_group ()); +#else g_option_context_add_group (ctx, g_irepository_get_option_group ()); #endif +#endif if (!g_option_context_parse (ctx, &argc, &argv, &error)) { gchar *help_msg; |
