+static gboolean
+credentials_native_type_check (GCredentialsType requested_type,
+ const char *op)
+{
+ GEnumClass *enum_class;
+ GEnumValue *requested;
+#if G_CREDENTIALS_SUPPORTED
+ GEnumValue *supported;
+#endif
+
+#if G_CREDENTIALS_SUPPORTED
+ if (requested_type == G_CREDENTIALS_NATIVE_TYPE)
+ return TRUE;
+#endif
+
+ enum_class = g_type_class_ref (g_credentials_type_get_type ());
+ requested = g_enum_get_value (enum_class, requested_type);
+
+#if G_CREDENTIALS_SUPPORTED
+ supported = g_enum_get_value (enum_class, G_CREDENTIALS_NATIVE_TYPE);
+ g_assert (supported);
+ g_warning ("g_credentials_%s_native: Trying to %s credentials of type %s "
+ "but only %s is supported on this platform.",
+ op, op,
+ requested ? requested->value_name : "(unknown)",
+ supported->value_name);
+#else
+ g_warning ("g_credentials_%s_native: Trying to %s credentials of type %s "
+ "but there is no support for GCredentials on this platform.",
+ op, op,
+ requested ? requested->value_name : "(unknown)");
+#endif
+
+ g_type_class_unref (enum_class);
+ return FALSE;
+}
+