Exemple #1
0
/** \todo Fix memory leak @ name_to_string:151 */
char *
name_to_string(Wht *W)
{
  char *buf, *tmp;
  size_t len;

  len = strlen(W->rule->name) + 1; 
  buf = i_malloc(sizeof(char) * len);
  snprintf(buf, len, "%s", W->rule->name);

  if (W->rule != NULL && W->rule->n > 0) {
    tmp  = params_to_string(W);
    len += strlen(tmp) + 3; /* ( .. ) \0 */
    buf  = realloc(buf, sizeof(char) * len);
    strncat(buf,"(",1);
    strncat(buf, tmp, strlen(tmp) + 1);
    strncat(buf,")",1);

    i_free(tmp);
  }

  if (W->children == NULL) {
    tmp  = i_itoa(W->n);
    len += strlen(tmp) + 3; /* ( .. ) \0 */
    buf  = realloc(buf, sizeof(char) * len);
    strncat(buf,"[",1);
    strncat(buf, tmp, strlen(tmp) + 1);
    strncat(buf,"]",1);

    i_free(tmp);
  }

  return buf;
}
/*
 * _gdaui_provider_spec_editor_get_specs
 * @spec: a #GdauiProviderSpecEditor widget
 *
 * Get the currently displayed provider's specific
 * connection string
 *
 * Returns: a new string, or %NULL if no provider have been specified
 */
gchar *
_gdaui_provider_spec_editor_get_specs (GdauiProviderSpecEditor *spec)
{
	g_return_val_if_fail (GDAUI_IS_PROVIDER_SPEC_EDITOR (spec), NULL);
	g_return_val_if_fail (spec->priv, NULL);

	switch (spec->priv->type) {
	case PROVIDER_FORM:
		return params_to_string (spec);
	default:
		return NULL;
	}
}
/*
 * _gdaui_provider_auth_editor_get_auths
 * @auth: a #GdauiProviderAuthEditor widget
 *
 * Get the currently displayed provider's authific
 * connection string
 *
 * Returns: a new string, or %NULL if no provider have been set, or no authentication is necessary
 */
gchar *
_gdaui_provider_auth_editor_get_auth (GdauiProviderAuthEditor *auth)
{
	g_return_val_if_fail (GDAUI_IS_PROVIDER_AUTH_EDITOR (auth), NULL);
	g_return_val_if_fail (auth->priv, NULL);

	if (!auth->priv->pinfo)
		return NULL;

	if (auth->priv->auth_needed) {
		g_assert (auth->priv->auth_widget);
		return params_to_string (auth);
	}
	else
		return NULL;
}