Esempio n. 1
0
/**
 * g_object_info_get_property:
 * @info: a #GIObjectInfo
 * @n: index of property to get
 *
 * Obtain an object type property at index @n.
 *
 * Returns: (transfer full): the #GIPropertyInfo. Free the struct by calling
 * g_base_info_unref() when done.
 */
GIPropertyInfo *
g_object_info_get_property (GIObjectInfo *info,
			    gint          n)
{
  gint offset;
  GIRealInfo *rinfo = (GIRealInfo *)info;
  Header *header;
  ObjectBlob *blob;

  g_return_val_if_fail (info != NULL, NULL);
  g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);

  header = (Header *)rinfo->typelib->data;
  blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];

  offset = g_object_info_get_field_offset(info, blob->n_fields)
    + n * header->property_blob_size;

  return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
					rinfo->typelib, offset);
}
/**
 * g_interface_info_get_property:
 * @info: a #GIInterfaceInfo
 * @n: index of property to get
 *
 * Obtain an interface type property at index @n.
 *
 * Returns: (transfer full): the #GIPropertyInfo. Free the struct by calling
 * g_base_info_unref() when done.
 */
GIPropertyInfo *
g_interface_info_get_property (GIInterfaceInfo *info,
                               gint            n)
{
    gint offset;
    GIRealInfo *rinfo = (GIRealInfo *)info;
    Header *header;
    InterfaceBlob *blob;

    g_return_val_if_fail (info != NULL, NULL);
    g_return_val_if_fail (GI_IS_INTERFACE_INFO (info), NULL);

    header = (Header *)rinfo->typelib->data;
    blob = (InterfaceBlob *)&rinfo->typelib->data[rinfo->offset];

    offset = rinfo->offset + header->interface_blob_size
             + (blob->n_prerequisites + (blob->n_prerequisites % 2)) * 2
             + n * header->property_blob_size;

    return (GIPropertyInfo *) g_info_new (GI_INFO_TYPE_PROPERTY, (GIBaseInfo*)info,
                                          rinfo->typelib, offset);
}
Esempio n. 3
0
/**
 * g_enum_info_get_method:
 * @info: a #GIEnumInfo
 * @n: index of method to get
 *
 * Obtain an enum type method at index @n.
 *
 * Returns: (transfer full): the #GIFunctionInfo. Free the struct by calling
 * g_base_info_unref() when done.
 *
 * Since: 1.29.17
 */
GIFunctionInfo *
g_enum_info_get_method (GIEnumInfo *info,
			gint        n)
{
  gint offset;
  GIRealInfo *rinfo = (GIRealInfo *)info;
  Header *header;
  EnumBlob *blob;

  g_return_val_if_fail (info != NULL, NULL);
  g_return_val_if_fail (GI_IS_ENUM_INFO (info), NULL);

  header = (Header *)rinfo->typelib->data;
  blob = (EnumBlob *)&rinfo->typelib->data[rinfo->offset];

  offset = rinfo->offset + header->enum_blob_size
    + blob->n_values * header->value_blob_size
    + n * header->function_blob_size;

  return (GIFunctionInfo *) g_info_new (GI_INFO_TYPE_FUNCTION, (GIBaseInfo*)info,
					rinfo->typelib, offset);
}
Esempio n. 4
0
/**
 * g_object_info_get_signal:
 * @info: a #GIObjectInfo
 * @n: index of signal to get
 *
 * Obtain an object type signal at index @n.
 *
 * Returns: (transfer full): the #GISignalInfo. Free the struct by calling
 * g_base_info_unref() when done.
 */
GISignalInfo *
g_object_info_get_signal (GIObjectInfo *info,
			  gint          n)
{
  gint offset;
  GIRealInfo *rinfo = (GIRealInfo *)info;
  Header *header;
  ObjectBlob *blob;

  g_return_val_if_fail (info != NULL, NULL);
  g_return_val_if_fail (GI_IS_OBJECT_INFO (info), NULL);

  header = (Header *)rinfo->typelib->data;
  blob = (ObjectBlob *)&rinfo->typelib->data[rinfo->offset];

  offset = g_object_info_get_field_offset(info, blob->n_fields)
    + blob->n_properties * header->property_blob_size
    + blob->n_methods * header->function_blob_size
    + n * header->signal_blob_size;

  return (GISignalInfo *) g_info_new (GI_INFO_TYPE_SIGNAL, (GIBaseInfo*)info,
				      rinfo->typelib, offset);
}