[libgda] GdauiRawGrid and GdauiRawForm code improvements



commit 866fa7d9bdb07bef500bcd8e193ad70a9a8357dc
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed May 16 15:19:24 2012 +0200

    GdauiRawGrid and GdauiRawForm code improvements

 libgda-ui/gdaui-raw-form.c |  275 ++++++++++++++++++++++----------------------
 libgda-ui/gdaui-raw-grid.c |  115 +++++++++----------
 2 files changed, 194 insertions(+), 196 deletions(-)
---
diff --git a/libgda-ui/gdaui-raw-form.c b/libgda-ui/gdaui-raw-form.c
index 5d2e6c6..eb0898d 100644
--- a/libgda-ui/gdaui-raw-form.c
+++ b/libgda-ui/gdaui-raw-form.c
@@ -74,7 +74,7 @@ static void              gdaui_raw_form_selector_set_column_visible (GdauiDataSe
 
 struct _GdauiRawFormPriv
 {
-	GdaDataModel               *model;
+	GdaDataModel               *data_model;
 	GdaDataProxy               *proxy; /* proxy for @model */
 	GdaDataModelIter           *iter;  /* proxy's iter */
 
@@ -271,7 +271,7 @@ gdaui_raw_form_init (GdauiRawForm *wid)
 	GtkAction *action;
 	wid->priv = g_new0 (GdauiRawFormPriv, 1);
 
-	wid->priv->model = NULL;
+	wid->priv->data_model = NULL;
 	wid->priv->proxy = NULL;
 	wid->priv->iter = NULL;
 	wid->priv->write_mode = GDAUI_DATA_PROXY_WRITE_ON_DEMAND;
@@ -318,6 +318,7 @@ gdaui_raw_form_new (GdaDataModel *model)
 	return GTK_WIDGET (obj);
 }
 
+static void gdaui_raw_form_clean (GdauiRawForm *form);
 static void
 gdaui_raw_form_dispose (GObject *object)
 {
@@ -328,35 +329,13 @@ gdaui_raw_form_dispose (GObject *object)
 	form = GDAUI_RAW_FORM (object);
 
 	if (form->priv) {
+		gdaui_raw_form_clean (form);
+
 		if (form->priv->filter)
 			gtk_widget_destroy (form->priv->filter);
 		if (form->priv->filter_window)
 			gtk_widget_destroy (form->priv->filter_window);
 
-		/* proxy's iterator */
-		if (form->priv->iter) {
-			g_signal_handlers_disconnect_by_func (form->priv->iter,
-							      G_CALLBACK (iter_row_changed_cb), form);
-			g_signal_handlers_disconnect_by_func (form->priv->iter,
-							      G_CALLBACK (iter_validate_set_cb), form);
-			g_object_unref (form->priv->iter);
-			form->priv->iter = NULL;
-		}
-
-		/* proxy */
-		if (form->priv->proxy) {
-			g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-							      G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
-			g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-							      G_CALLBACK (proxy_changed_cb), form);
-			g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-							      G_CALLBACK (proxy_reset_cb), form);
-			g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-							      G_CALLBACK (proxy_access_changed_cb), form);
-			g_object_unref (form->priv->proxy);
-			form->priv->proxy = NULL;
-		}
-
 		/* UI */
 		if (form->priv->actions_group)
 			g_object_unref (G_OBJECT (form->priv->actions_group));
@@ -370,21 +349,6 @@ gdaui_raw_form_dispose (GObject *object)
 	parent_class->dispose (object);
 }
 
