[libgda] Misc corrections



commit cc058a081936a8036f4cfe6a876164581df8c3bd
Author: Vivien Malerba <malerba gnome-db org>
Date:   Sun Jun 20 23:16:16 2010 +0200

    Misc corrections

 libgda-ui/gdaui-data-store.c       |   14 ++++----------
 libgda-ui/gdaui-server-operation.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/libgda-ui/gdaui-data-store.c b/libgda-ui/gdaui-data-store.c
index b0b0508..4dd6934 100644
--- a/libgda-ui/gdaui-data-store.c
+++ b/libgda-ui/gdaui-data-store.c
@@ -163,12 +163,9 @@ row_inserted_cb (GdaDataProxy *proxy, gint row, GtkTreeModel *store)
 	((GdauiDataStore*) store)->priv->stamp = g_random_int ();
 	path = gtk_tree_path_new ();
         gtk_tree_path_append_index (path, row);
-	if (gtk_tree_model_get_iter (store, &iter, path)) {
+	if (gtk_tree_model_get_iter (store, &iter, path))
 		gtk_tree_model_row_inserted (store, path, &iter);
-		gtk_tree_path_free (path);
-	}
-	else
-		g_warning ("OOh0");
+	gtk_tree_path_free (path);
 }
 
 static void
@@ -180,12 +177,9 @@ row_updated_cb (GdaDataProxy *proxy, gint row, GtkTreeModel *store)
 	((GdauiDataStore*) store)->priv->stamp = g_random_int ();
 	path = gtk_tree_path_new ();
         gtk_tree_path_append_index (path, row);
-	if (gtk_tree_model_get_iter (store, &iter, path)) {
+	if (gtk_tree_model_get_iter (store, &iter, path))
 		gtk_tree_model_row_changed (store, path, &iter);
-		gtk_tree_path_free (path);
-	}
-	else
-		g_warning ("OOh1");
+	gtk_tree_path_free (path);
 }
 
 static void
diff --git a/libgda-ui/gdaui-server-operation.c b/libgda-ui/gdaui-server-operation.c
index 80de97d..e27faa7 100644
--- a/libgda-ui/gdaui-server-operation.c
+++ b/libgda-ui/gdaui-server-operation.c
@@ -1149,6 +1149,7 @@ gdaui_server_operation_new_in_dialog (GdaServerOperation *op, GtkWindow *parent,
  */
 static void create_table_grid_fields_iter_row_changed_cb (GdaDataModelIter *grid_iter, gint row,
 							  GdaDataModelIter *form_iter);
+static void create_table_proxy_row_inserted_cb (GdaDataProxy *proxy, gint row, GdauiServerOperation *form);
 static GtkWidget *
 create_table_fields_array_create_widget (GdauiServerOperation *form, const gchar *path,
 					 gchar **section_str, GSList **label_widgets)
@@ -1179,6 +1180,8 @@ create_table_fields_array_create_widget (GdauiServerOperation *form, const gchar
 	gdaui_data_proxy_set_write_mode (GDAUI_DATA_PROXY (form_props),
 					 GDAUI_DATA_PROXY_WRITE_ON_VALUE_CHANGE);
 	gtk_box_pack_start (GTK_BOX (box), form_props, TRUE, TRUE, 0);
+	g_signal_connect (proxy, "row-inserted",
+			  G_CALLBACK (create_table_proxy_row_inserted_cb), form);
 
 	gtk_widget_show_all (box);
 
@@ -1256,3 +1259,28 @@ create_table_grid_fields_iter_row_changed_cb (GdaDataModelIter *iter1, gint row,
 	g_signal_handlers_unblock_by_func (G_OBJECT (iter2),
 					   G_CALLBACK (create_table_grid_fields_iter_row_changed_cb), iter1);
 }
+
+static void
+create_table_proxy_row_inserted_cb (GdaDataProxy *proxy, gint row, GdauiServerOperation *form)
+{
+	GdaDataModelIter *iter;
+	GdaHolder *holder;
+	GdaServerProvider *prov;
+	GdaConnection *cnc;
+	gchar *type = NULL;
+
+	iter = gda_data_model_create_iter (GDA_DATA_MODEL (proxy));
+	gda_data_model_iter_move_to_row (iter, row);
+	holder = gda_set_get_nth_holder (GDA_SET (iter), 0);
+	gda_holder_set_value_str (holder, NULL, "fieldname", NULL);
+
+	g_object_get (form->priv->op, "connection", &cnc, "provider", &prov, NULL);
+	if (prov)
+		type = gda_server_provider_get_default_dbms_type (prov, cnc, G_TYPE_STRING);
+	holder = gda_set_get_nth_holder (GDA_SET (iter), 1);
+	gda_holder_set_value_str (holder, NULL, type ? type : "varchar", NULL);
+	if (cnc)
+		g_object_unref (cnc);
+	if (prov)
+		g_object_unref (prov);
+}



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