[gnome-db] New function to GdaXmlDatabase



Hi,

   I have added a new function (gda_xml_database_remove_table) to
GdaXmlDatabase object.

regards, apg.
Index: libgda/gda-xml-database.c
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-xml-database.c,v
retrieving revision 1.32
diff -u -r1.32 gda-xml-database.c
--- libgda/gda-xml-database.c	10 Feb 2005 11:54:47 -0000	1.32
+++ libgda/gda-xml-database.c	16 Feb 2005 16:54:50 -0000
@@ -803,3 +803,25 @@
 
 	return table;
 }
+
+gboolean
+gda_xml_database_remove_table (GdaXmlDatabase *xmldb, const gchar *name)
+{
+	GdaTable *table;
+	
+	g_return_val_if_fail (GDA_IS_XML_DATABASE (xmldb), FALSE);
+	g_return_val_if_fail (name != NULL, FALSE);
+
+	table = g_hash_table_lookup (xmldb->priv->tables, name);
+	if (table == NULL) {
+		gda_log_error (_("Table %s don't exists"), name);
+		return FALSE;
+	}
+
+	g_signal_handlers_disconnect_by_func (G_OBJECT (table), G_CALLBACK (table_changed_cb), xmldb);
+	g_signal_handlers_disconnect_by_func (G_OBJECT (table), G_CALLBACK (table_name_changed_cb), xmldb);
+	g_hash_table_remove (xmldb->priv->tables, name);
+	gda_xml_database_changed (xmldb);
+
+	return TRUE;
+}
Index: libgda/gda-xml-database.h
===================================================================
RCS file: /cvs/gnome/libgda/libgda/gda-xml-database.h,v
retrieving revision 1.12
diff -u -r1.12 gda-xml-database.h
--- libgda/gda-xml-database.h	18 Oct 2003 23:03:52 -0000	1.12
+++ libgda/gda-xml-database.h	16 Feb 2005 16:54:50 -0000
@@ -78,6 +78,8 @@
 						       gboolean add_data);
 GdaTable       *gda_xml_database_new_table_from_node (GdaXmlDatabase *xmldb,
 						      xmlNodePtr node);
+gboolean        gda_xml_database_remove_table (GdaXmlDatabase *xmldb,
+					       const gchar *name);
 
 G_END_DECLS
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]