>
<!ELEMENT widget-name (#PCDATA)>
+<!ELEMENT connection-name (#PCDATA)>
<!ELEMENT field (long-name?, to-load?, to-save?, obligatory?, default?, is-key?, auto-increment?, datetime-type?, display-format?, trim?, min-value?, max-value?, decimals?)>
child = xnode->children;
while (child != NULL)
{
- if (xmlStrcmp (child->name, (const xmlChar *)"connection_string") == 0)
+ if (xmlStrcmp (child->name, (const xmlChar *)"connection-string") == 0)
{
cnc_string = (gchar *)xmlNodeGetContent (child);
break;
{
parse_group (form, cur);
}
- else if (xmlStrcmp (cur->name, (const xmlChar *)"db_connection") == 0)
+ else if (xmlStrcmp (cur->name, (const xmlChar *)"db-connection") == 0)
{
parse_db_connection (form, cur);
}
return ret;
}
+/**
+ * gtk_form_add_db_connection:
+ * @form:
+ * @name:
+ * @gdaex:
+ *
+ */
+gboolean
+gtk_form_add_db_connection_gdaex (GtkForm *form, const gchar *name, GdaEx *gdaex)
+{
+ gboolean ret;
+ gchar *_name;
+ GSList *dbs;
+ GtkFormDbConnection *dbc;
+ GtkFormDbConnection *dbc_new;
+
+ g_return_val_if_fail (IS_GTK_FORM (form), FALSE);
+ g_return_val_if_fail (name != NULL, FALSE);
+ g_return_val_if_fail (IS_GDAEX (gdaex), FALSE);
+
+ _name = g_strstrip (g_strdup (name));
+
+ g_return_val_if_fail (g_strcmp0 (_name, "") != 0, FALSE);
+
+ GtkFormPrivate *priv = GTK_FORM_GET_PRIVATE (form);
+
+ ret = FALSE;
+
+ dbs = priv->db_connections;
+ while (dbs != NULL)
+ {
+ dbc = (GtkFormDbConnection *)dbs->data;
+ if (g_strcmp0 (dbc->name, _name) == 0)
+ {
+ dbc->gdaex = gdaex;
+ return TRUE;
+ }
+
+ dbs = dbs->next;
+ }
+
+ dbc_new = g_new0 (GtkFormDbConnection, 1);
+ dbc_new->name = g_strdup (_name);
+ dbc_new->cnc_string = g_strdup (gda_connection_get_cnc_string ((GdaConnection *)gdaex_get_gdaconnection (gdaex)));
+ dbc_new->gdaex = gdaex;
+
+ priv->db_connections = g_slist_append (priv->db_connections, dbc_new);
+
+ return TRUE;
+}
+
/**
* gtk_form_get_db_connection_by_name:
* @form:
GtkFormGroup *gtk_form_get_group_by_name (GtkForm *form, const gchar *group_name);
gboolean gtk_form_add_db_connection (GtkForm *form, const gchar *name, const gchar *connection_string);
+gboolean gtk_form_add_db_connection_gdaex (GtkForm *form, const gchar *name, GdaEx *gdaex);
GdaEx *gtk_form_get_db_connection_by_name (GtkForm *form, const gchar *name);
G_END_DECLS