Skip to content

Commit

Permalink
core: Warn on both get_view_type and init_web_view defined
Browse files Browse the repository at this point in the history
Emit a warning when trying to call cog_platform_init_web_view() in case
the platform in use defines both .get_view_type and .init_web_view,
because the latter shall not be defined when .get_view_type is in use.
  • Loading branch information
aperezdc committed Oct 26, 2023
1 parent 7bc113f commit e3efab0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/cog-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,16 @@ cog_platform_init_web_view (CogPlatform *platform,
g_return_if_fail(COG_IS_PLATFORM(platform));

CogPlatformClass *klass = COG_PLATFORM_GET_CLASS(platform);
if (klass->init_web_view)
if (klass->init_web_view) {
if (klass->get_view_type) {
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));
return;
}

klass->init_web_view(platform, view);
}
}

WebKitInputMethodContext *
Expand Down

0 comments on commit e3efab0

Please sign in to comment.