Skip to content

Commit 13f55ff

Browse files
Fix build with pygobject-3.50+ (#711)
1 parent 728645a commit 13f55ff

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

debian/control

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Build-Depends: debhelper-compat (= 12),
1717
libx11-dev,
1818
libxml2-dev,
1919
python3,
20+
python-gi-dev,
2021
yelp-tools,
2122
meson
2223
Standards-Version: 4.5.0

meson.build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ pango = dependency('pango')
4040

4141
if gir_dep.found()
4242
xed_conf.set('ENABLE_INTROSPECTION', 1)
43+
pygobject_dep = dependency('pygobject-3.0')
44+
pygobject_version = pygobject_dep.version().split('.')
45+
xed_conf.set('PYGOBJECT_MAJOR_VERSION', pygobject_version[0])
46+
xed_conf.set('PYGOBJECT_MINOR_VERSION', pygobject_version[1])
4347
endif
4448

4549
enable_spell = get_option('enable_spell')

xed/xed-app.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@
3838
#include <gtksourceview/gtksource.h>
3939

4040
#ifdef ENABLE_INTROSPECTION
41+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
42+
#include <girepository/girepository.h>
43+
#else
4144
#include <girepository.h>
4245
#endif
46+
#endif
4347

4448
#include "xed-app.h"
4549
#include "xed-commands.h"
@@ -992,7 +996,11 @@ xed_app_init (XedApp *app)
992996
g_application_add_main_option_entries (G_APPLICATION (app), options);
993997

994998
#ifdef ENABLE_INTROSPECTION
999+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
1000+
g_application_add_option_group (G_APPLICATION (app), gi_repository_get_option_group ());
1001+
#else
9951002
g_application_add_option_group (G_APPLICATION (app), g_irepository_get_option_group ());
1003+
#endif
9961004
#endif
9971005

9981006
setup_actions (app);

xed/xed-plugins-engine.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@
3131
#include <config.h>
3232
#include <string.h>
3333
#include <glib/gi18n.h>
34+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
35+
#include <girepository/girepository.h>
36+
#else
3437
#include <girepository.h>
38+
#endif
3539

3640
#include "xed-plugins-engine.h"
3741
#include "xed-debug.h"
@@ -66,7 +70,11 @@ xed_plugins_engine_init (XedPluginsEngine *engine)
6670

6771
typelib_dir = g_build_filename (xed_dirs_get_xed_lib_dir (), "girepository-1.0", NULL);
6872

73+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
74+
if (!gi_repository_require_private (gi_repository_dup_default (), typelib_dir, "Xed", "1.0", 0, &error))
75+
#else
6976
if (!g_irepository_require_private (g_irepository_get_default (), typelib_dir, "Xed", "1.0", 0, &error))
77+
#endif
7078
{
7179
g_warning ("Could not load Xed repository: %s", error->message);
7280
g_error_free (error);
@@ -76,14 +84,22 @@ xed_plugins_engine_init (XedPluginsEngine *engine)
7684
g_free (typelib_dir);
7785

7886
/* This should be moved to libpeas */
87+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
88+
if (!gi_repository_require (gi_repository_dup_default (), "Peas", "1.0", 0, &error))
89+
#else
7990
if (!g_irepository_require (g_irepository_get_default (), "Peas", "1.0", 0, &error))
91+
#endif
8092
{
8193
g_warning ("Could not load Peas repository: %s", error->message);
8294
g_error_free (error);
8395
error = NULL;
8496
}
8597

98+
#if PYGOBJECT_MAJOR_VERSION > 3 || (PYGOBJECT_MAJOR_VERSION == 3 && PYGOBJECT_MINOR_VERSION > 50)
99+
if (!gi_repository_require (gi_repository_dup_default (), "PeasGtk", "1.0", 0, &error))
100+
#else
86101
if (!g_irepository_require (g_irepository_get_default (), "PeasGtk", "1.0", 0, &error))
102+
#endif
87103
{
88104
g_warning ("Could not load PeasGtk repository: %s", error->message);
89105
g_error_free (error);

0 commit comments

Comments
 (0)