[libgda] GdaBrowser: correctly handle variables in data manager perspective
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] GdaBrowser: correctly handle variables in data manager perspective
- Date: Mon, 2 Aug 2010 18:59:45 +0000 (UTC)
commit f0f15f678f4f43a3b3b68cfdf4410b0d3f359e67
Author: Vivien Malerba <malerba gnome-db org>
Date: Mon Aug 2 20:22:27 2010 +0200
GdaBrowser: correctly handle variables in data manager perspective
tools/browser/data-manager/data-console.c | 15 ++++++++++++
tools/browser/data-manager/data-source-manager.c | 15 +-----------
tools/browser/data-manager/data-source.c | 6 +++-
tools/browser/data-manager/data-widget.c | 27 ++++++++++++++++++++-
tools/browser/data-manager/data-widget.h | 1 +
tools/browser/data-manager/xml-spec-editor.c | 5 +---
6 files changed, 47 insertions(+), 22 deletions(-)
---
diff --git a/tools/browser/data-manager/data-console.c b/tools/browser/data-manager/data-console.c
index 32bfcc8..812ef42 100644
--- a/tools/browser/data-manager/data-console.c
+++ b/tools/browser/data-manager/data-console.c
@@ -150,6 +150,8 @@ data_console_dispose (GObject *object)
/* free memory */
if (dconsole->priv) {
+ if (dconsole->priv->params_form)
+ gtk_widget_destroy (dconsole->priv->params_form);
if (dconsole->priv->popup_container)
gtk_widget_destroy (dconsole->priv->popup_container);
if (dconsole->priv->bcnc)
@@ -576,6 +578,16 @@ spec_editor_toggled_cb (GtkToggleButton *button, DataConsole *dconsole)
}
static void
+param_activated_cb (GdauiBasicForm *form, DataConsole *dconsole)
+{
+ DataWidget *dwid = NULL;
+ if (dconsole->priv->data)
+ dwid = g_object_get_data ((GObject*) dconsole->priv->data, "data-widget");
+ if (dwid)
+ data_widget_rerun (DATA_WIDGET (dwid));
+}
+
+static void
data_source_mgr_changed_cb (DataSourceManager *mgr, DataConsole *dconsole)
{
if (dconsole->priv->params_form) {
@@ -590,6 +602,8 @@ data_source_mgr_changed_cb (DataSourceManager *mgr, DataConsole *dconsole)
dconsole->priv->params_form = gdaui_basic_form_new (params);
g_object_set ((GObject*) dconsole->priv->params_form,
"show-actions", TRUE, NULL);
+ g_signal_connect (dconsole->priv->params_form, "activated",
+ G_CALLBACK (param_activated_cb), dconsole);
show_variables = TRUE;
}
else {
@@ -633,6 +647,7 @@ create_widget (DataConsole *dconsole, GArray *sources_array, GError **error)
dwid = data_widget_new (sources_array);
gtk_container_add (GTK_CONTAINER (vp), dwid);
+ g_object_set_data ((GObject*) sw, "data-widget", dwid);
gtk_widget_show_all (vp);
return sw;
diff --git a/tools/browser/data-manager/data-source-manager.c b/tools/browser/data-manager/data-source-manager.c
index 27245ff..572fc18 100644
--- a/tools/browser/data-manager/data-source-manager.c
+++ b/tools/browser/data-manager/data-source-manager.c
@@ -29,7 +29,6 @@
#include "data-source-manager.h"
-
/* signals */
enum {
CHANGED,
@@ -195,18 +194,6 @@ source_depends_on (DataSource *source1, DataSource *source2)
return FALSE;
}
-
-static gint
-data_source_compare_func (DataSource *s1, DataSource *s2)
-{
- if (source_depends_on (s1, s2))
- return 1;
- else if (source_depends_on (s2, s1))
- return -1;
- else
- return 1;
-}
-
/**
* data_source_manager_add_source
* @mgr:
@@ -332,7 +319,6 @@ data_source_manager_remove_source (DataSourceManager *mgr, DataSource *source)
g_object_unref (source);
}
-
static void
compute_params (DataSourceManager *mgr)
{
@@ -376,6 +362,7 @@ compute_params (DataSourceManager *mgr)
mgr->priv->params = gda_set_copy (set);
else
gda_set_merge_with_set (mgr->priv->params, set);
+ data_source_set_params (source, mgr->priv->params);
}
}
}
diff --git a/tools/browser/data-manager/data-source.c b/tools/browser/data-manager/data-source.c
index e15a471..74cfdfe 100644
--- a/tools/browser/data-manager/data-source.c
+++ b/tools/browser/data-manager/data-source.c
@@ -30,7 +30,6 @@
#include "data-source.h"
-
/* signals */
enum {
EXEC_STARTED,
@@ -148,8 +147,11 @@ params_changed_cb (GdaSet *params, GdaHolder *holder, DataSource *source)
static void
ext_params_changed_cb (GdaSet *params, GdaHolder *holder, DataSource *source)
{
+#ifdef DEBUG_SOURCE
+ g_print (" => data source [%s] should rerun\n",
+ data_source_get_title (source));
+#endif
source->priv->need_rerun = TRUE;
- data_source_execute (source, NULL);
}
static void
diff --git a/tools/browser/data-manager/data-widget.c b/tools/browser/data-manager/data-widget.c
index ca26c25..a20667d 100644
--- a/tools/browser/data-manager/data-widget.c
+++ b/tools/browser/data-manager/data-widget.c
@@ -348,7 +348,9 @@ source_exec_finished_cb (DataSource *source, GError *error, DataPart *part)
GtkWidget *wid;
browser_spinner_stop (part->spinner);
- g_print ("==== Execution of source [%s] finished\n", data_source_get_title (part->source));
+#ifdef GDA_DEBUG_NO
+ g_print ("==== Execution of source [%s] finished\n", data_source_get_title (part->source));*/
+#endif
if (error) {
gchar *tmp;
tmp = g_markup_printf_escaped ("\n<b>Error:\n</b>%s",
@@ -378,7 +380,10 @@ source_exec_finished_cb (DataSource *source, GError *error, DataPart *part)
part->data_widget = wid;
part->data_widget_page = gtk_notebook_append_page (part->nb, cwid, NULL);
gtk_widget_show (cwid);
- g_print ("Creating data widget for source [%s]\n", data_source_get_title (part->source));
+#ifdef GDA_DEBUG_NO
+ g_print ("Creating data widget for source [%s]\n",
+ data_source_get_title (part->source));
+#endif
/* compute part->export_data */
GArray *export_names;
@@ -487,11 +492,13 @@ compute_sources_dependencies (DataPart *part)
lerror->message : "???");
g_clear_error (&lerror);
}
+#ifdef GDA_DEBUG_NO
g_print ("[%s.][%s] bound to [%s].[%s]\n",
data_source_get_title (part->source),
hid,
data_source_get_title (opart->source),
gda_holder_get_id (holder2));
+#endif
if (! g_slist_find (opart->dep_parts, part))
opart->dep_parts = g_slist_append (opart->dep_parts, part);
@@ -519,3 +526,19 @@ data_widget_get_export (DataWidget *dwid, DataSource *source)
}
return part->export_data;
}
+
+/**
+ * data_widget_rerun
+ */
+void
+data_widget_rerun (DataWidget *dwid)
+{
+ GSList *parts;
+ g_return_if_fail (IS_DATA_WIDGET (dwid));
+
+ for (parts = dwid->priv->parts; parts; parts = parts->next) {
+ DataPart *part;
+ part = (DataPart*) parts->data;
+ data_source_execute (part->source, NULL);
+ }
+}
diff --git a/tools/browser/data-manager/data-widget.h b/tools/browser/data-manager/data-widget.h
index 03bb1b3..82d79ff 100644
--- a/tools/browser/data-manager/data-widget.h
+++ b/tools/browser/data-manager/data-widget.h
@@ -53,6 +53,7 @@ struct _DataWidgetClass {
GType data_widget_get_type (void) G_GNUC_CONST;
GtkWidget *data_widget_new (GArray *sources_array);
GdaSet *data_widget_get_export (DataWidget *dwid, DataSource *source);
+void data_widget_rerun (DataWidget *dwid);
G_END_DECLS
diff --git a/tools/browser/data-manager/xml-spec-editor.c b/tools/browser/data-manager/xml-spec-editor.c
index 15c5eef..c5b5fce 100644
--- a/tools/browser/data-manager/xml-spec-editor.c
+++ b/tools/browser/data-manager/xml-spec-editor.c
@@ -170,9 +170,7 @@ signal_editor_changed (XmlSpecEditor *sped)
}
BrowserConnection *bcnc;
- GdaSet *params;
-
- params = data_source_manager_get_params (sped->priv->mgr);
+
bcnc = data_source_manager_get_browser_cnc (sped->priv->mgr);
for (node = node->children; node; node = node->next) {
if (!strcmp ((gchar*) node->name, "table") ||
@@ -185,7 +183,6 @@ signal_editor_changed (XmlSpecEditor *sped)
goto out;
}
- data_source_set_params (source, params);
data_source_manager_add_source (sped->priv->mgr, source);
g_object_unref (source);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]