3434#include <glib/gi18n.h>
3535#include <glib.h>
3636#include <gio/gio.h>
37+
38+ #if USE_GIR20
39+ #include <girepository/girepository.h>
40+ #else
3741#include <girepository.h>
42+ #endif
3843
3944#define XVIEWER_PLUGIN_DATA_DIR XVIEWER_DATA_DIR G_DIR_SEPARATOR_S "plugins"
4045
@@ -86,6 +91,35 @@ xviewer_plugin_engine_new (void)
8691 GError * error = NULL ;
8792
8893 /* This should be moved to libpeas */
94+ #if USE_GIR20
95+ GIRepository * repo = gi_repository_dup_default ();
96+
97+ if (gi_repository_require (repo , "Peas" , "1.0" , 0 , & error ) == NULL )
98+ {
99+ g_warning ("Error loading Peas typelib: %s\n" ,
100+ error -> message );
101+ g_clear_error (& error );
102+ }
103+
104+ if (gi_repository_require (repo , "PeasGtk" , "1.0" , 0 , & error ) == NULL )
105+ {
106+ g_warning ("Error loading PeasGtk typelib: %s\n" ,
107+ error -> message );
108+ g_clear_error (& error );
109+ }
110+
111+ typelib_path = g_build_filename (LIBDIR , "xviewer" , "girepository-1.0" , NULL );
112+
113+ if (gi_repository_require_private (repo , typelib_path ,
114+ "Xviewer" , "3.0" , 0 , & error ) == NULL )
115+ {
116+ g_warning ("Error loading Xviewer typelib: %s\n" ,
117+ error -> message );
118+ g_clear_error (& error );
119+ }
120+
121+ g_object_unref (repo );
122+ #else
89123 if (g_irepository_require (g_irepository_get_default (),
90124 "Peas" , "1.0" , 0 , & error ) == NULL )
91125 {
@@ -112,6 +146,7 @@ xviewer_plugin_engine_new (void)
112146 error -> message );
113147 g_clear_error (& error );
114148 }
149+ #endif
115150
116151 engine = XVIEWER_PLUGIN_ENGINE (g_object_new (XVIEWER_TYPE_PLUGIN_ENGINE ,
117152 NULL ));
0 commit comments