ZakAudit
*zak_audit_new_with_datasources (GdaConnection *gda_connection, ...)
{
+
va_list ap;
ZakAudit *zak_audit = ZAK_AUDIT (g_object_new (zak_audit_get_type (), NULL));
+ va_start (ap, gda_connection);
+
+ if (!zak_audit_set_gda_connection_with_datasources (zak_audit, gda_connection, ap))
+ {
+ g_clear_object (&zak_audit);
+ }
+
+ return zak_audit;
+}
+
+/**
+ * zak_audit_new_from_string_with_datasources:
+ * @cnc_string: the connection string to the datasource that contains library's tables.
+ * @...: a #NULL terminated list of datasources to load.
+ *
+ * Returns: the newly #ZakAudit object.
+ */
+ZakAudit
+*zak_audit_new_from_string_with_datasources (const gchar *cnc_string, ...)
+{
+ va_list ap;
+
+ ZakAudit *zak_audit = ZAK_AUDIT (g_object_new (zak_audit_get_type (), NULL));
+
+ va_start (ap, cnc_string);
+
+ if (!zak_audit_set_cnc_string_with_datasources (zak_audit, cnc_string, ap))
+ {
+ g_clear_object (&zak_audit);
+ }
+
+ return zak_audit;
+}
+
+/**
+ * zak_audit_new:
+ * @gda_connection: a #GdaConnection object.
+ *
+ * Returns: the newly #ZakAudit object.
+ */
+ZakAudit
+*zak_audit_new (GdaConnection *gda_connection)
+{
+ return zak_audit_new_with_datasources (gda_connection, NULL);
+}
+
+/**
+ * zak_audit_new_from_string:
+ * @cnc_string: the connection string to the datasource that contains library's tables.
+ *
+ * Returns: the newly #ZakAudit object.
+ */
+ZakAudit
+*zak_audit_new_from_string (const gchar *cnc_string)
+{
+ return zak_audit_new_from_string_with_datasources (cnc_string, NULL);
+}
+
+gboolean
+zak_audit_set_gda_connection_with_datasources (ZakAudit *zak_audit, GdaConnection *gda_connection, ...)
+{
+ va_list ap;
+
+ g_return_val_if_fail (IS_ZAK_AUDIT (zak_audit), FALSE);
+
ZakAuditPrivate *priv = ZAK_AUDIT_GET_PRIVATE (zak_audit);
priv->gdaex = gdaex_new_from_connection (gda_connection);
{
/* TODO */
g_warning (_("Error creating GdaEx object."));
- return NULL;
+ return FALSE;
}
va_start (ap, gda_connection);
{
/* TODO */
g_warning (_("Error loading datasources."));
- return NULL;
+ return FALSE;
}
va_end (ap);
- return zak_audit;
+ return TRUE;
}
-/**
- * zak_audit_new_from_string_with_datasources:
- * @cnc_string: the connection string to the datasource that contains library's tables.
- * @...: a #NULL terminated list of datasources to load.
- *
- * Returns: the newly #ZakAudit object.
- */
-ZakAudit
-*zak_audit_new_from_string_with_datasources (const gchar *cnc_string, ...)
+gboolean
+zak_audit_set_gda_connection (ZakAudit *zak_audit, GdaConnection *gda_connection)
+{
+ return zak_audit_set_gda_connection_with_datasources (zak_audit, gda_connection, NULL);
+}
+
+gboolean
+zak_audit_set_cnc_string_with_datasources (ZakAudit *zak_audit, const gchar *cnc_string, ...)
{
va_list ap;
- ZakAudit *zak_audit = ZAK_AUDIT (g_object_new (zak_audit_get_type (), NULL));
+ g_return_val_if_fail (IS_ZAK_AUDIT (zak_audit), FALSE);
ZakAuditPrivate *priv = ZAK_AUDIT_GET_PRIVATE (zak_audit);
{
/* TODO */
g_warning (_("Error creating GdaEx object."));
- return NULL;
+ return FALSE;
}
va_start (ap, cnc_string);
{
/* TODO */
g_warning (_("Error loading datasources."));
- return NULL;
+ return FALSE;
}
va_end (ap);
- return zak_audit;
-}
-
-/**
- * zak_audit_new:
- * @gda_connection: a #GdaConnection object.
- *
- * Returns: the newly #ZakAudit object.
- */
-ZakAudit
-*zak_audit_new (GdaConnection *gda_connection)
-{
- return zak_audit_new_with_datasources (gda_connection, NULL);
+ return TRUE;
}
/**
- * zak_audit_new_from_string:
+ * zak_audit_set_cnc_string:
* @cnc_string: the connection string to the datasource that contains library's tables.
*
- * Returns: the newly #ZakAudit object.
+ * Returns: @TRUE on newly #ZakAudit object.
*/
-ZakAudit
-*zak_audit_new_from_string (const gchar *cnc_string)
+gboolean
+zak_audit_set_cnc_string (ZakAudit *zak_audit, const gchar *cnc_string)
{
- return zak_audit_new_from_string_with_datasources (cnc_string, NULL);
+ return zak_audit_set_cnc_string_with_datasources (zak_audit, cnc_string, NULL);
}
/**
gtk_init (&argc, &argv);
gdaex = gdaex_new ();
+ audit = g_object_new (TYPE_ZAK_AUDIT, NULL);
ctx = g_option_context_new ("");
g_option_context_add_main_entries (ctx, entries, "audit_test1");
g_option_context_add_group (ctx, gdaex_get_option_group (gdaex));
- //g_option_context_add_group (ctx, zak_audit_get_option_group (g_object_new (TYPE_ZAK_AUDIT, NULL)));
+ g_option_context_add_group (ctx, zak_audit_get_option_group (audit));
if (!g_option_context_parse (ctx, &argc, &argv, &error))
{
g_warning ("Errore nell'analisi della riga comandi: %s.",
return 0;
}
- audit = zak_audit_new_from_string_with_datasources (cnc_zakaudit, "audit_test1", NULL);
+ zak_audit_set_cnc_string_with_datasources (audit, cnc_zakaudit, "audit_test1", NULL);
if (audit == NULL)
{