From c50cbfa4baf0519c51d0e2a9ba0fefdf59ea3703 Mon Sep 17 00:00:00 2001 From: Leigh Scott Date: Wed, 26 Nov 2025 11:25:50 +0000 Subject: [PATCH] Fix build with pygobject-3.50+ --- debian/control | 1 + meson.build | 4 ++++ xed/xed-app.c | 8 ++++++++ xed/xed-plugins-engine.c | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/debian/control b/debian/control index c433a54d..55338c44 100644 --- a/debian/control +++ b/debian/control @@ -17,6 +17,7 @@ Build-Depends: debhelper-compat (= 12), libx11-dev, libxml2-dev, python3, + python-gi-dev, yelp-tools, meson Standards-Version: 4.5.0 diff --git a/meson.build b/meson.build index 0e9d53e4..fdd1747e 100644 --- a/meson.build +++ b/meson.build @@ -40,6 +40,10 @@ pango = dependency('pango') if gir_dep.found() xed_conf.set('ENABLE_INTROSPECTION', 1) + pygobject_dep = dependency('pygobject-3.0') + pygobject_version = pygobject_dep.version().split('.') + xed_conf.set('PYGOBJECT_MAJOR_VERSION', pygobject_version[0]) + xed_conf.set('PYGOBJECT_MINOR_VERSION', pygobject_version[1]) endif enable_spell = get_option('enable_spell') diff --git a/xed/xed-app.c b/xed/xed-app.c index 85809f2d..af7c19cf 100644 --- a/xed/xed-app.c +++ b/xed/xed-app.c @@ -38,8 +38,12 @@ #include #ifdef ENABLE_INTROSPECTION +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) +#include +#else #include #endif +#endif #include "xed-app.h" #include "xed-commands.h" @@ -992,7 +996,11 @@ xed_app_init (XedApp *app) g_application_add_main_option_entries (G_APPLICATION (app), options); #ifdef ENABLE_INTROSPECTION +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) + g_application_add_option_group (G_APPLICATION (app), gi_repository_get_option_group ()); +#else g_application_add_option_group (G_APPLICATION (app), g_irepository_get_option_group ()); +#endif #endif setup_actions (app); diff --git a/xed/xed-plugins-engine.c b/xed/xed-plugins-engine.c index 58dd5569..ca05a663 100644 --- a/xed/xed-plugins-engine.c +++ b/xed/xed-plugins-engine.c @@ -31,7 +31,11 @@ #include #include #include +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) +#include +#else #include +#endif #include "xed-plugins-engine.h" #include "xed-debug.h" @@ -66,7 +70,11 @@ xed_plugins_engine_init (XedPluginsEngine *engine) typelib_dir = g_build_filename (xed_dirs_get_xed_lib_dir (), "girepository-1.0", NULL); +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) + if (!gi_repository_require_private (gi_repository_dup_default (), typelib_dir, "Xed", "1.0", 0, &error)) +#else if (!g_irepository_require_private (g_irepository_get_default (), typelib_dir, "Xed", "1.0", 0, &error)) +#endif { g_warning ("Could not load Xed repository: %s", error->message); g_error_free (error); @@ -76,14 +84,22 @@ xed_plugins_engine_init (XedPluginsEngine *engine) g_free (typelib_dir); /* This should be moved to libpeas */ +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) + if (!gi_repository_require (gi_repository_dup_default (), "Peas", "1.0", 0, &error)) +#else if (!g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error)) +#endif { g_warning ("Could not load Peas repository: %s", error->message); g_error_free (error); error = NULL; } +#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50) + if (!gi_repository_require (gi_repository_dup_default (), "PeasGtk", "1.0", 0, &error)) +#else if (!g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error)) +#endif { g_warning ("Could not load PeasGtk repository: %s", error->message); g_error_free (error);