[libgda] Misc. corrections
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Misc. corrections
- Date: Sun, 24 Jul 2011 16:38:00 +0000 (UTC)
commit 7ea543bc6a54e06899d2aec0bc89e093b86de866
Author: Vivien Malerba <malerba gnome-db org>
Date: Sun Jul 24 18:37:51 2011 +0200
Misc. corrections
libgda-ui/gdaui-data-proxy-info.c | 15 ++++++++++++++-
tools/browser/common/ui-formgrid.c | 17 +++++++----------
tools/browser/query-exec/query-result.c | 3 +--
3 files changed, 22 insertions(+), 13 deletions(-)
---
diff --git a/libgda-ui/gdaui-data-proxy-info.c b/libgda-ui/gdaui-data-proxy-info.c
index 022dd8a..05e4df4 100644
--- a/libgda-ui/gdaui-data-proxy-info.c
+++ b/libgda-ui/gdaui-data-proxy-info.c
@@ -47,6 +47,8 @@ static void data_proxy_proxy_changed_cb (GdauiDataProxy *data_proxy, GdaDataProx
static void proxy_changed_cb (GdaDataProxy *proxy, GdauiDataProxyInfo *info);
static void proxy_sample_changed_cb (GdaDataProxy *proxy, gint sample_start, gint sample_end, GdauiDataProxyInfo *info);
static void proxy_row_changed_cb (GdaDataProxy *proxy, gint row, GdauiDataProxyInfo *info);
+static void proxy_reset_cb (GdaDataProxy *wid, GdauiDataProxyInfo *info);
+
static void raw_grid_selection_changed_cb (GdauiRawGrid *grid, GdauiDataProxyInfo *info);
@@ -193,7 +195,6 @@ data_proxy_destroyed_cb (GdauiDataProxy *wid, GdauiDataProxyInfo *info)
info->priv->data_proxy = NULL;
}
-
static void
release_proxy (GdauiDataProxyInfo *info)
{
@@ -203,6 +204,8 @@ release_proxy (GdauiDataProxyInfo *info)
G_CALLBACK (proxy_sample_changed_cb), info);
g_signal_handlers_disconnect_by_func (G_OBJECT (info->priv->proxy),
G_CALLBACK (proxy_row_changed_cb), info);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (info->priv->proxy),
+ G_CALLBACK (proxy_reset_cb), info);
g_object_unref (info->priv->proxy);
info->priv->proxy = NULL;
}
@@ -310,6 +313,9 @@ gdaui_data_proxy_info_set_property (GObject *object,
G_CALLBACK (proxy_row_changed_cb), info);
g_signal_connect (G_OBJECT (proxy), "row-removed",
G_CALLBACK (proxy_row_changed_cb), info);
+ g_signal_connect (G_OBJECT (proxy), "reset",
+ G_CALLBACK (proxy_reset_cb), info);
+
/* iter */
iter = gdaui_data_selector_get_data_set (GDAUI_DATA_SELECTOR
@@ -384,6 +390,13 @@ proxy_row_changed_cb (G_GNUC_UNUSED GdaDataProxy *proxy, G_GNUC_UNUSED gint row,
}
static void
+proxy_reset_cb (G_GNUC_UNUSED GdaDataProxy *wid, GdauiDataProxyInfo *info)
+{
+ modif_buttons_make (info);
+ modif_buttons_update (info);
+}
+
+static void
iter_row_changed_cb (G_GNUC_UNUSED GdaDataModelIter *iter, G_GNUC_UNUSED gint row, GdauiDataProxyInfo *info)
{
modif_buttons_update (info);
diff --git a/tools/browser/common/ui-formgrid.c b/tools/browser/common/ui-formgrid.c
index 25aafa0..ef19a20 100644
--- a/tools/browser/common/ui-formgrid.c
+++ b/tools/browser/common/ui-formgrid.c
@@ -265,7 +265,7 @@ ui_formgrid_init (UiFormGrid *formgrid)
formgrid->priv = g_new0 (UiFormGridPriv, 1);
formgrid->priv->raw_grid = NULL;
formgrid->priv->info = NULL;
- formgrid->priv->flags = GDAUI_DATA_PROXY_INFO_CURRENT_ROW;
+ formgrid->priv->flags = GDAUI_DATA_PROXY_INFO_CURRENT_ROW | GDAUI_DATA_PROXY_INFO_ROW_MODIFY_BUTTONS;
formgrid->priv->bcnc = NULL;
formgrid->priv->autoupdate = TRUE;
formgrid->priv->autoupdate_possible = FALSE;
@@ -829,12 +829,6 @@ ui_formgrid_new (GdaDataModel *model, gboolean scroll_form, GdauiDataProxyInfoFl
formgrid = (UiFormGrid *) g_object_new (UI_TYPE_FORMGRID, "scroll-form", scroll_form, NULL);
formgrid->priv->flags = flags;
- compute_modification_statements (formgrid, model);
- if (formgrid->priv->mod_stmt [MOD_INSERT] ||
- formgrid->priv->mod_stmt [MOD_DELETE] ||
- formgrid->priv->mod_stmt [MOD_UPDATE])
- formgrid->priv->flags = formgrid->priv->flags | GDAUI_DATA_PROXY_INFO_ROW_MODIFY_BUTTONS;
-
/* a raw form and a raw grid for the same proxy */
g_object_set (formgrid->priv->raw_grid, "model", model, NULL);
proxy = gdaui_data_proxy_get_proxy (GDAUI_DATA_PROXY (formgrid->priv->raw_grid));
@@ -848,8 +842,12 @@ ui_formgrid_new (GdaDataModel *model, gboolean scroll_form, GdauiDataProxyInfoFl
G_CALLBACK (proxy_changed_cb), formgrid);
/* no more than 300 rows at a time */
- if (model)
+ if (model) {
gda_data_proxy_set_sample_size (proxy, 300);
+ if (flags & GDAUI_DATA_PROXY_INFO_ROW_MODIFY_BUTTONS)
+ g_object_set (G_OBJECT (formgrid), "compute-mod-statements", TRUE, NULL);
+ }
+
return (GtkWidget *) formgrid;
}
@@ -1110,8 +1108,7 @@ compute_modification_statements (UiFormGrid *formgrid, GdaDataModel *model)
}
}
- g_assert (model);
- if (!GDA_IS_DATA_SELECT (model))
+ if (!model || !GDA_IS_DATA_SELECT (model))
return;
if (! formgrid->priv->compute_mod_stmt)
diff --git a/tools/browser/query-exec/query-result.c b/tools/browser/query-exec/query-result.c
index 034d10b..adadec9 100644
--- a/tools/browser/query-exec/query-result.c
+++ b/tools/browser/query-exec/query-result.c
@@ -333,8 +333,7 @@ static GtkWidget *
make_widget_for_data_model (GdaDataModel *model, QueryResult *qres, const gchar *sql)
{
GtkWidget *grid;
- grid = ui_formgrid_new (model, TRUE, 0);
- g_object_set (G_OBJECT (grid), "compute-mod-statements", TRUE, NULL);
+ grid = ui_formgrid_new (model, TRUE, GDAUI_DATA_PROXY_INFO_ROW_MODIFY_BUTTONS);
ui_formgrid_set_sample_size (UI_FORMGRID (grid), 300);
if (sql) {
BrowserConnection *bcnc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]