[libgda] GdaBrowser: added browser_connection_rerun_select_cb()



commit 87026b452a13df39ea6ed8cff4b4e4c253c027bb
Author: Vivien Malerba <malerba gnome-db org>
Date:   Wed Jul 28 17:37:28 2010 +0200

    GdaBrowser: added browser_connection_rerun_select_cb()

 tools/browser/browser-connection.c             |   52 ++++++++++++++++++++++++
 tools/browser/browser-connection.h             |    6 +++
 tools/browser/doc/gda-browser-sections.txt     |    2 +
 tools/browser/doc/tmpl/browser-connection.sgml |   24 +++++++++++
 4 files changed, 84 insertions(+), 0 deletions(-)
---
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index 1ad2aed..88d3cc4 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -1115,6 +1115,13 @@ wrapper_rerun_select (RerunSelectData *data, GError **error)
 
 /**
  * browser_connection_rerun_select
+ * @bcnc: a #BrowserConnection object
+ * @model: a #GdaDataModel, which has to ba a #GdaDataSelect
+ * @error: a place to store errors, or %NULL
+ *
+ * Re-execute @model
+ *
+ * Returns: a job ID, or %0 if an error occurred
  */
 guint
 browser_connection_rerun_select (BrowserConnection *bcnc,
@@ -1249,6 +1256,51 @@ browser_connection_execute_statement_cb (BrowserConnection *bcnc,
 	return exec_id;
 }
 
+/**
+ * browser_connection_rerun_select_cb
+ * @bcnc: a #BrowserConnection object
+ * @model: a #GdaDataModel, which has to ba a #GdaDataSelect
+ * @callback: the function to call when statement has been executed
+ * @data: data to pass to @callback, or %NULL
+ * @error: a place to store errors, or %NULL
+ *
+ * Re-execute @model.
+ *
+ * Warning: gda_data_model_freeze() and gda_data_model_thaw() should be used
+ * before and after this call since the model will signal its changes in a thread
+ * which is not the GUI thread.
+ *
+ * Returns: a job ID, or %0 if an error occurred
+ */
+guint
+browser_connection_rerun_select_cb (BrowserConnection *bcnc,
+				    GdaDataModel *model,
+				    BrowserConnectionExecuteCallback callback,
+				    gpointer data,
+				    GError **error)
+{
+	guint exec_id;
+	g_return_val_if_fail (callback, 0);
+
+	exec_id = browser_connection_rerun_select (bcnc, model, error);
+	if (!exec_id)
+		return 0;
+	ExecCallbackData *cbdata;
+	cbdata = g_new0 (ExecCallbackData, 1);
+	cbdata->exec_id = exec_id;
+	cbdata->need_last_insert_row = FALSE;
+	cbdata->callback = callback;
+	cbdata->cb_data = data;
+
+	bcnc->priv->results_list = g_slist_append (bcnc->priv->results_list, cbdata);
+	if (! bcnc->priv->results_timer_id)
+		bcnc->priv->results_timer_id = g_timeout_add (200,
+							      (GSourceFunc) query_exec_fetch_cb,
+							      bcnc);
+	return exec_id;
+}
+
+
 static gboolean
 query_exec_fetch_cb (BrowserConnection *bcnc)
 {
diff --git a/tools/browser/browser-connection.h b/tools/browser/browser-connection.h
index fd599d9..763d80f 100644
--- a/tools/browser/browser-connection.h
+++ b/tools/browser/browser-connection.h
@@ -114,6 +114,12 @@ guint               browser_connection_execute_statement_cb   (BrowserConnection
 							       BrowserConnectionExecuteCallback callback,
 							       gpointer data,
 							       GError **error);
+guint               browser_connection_rerun_select_cb        (BrowserConnection *bcnc,
+							       GdaDataModel *model,
+							       BrowserConnectionExecuteCallback callback,
+							       gpointer data,
+							       GError **error);
+
 
 /*
  * transactions
diff --git a/tools/browser/doc/gda-browser-sections.txt b/tools/browser/doc/gda-browser-sections.txt
index 879e772..ae4dc7a 100644
--- a/tools/browser/doc/gda-browser-sections.txt
+++ b/tools/browser/doc/gda-browser-sections.txt
@@ -89,6 +89,8 @@ browser_connection_execution_get_result
 BrowserConnectionExecuteCallback
 browser_connection_execute_statement_cb
 browser_connection_normalize_sql_statement
+browser_connection_rerun_select
+browser_connection_rerun_select_cb
 <SUBSECTION>
 browser_connection_begin
 browser_connection_commit
diff --git a/tools/browser/doc/tmpl/browser-connection.sgml b/tools/browser/doc/tmpl/browser-connection.sgml
index 4eb3302..a187793 100644
--- a/tools/browser/doc/tmpl/browser-connection.sgml
+++ b/tools/browser/doc/tmpl/browser-connection.sgml
@@ -281,6 +281,30 @@ An opened connection
 @Returns: 
 
 
+<!-- ##### FUNCTION browser_connection_rerun_select ##### -->
+<para>
+
+</para>
+
+ bcnc: 
+ model: 
+ error: 
+ Returns: 
+
+
+<!-- ##### FUNCTION browser_connection_rerun_select_cb ##### -->
+<para>
+
+</para>
+
+ bcnc: 
+ model: 
+ callback: 
+ data: 
+ error: 
+ Returns: 
+
+
 <!-- ##### FUNCTION browser_connection_begin ##### -->
 <para>
 



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