-static gboolean
-proxy_reset_was_soft (GdauiRawForm *form, GdaDataModel *new_model)
-{
-	GdaDataModelIter *iter;
-	gboolean retval = FALSE;
-
-	if (!new_model || (new_model != (GdaDataModel*) form->priv->proxy))
-		return FALSE;
-
-	iter = gda_data_model_create_iter (new_model);
-	retval = ! _gdaui_utility_iter_differ (form->priv->iter, iter);
-	g_object_unref (iter);
-	return retval;
-}
-
 static void
 gdaui_raw_form_set_property (GObject *object,
 			     guint param_id,
@@ -392,104 +356,86 @@ gdaui_raw_form_set_property (GObject *object,
 			     GParamSpec *pspec)
 {
 	GdauiRawForm *form;
-	gpointer ptr;
 
         form = GDAUI_RAW_FORM (object);
         if (form->priv) {
                 switch (param_id) {
 		case PROP_MODEL: {
-			gboolean reset;
-
-			ptr = GDA_DATA_MODEL (g_value_get_object (value));
-			if (ptr)
-				g_return_if_fail (GDA_IS_DATA_MODEL (ptr));
-			reset = !proxy_reset_was_soft (form, (GdaDataModel*) ptr);
-
-			if (reset) {
-				if (form->priv->proxy) {
-					/* remove old data model settings */
-					g_signal_handlers_disconnect_by_func (form->priv->iter,
-									      G_CALLBACK (iter_row_changed_cb),
-									      form);
-					g_signal_handlers_disconnect_by_func (form->priv->iter,
-									      G_CALLBACK (iter_validate_set_cb),
-									      form);
-					g_object_unref (G_OBJECT (form->priv->iter));
-					form->priv->iter = NULL;
-
-					g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-									      G_CALLBACK (proxy_row_inserted_or_removed_cb),
-									      form);
-					g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-									      G_CALLBACK (proxy_changed_cb), form);
-					g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-									      G_CALLBACK (proxy_reset_cb), form);
-					g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
-									      G_CALLBACK (proxy_access_changed_cb), form);
-					g_object_unref (G_OBJECT (form->priv->proxy));
-					form->priv->proxy = NULL;
-					form->priv->model = NULL;
+			GdaDataModel *model = (GdaDataModel*) g_value_get_object (value);
+
+			if (model)
+				g_return_if_fail (GDA_IS_DATA_MODEL (model));
+			else
+				return;
+
+			if (form->priv->proxy) {
+				/* data model has been changed */
+				if (GDA_IS_DATA_PROXY (model)) {
+					/* clean all */
+					gdaui_raw_form_clean (form);
+					g_assert (!form->priv->proxy);
 				}
-				if (ptr) {
-					/* handle the data model */
-					if (GDA_IS_DATA_PROXY (ptr)) {
-						form->priv->proxy = (GdaDataProxy *) ptr;
-						g_object_ref (ptr);
-					}
-					else
-						form->priv->proxy = (GdaDataProxy *) gda_data_proxy_new ((GdaDataModel*) ptr);
-
-					form->priv->model = gda_data_proxy_get_proxied_model (form->priv->proxy);
-					form->priv->iter = gda_data_model_create_iter ((GdaDataModel *) form->priv->proxy);
-					gda_data_model_iter_move_to_row (form->priv->iter, 0);
-					
-					g_signal_connect (form->priv->iter, "validate-set",
-							  G_CALLBACK (iter_validate_set_cb), form);
-					g_signal_connect (form->priv->iter, "row-changed",
-							  G_CALLBACK (iter_row_changed_cb), form);
-					
-					g_signal_connect (G_OBJECT (form->priv->proxy), "row_inserted",
-							  G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
-					g_signal_connect (G_OBJECT (form->priv->proxy), "row_removed",
-							  G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
-					g_signal_connect (G_OBJECT (form->priv->proxy), "changed",
-							  G_CALLBACK (proxy_changed_cb), form);
-					g_signal_connect (G_OBJECT (form->priv->proxy), "reset",
-							  G_CALLBACK (proxy_reset_cb), form);
-					g_signal_connect (G_OBJECT (form->priv->proxy), "access-changed",
-							  G_CALLBACK (proxy_access_changed_cb), form);
-
-					/* we don't want chuncking */
-					g_object_set (object, "paramlist", form->priv->iter, NULL);
-					gda_data_proxy_set_sample_size (form->priv->proxy, 0);
-
-					/* handle invalid iterators' GdaHolder */
-					GSList *list;
-					for (list = GDA_SET (form->priv->iter)->holders; list; list = list->next) {
-						GtkWidget *entry;
-						entry = gdaui_basic_form_get_entry_widget (GDAUI_BASIC_FORM (form),
-											   (GdaHolder*) list->data);
-						if (entry)
-							gdaui_entry_shell_set_unknown ((GdauiEntryShell*) entry,
-										       !gda_holder_is_valid ((GdaHolder*) list->data));
-					}
-
-					/* actions */
-					if (gda_data_proxy_is_read_only (form->priv->proxy))
-						g_object_set ((GObject*) form, "show-actions", FALSE, NULL);
-					
-					/* data display update */
-					proxy_changed_cb (form->priv->proxy, form);					
+				else
+					g_object_set (G_OBJECT (form->priv->proxy), "model", model, NULL);
+			}
+
+			if (!form->priv->proxy) {
+				/* first time setting */
+				if (GDA_IS_DATA_PROXY (model))
+					form->priv->proxy = g_object_ref (G_OBJECT (model));
+				else
+					form->priv->proxy = GDA_DATA_PROXY (gda_data_proxy_new (model));
+				form->priv->data_model = gda_data_proxy_get_proxied_model (form->priv->proxy);
+				form->priv->iter = gda_data_model_create_iter (GDA_DATA_MODEL (form->priv->proxy));
+				gda_data_model_iter_move_to_row (form->priv->iter, 0);
+
+				g_signal_connect (form->priv->iter, "validate-set",
+						  G_CALLBACK (iter_validate_set_cb), form);
+				g_signal_connect (form->priv->iter, "row-changed",
+						  G_CALLBACK (iter_row_changed_cb), form);
+
+				g_signal_connect (G_OBJECT (form->priv->proxy), "row_inserted",
+						  G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
+				g_signal_connect (G_OBJECT (form->priv->proxy), "row_removed",
+						  G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
+				g_signal_connect (G_OBJECT (form->priv->proxy), "changed",
+						  G_CALLBACK (proxy_changed_cb), form);
+				g_signal_connect (G_OBJECT (form->priv->proxy), "reset",
+						  G_CALLBACK (proxy_reset_cb), form);
+				g_signal_connect (G_OBJECT (form->priv->proxy), "access-changed",
+						  G_CALLBACK (proxy_access_changed_cb), form);
+
+				g_object_set (object, "paramlist", form->priv->iter, NULL);
+
+				/* we don't want chuncking */
+				gda_data_proxy_set_sample_size (form->priv->proxy, 0);
+
+				/* handle invalid iterators' GdaHolder */
+				GSList *list;
+				for (list = GDA_SET (form->priv->iter)->holders; list; list = list->next) {
+					GtkWidget *entry;
+					entry = gdaui_basic_form_get_entry_widget (GDAUI_BASIC_FORM (form),
+										   (GdaHolder*) list->data);
+					if (entry)
+						gdaui_entry_shell_set_unknown ((GdauiEntryShell*) entry,
+									       !gda_holder_is_valid ((GdaHolder*) list->data));
 				}
-				if (form->priv->iter)
-					iter_row_changed_cb (form->priv->iter,
-							     gda_data_model_iter_get_row (form->priv->iter), form);
+
+				iter_row_changed_cb (form->priv->iter,
+						     gda_data_model_iter_get_row (form->priv->iter), form);
+
+				/* actions */
+				if (gda_data_proxy_is_read_only (form->priv->proxy))
+					g_object_set ((GObject*) form, "show-actions", FALSE, NULL);
+
+				/* data display update */
+				proxy_changed_cb (form->priv->proxy, form);
+
 				gdaui_raw_form_widget_set_write_mode ((GdauiDataProxy *) form,
 								      form->priv->write_mode);
+
+				g_signal_emit_by_name (object, "proxy-changed", form->priv->proxy);
 			}
-			else
-				gda_data_model_iter_move_to_row (form->priv->iter, 0);
-			g_signal_emit_by_name (object, "proxy-changed", form->priv->proxy);
 			break;
 		}
 		default:
@@ -511,7 +457,7 @@ gdaui_raw_form_get_property (GObject *object,
         if (form->priv) {
                 switch (param_id) {
 		case PROP_MODEL:
-			g_value_set_object(value, form->priv->model);
+			g_value_set_object(value, form->priv->data_model);
 		default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
 			break;
@@ -575,17 +521,72 @@ proxy_changed_cb (G_GNUC_UNUSED GdaDataProxy *proxy, GdauiRawForm *form)
 				  gda_data_model_get_n_rows (GDA_DATA_MODEL (form->priv->proxy)) == 0 ? FALSE : TRUE);
 }
 
+static gboolean
+model_reset_was_soft (GdauiRawForm *form, GdaDataModel *new_model)
+{
+	GdaDataModelIter *iter;
+	gboolean retval = FALSE;
+
+	if (!new_model)
+		return FALSE;
+	else if (new_model == (GdaDataModel*) form->priv->proxy)
+		return TRUE;
+	else if (!form->priv->iter)
+		return FALSE;
+
+	iter = gda_data_model_create_iter (new_model);
+	retval = ! _gdaui_utility_iter_differ (form->priv->iter, iter);
+	g_object_unref (iter);
+	return retval;
+}
+
+static void
+gdaui_raw_form_clean (GdauiRawForm *form)
+{
+	/* proxy's iterator */
+	if (form->priv->iter) {
+		g_signal_handlers_disconnect_by_func (form->priv->iter,
+						      G_CALLBACK (iter_row_changed_cb), form);
+		g_signal_handlers_disconnect_by_func (form->priv->iter,
+						      G_CALLBACK (iter_validate_set_cb), form);
+		g_object_unref (form->priv->iter);
+		form->priv->iter = NULL;
+	}
+
+	/* proxy */
+	if (form->priv->proxy) {
+		g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
+						      G_CALLBACK (proxy_row_inserted_or_removed_cb), form);
+		g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
+						      G_CALLBACK (proxy_changed_cb), form);
+		g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
+						      G_CALLBACK (proxy_reset_cb), form);
+		g_signal_handlers_disconnect_by_func (G_OBJECT (form->priv->proxy),
+						      G_CALLBACK (proxy_access_changed_cb), form);
+		g_object_unref (form->priv->proxy);
+		form->priv->proxy = NULL;
+	}
+}
+
 static void
 proxy_reset_cb (GdaDataProxy *proxy, GdauiRawForm *form)
 {
-	gint row;
-	row = gda_data_model_iter_get_row (form->priv->iter);
-	g_object_ref (G_OBJECT (proxy));
-	g_object_set (G_OBJECT (form), "model", proxy, NULL);
-	g_object_unref (G_OBJECT (proxy));
-	if (row >= 0)
-		gda_data_model_iter_move_to_row (form->priv->iter, row);
+	gint iter_row;
+	gboolean reset_soft;
+
+	iter_row = gda_data_model_iter_get_row (form->priv->iter);
+	reset_soft = model_reset_was_soft (form, gda_data_proxy_get_proxied_model (form->priv->proxy));
+
+	if (iter_row >= 0)
+		gda_data_model_iter_move_to_row (form->priv->iter, iter_row);
+	else
+		gda_data_model_iter_move_to_row (form->priv->iter, 0);
+
+	form->priv->data_model = gda_data_proxy_get_proxied_model (form->priv->proxy);
 	iter_row_changed_cb (form->priv->iter, gda_data_model_iter_get_row (form->priv->iter), form);
+
+	if (! reset_soft)
+		g_signal_emit_by_name (form, "proxy-changed", form->priv->proxy);
 }
 
 static void
diff --git a/libgda-ui/gdaui-raw-grid.c b/libgda-ui/gdaui-raw-grid.c
index 06d3714..5f8a3ff 100644
--- a/libgda-ui/gdaui-raw-grid.c
+++ b/libgda-ui/gdaui-raw-grid.c
@@ -48,7 +48,6 @@ static void gdaui_raw_grid_get_property (GObject *object,
 
 static void create_columns_data (GdauiRawGrid *grid);
 
-static void proxy_filter_changed_cb (GdaDataProxy *proxy, GdauiRawGrid *grid);
 static void proxy_sample_changed_cb (GdaDataProxy *proxy, gint sample_start, gint sample_end, GdauiRawGrid *grid);
 static void proxy_row_updated_cb (GdaDataProxy *proxy, gint proxy_row, GdauiRawGrid *grid);
 static void proxy_reset_pre_cb (GdaDataProxy *proxy, GdauiRawGrid *grid);
@@ -122,6 +121,7 @@ struct _GdauiRawGridPriv
 	GdaDataModelIter           *iter;        /* iterator for @store, used for its structure */
 	GdauiSet                   *iter_info;
 	gint                        iter_row;    /* @iter's last row in case of proxy reset */
+	gboolean                    reset_soft;  /* tells if proxy rest was "soft" */
 	GdauiDataStore             *store;       /* GtkTreeModel interface, using @proxy */
 	GdaDataProxy               *proxy;       /* proxy data model, proxying @data_model */
 
@@ -483,25 +483,6 @@ gdaui_raw_grid_dispose (GObject *object)
 	parent_class->dispose (object);
 }
 
-static gboolean
-model_reset_was_soft (GdauiRawGrid *grid, GdaDataModel *new_model)
-{
-	GdaDataModelIter *iter;
-	gboolean retval = FALSE;
-
-	if (!new_model)
-		return FALSE;
-	else if (new_model == (GdaDataModel*) grid->priv->proxy)
-		return TRUE;
-	else if (!grid->priv->iter)
-		return FALSE;
-
-	iter = gda_data_model_create_iter (new_model);
-	retval = ! _gdaui_utility_iter_differ (grid->priv->iter, iter);
-	g_object_unref (iter);
-	return retval;
-}
-
 static void
 gdaui_raw_grid_set_property (GObject *object,
 			     guint param_id,
@@ -514,39 +495,35 @@ gdaui_raw_grid_set_property (GObject *object,
         if (grid->priv) {
                 switch (param_id) {
 		case PROP_MODEL: {
-			gboolean reset;
-			GdaDataModel *model = GDA_DATA_MODEL (g_value_get_object (value));
-			GdkRectangle vis = {0, 0, 0, 0};
+			GdaDataModel *model = (GdaDataModel*) g_value_get_object (value);
 
 			if (model)
 				g_return_if_fail (GDA_IS_DATA_MODEL (model));
+			else
+				return;
 
-			reset = !model_reset_was_soft (grid, model);
-
-			if (gtk_widget_get_realized ((GtkWidget*) grid))
-				gtk_tree_view_get_visible_rect ((GtkTreeView*) grid, &vis);
-
-			if (reset)
-				gdaui_raw_grid_clean (grid);
-
-			if (grid->priv->store) {
-				g_object_unref (grid->priv->store);
-				grid->priv->store = NULL;
+			if (grid->priv->proxy) {
+				/* data model has been changed */
+				if (GDA_IS_DATA_PROXY (model)) {
+					/* clean all */
+					gdaui_raw_grid_clean (grid);
+					g_assert (!grid->priv->proxy);
+				}
+				else
+					g_object_set (G_OBJECT (grid->priv->proxy), "model", model, NULL);
 			}
 
-			if (!model)
-				return;
+			if (!grid->priv->proxy) {
+				/* first time setting */
+				if (GDA_IS_DATA_PROXY (model))
+					grid->priv->proxy = g_object_ref (G_OBJECT (model));
+				else
+					grid->priv->proxy = GDA_DATA_PROXY (gda_data_proxy_new (model));
 
-			if (reset) {
-				grid->priv->proxy = GDA_DATA_PROXY (gda_data_proxy_new (model));
 				g_signal_connect (grid->priv->proxy, "reset",
 						  G_CALLBACK (proxy_reset_pre_cb), grid);
-				grid->priv->store = GDAUI_DATA_STORE (gdaui_data_store_new ((GdaDataModel*) grid->priv->proxy));
 				grid->priv->data_model = gda_data_proxy_get_proxied_model (grid->priv->proxy);
 
-				g_object_ref (G_OBJECT (grid->priv->proxy));
-				g_signal_connect (grid->priv->proxy, "filter-changed",
-						  G_CALLBACK (proxy_filter_changed_cb), grid);
 				g_signal_connect (grid->priv->proxy, "sample-changed",
 						  G_CALLBACK (proxy_sample_changed_cb), grid);
 				g_signal_connect (grid->priv->proxy, "row-updated",
@@ -570,23 +547,16 @@ gdaui_raw_grid_set_property (GObject *object,
 
 				gda_data_model_iter_invalidate_contents (grid->priv->iter);
 
+				grid->priv->store = GDAUI_DATA_STORE (gdaui_data_store_new ((GdaDataModel*) grid->priv->proxy));
 				gtk_tree_view_set_model ((GtkTreeView *) grid,
 							 GTK_TREE_MODEL (grid->priv->store));
+
 				create_columns_data (grid);
 				reset_columns_default (grid);
+
 				g_signal_emit_by_name (object, "proxy-changed", grid->priv->proxy);
 			}
-			else {
-				g_object_set (G_OBJECT (grid->priv->proxy), "model", model, NULL);
-				grid->priv->store = GDAUI_DATA_STORE (gdaui_data_store_new (model));
-				grid->priv->data_model = gda_data_proxy_get_proxied_model (grid->priv->proxy);
-				gda_data_model_iter_invalidate_contents (grid->priv->iter);
 
-				gtk_tree_view_set_model ((GtkTreeView *) grid,
-							 GTK_TREE_MODEL (grid->priv->store));
-			}
-			if (gtk_widget_get_realized ((GtkWidget*) grid))
-				gtk_tree_view_scroll_to_point ((GtkTreeView*) grid, vis.x, vis.y);
 			break;
 		}
 
@@ -2569,7 +2539,7 @@ tree_view_selection_changed_cb (GtkTreeSelection *selection, GdauiRawGrid *grid)
 {
 	GtkTreeIter iter;
 	GtkTreeModel *model;
-	gint has_selection;
+	gint has_selection = 0;
 
 	/* block the GdaDataModelIter' "changed" signal */
 	g_signal_handlers_block_by_func (grid->priv->iter,
@@ -3029,12 +2999,6 @@ iter_row_changed_cb (G_GNUC_UNUSED GdaDataModelIter *iter, gint row, GdauiRawGri
 }
 
 static void
-proxy_filter_changed_cb (GdaDataProxy *proxy, GdauiRawGrid *grid)
-{
-	
-}
-
-static void
 proxy_sample_changed_cb (G_GNUC_UNUSED GdaDataProxy *proxy, G_GNUC_UNUSED gint sample_start,
 			 G_GNUC_UNUSED gint sample_end, GdauiRawGrid *grid)
 {
@@ -3075,18 +3039,51 @@ proxy_row_updated_cb (GdaDataProxy *proxy, gint proxy_row, GdauiRawGrid *grid)
 	}
 }
 
+static gboolean
+model_reset_was_soft (GdauiRawGrid *grid, GdaDataModel *new_model)
+{
+	GdaDataModelIter *iter;
+	gboolean retval = FALSE;
+
+	if (!new_model)
+		return FALSE;
+	else if (new_model == (GdaDataModel*) grid->priv->proxy)
+		return TRUE;
+	else if (!grid->priv->iter)
+		return FALSE;
+
+	iter = gda_data_model_create_iter (new_model);
+	retval = ! _gdaui_utility_iter_differ (grid->priv->iter, iter);
+	g_object_unref (iter);
+	return retval;
+}
+
 static void
 proxy_reset_pre_cb (GdaDataProxy *proxy, GdauiRawGrid *grid)
 {
 	grid->priv->iter_row = gda_data_model_iter_get_row (grid->priv->iter);
+	grid->priv->reset_soft = model_reset_was_soft (grid, gda_data_proxy_get_proxied_model (grid->priv->proxy));
 }
 
 static void
 proxy_reset_cb (GdaDataProxy *proxy, GdauiRawGrid *grid)
 {
+	GdkRectangle vis = {0, 0, 0, 0};
+	if (gtk_widget_get_realized ((GtkWidget*) grid))
+				gtk_tree_view_get_visible_rect ((GtkTreeView*) grid, &vis);
+
 	if (grid->priv->iter_row >= 0)
 		gda_data_model_iter_move_to_row (grid->priv->iter, grid->priv->iter_row);
+	else
+		gda_data_model_iter_invalidate_contents (grid->priv->iter);
 	grid->priv->iter_row = -1;
+	grid->priv->data_model = gda_data_proxy_get_proxied_model (grid->priv->proxy);
+
+	if (! grid->priv->reset_soft)
+		g_signal_emit_by_name (grid, "proxy-changed", grid->priv->proxy);
+
+	if (gtk_widget_get_realized ((GtkWidget*) grid))
+		gtk_tree_view_scroll_to_point ((GtkTreeView*) grid, vis.x, vis.y);
 }
 
 static void



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