Skip to content

Commit

Permalink
Fix build with using glib<2.63.1
Browse files Browse the repository at this point in the history
Add GLIB_CHECK_VERSION to verify if we really can use the
g_warning_once and avoid the undefined reference to
g_warning_once link error.
  • Loading branch information
psaavedra committed Nov 7, 2023
1 parent 23e5bb3 commit 0c3c7d2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/cog-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,19 @@ cog_platform_init_web_view (CogPlatform *platform,
CogPlatformClass *klass = COG_PLATFORM_GET_CLASS(platform);
if (klass->init_web_view) {
if (klass->get_view_type) {
#if GLIB_CHECK_VERSION(2, 63, 1)
g_warning_once("%s: class %s defines both .get_view_type and .init_web_view, "
"the latter should be removed.",
G_STRFUNC, G_OBJECT_CLASS_NAME(platform));
#else
static bool warned = false;
if (!warned) {
warned = true;
g_warning("%s: class %s defines both .get_view_type and .init_web_view, "
"the latter should be removed.",
G_STRFUNC, G_OBJECT_CLASS_NAME(platform));
}
#endif
return;
}

Expand Down

0 comments on commit 0c3c7d2

Please sign in to comment.