Skip to content

Commit ad5b290

Browse files
committed
gir_main plugin: add compatibility with girepository-2.0
fix #765
1 parent 7ec4234 commit ad5b290

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/plugin/gir_main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@
44
*
55
*/
66

7-
# include <girepository.h>
7+
// compatibility with girepository-1.0 and 2.0
8+
#if __has_include(<girepository.h>) // girepository-1.0
9+
#include <girepository.h>
10+
#define gi_repository_get_option_group g_irepository_get_option_group
11+
#else
12+
#include <girepository/girepository.h>
13+
#endif
814

915
# include "astroid_activatable.h"
1016

@@ -14,7 +20,7 @@ int main (int argc, char ** argv) {
1420
GError *error = NULL;
1521

1622
ctx = g_option_context_new (NULL);
17-
g_option_context_add_group (ctx, g_irepository_get_option_group ());
23+
g_option_context_add_group (ctx, gi_repository_get_option_group ());
1824

1925
if (!g_option_context_parse (ctx, &argc, &argv, &error)) {
2026
g_print ("astroid girmain: %s\n", error->message);

0 commit comments

Comments
 (0)