[libgda] GdaBrowser: now display query execution's results



commit 4af73e368063d1cc31eaed7021d1b3f0a28cad80
Author: Vivien Malerba <malerba gnome-db org>
Date:   Mon Sep 7 21:55:46 2009 +0200

    GdaBrowser: now display query execution's results
    
    * also correctly handle execution errors
    * also limit the number of query batches in history (to 20)

 tools/browser/query-exec/Makefile.am     |    2 +
 tools/browser/query-exec/query-console.c |   34 +++--
 tools/browser/query-exec/query-editor.c  |   35 +++--
 tools/browser/query-exec/query-editor.h  |    7 +-
 tools/browser/query-exec/query-result.c  |  298 ++++++++++++++++++++++++++++++
 tools/browser/query-exec/query-result.h  |   60 ++++++
 6 files changed, 408 insertions(+), 28 deletions(-)
---
diff --git a/tools/browser/query-exec/Makefile.am b/tools/browser/query-exec/Makefile.am
index abfc15c..0bc9ef2 100644
--- a/tools/browser/query-exec/Makefile.am
+++ b/tools/browser/query-exec/Makefile.am
@@ -14,6 +14,8 @@ libperspective_la_SOURCES = \
 	query-console.h \
 	query-editor.c \
 	query-editor.h \
+	query-result.c \
+	query-result.h \
 	perspective-main.c \
 	perspective-main.h \
 	query-exec-perspective.h \
diff --git a/tools/browser/query-exec/query-console.c b/tools/browser/query-exec/query-console.c
index 53c0546..03ccb0e 100644
--- a/tools/browser/query-exec/query-console.c
+++ b/tools/browser/query-exec/query-console.c
@@ -31,6 +31,7 @@
 #include "../browser-page.h"
 #include "../browser-stock-icons.h"
 #include "query-editor.h"
+#include "query-result.h"
 #include "../common/popup-container.h"
 #include <libgda/sql-parser/gda-sql-parser.h>
 #include <libgda-ui/libgda-ui.h>
@@ -123,6 +124,8 @@ struct _QueryConsolePrivate {
 	GtkWidget *history_del_button;
 	GtkWidget *history_copy_button;
 
+	GtkWidget *query_result;
+
 	ExecutionBatch *current_exec;
 	guint current_exec_id; /* timout ID to fetch execution results */
 };
@@ -430,7 +433,8 @@ query_console_new (BrowserConnection *bcnc)
 	gtk_misc_set_alignment (GTK_MISC (wid), 0., -1);
 	gtk_box_pack_start (GTK_BOX (vbox), wid, FALSE, FALSE, 0);
 
-	wid = gtk_label_new ("Here go the\nresults' form");
+	wid = query_result_new ();
+	tconsole->priv->query_result = wid;
 	gtk_box_pack_start (GTK_BOX (vbox), wid, TRUE, TRUE, 0);
 
 	/* show everything */
@@ -486,9 +490,19 @@ history_changed_cb (QueryEditor *history, QueryConsole *tconsole)
 	QueryEditor *qe;
 	
 	qe = tconsole->priv->history;
-        if (query_editor_get_current_history_item (qe) ||
-	    query_editor_get_current_history_batch (qe))
+        if (query_editor_get_current_history_item (qe)) {
+		query_result_show_history_item (QUERY_RESULT (tconsole->priv->query_result),
+						query_editor_get_current_history_item (qe));
+		act = TRUE;
+	}
+	else if (query_editor_get_current_history_batch (qe)) {
+		query_result_show_history_batch (QUERY_RESULT (tconsole->priv->query_result),
+						 query_editor_get_current_history_batch (qe));
 		act = TRUE;
+	}
+	else
+		query_result_show_history_batch (QUERY_RESULT (tconsole->priv->query_result), NULL);
+
 	gtk_widget_set_sensitive (tconsole->priv->history_del_button, act);
 	gtk_widget_set_sensitive (tconsole->priv->history_copy_button, act);
 }
@@ -707,7 +721,7 @@ popup_container_position_func (PopupContainer *cont, gint *out_x, gint *out_y)
 	top = gtk_widget_get_toplevel (console);	
         gtk_widget_size_request ((GtkWidget*) cont, &req);
         gdk_window_get_origin (top->window, &x, &y);
-
+	
 	x += (top->allocation.width - req.width) / 2;
 	y += (top->allocation.height - req.height) / 2;
 
@@ -842,7 +856,7 @@ sql_execute_clicked_cb (GtkButton *button, QueryConsole *tconsole)
 	ebatch = g_new0 (ExecutionBatch, 1);
 	ebatch->batch = batch;
 	g_get_current_time (&(ebatch->start_time));
-	ebatch->hist_batch = query_editor_history_batch_new (ebatch->start_time);
+	ebatch->hist_batch = query_editor_history_batch_new (ebatch->start_time, tconsole->priv->params);
 	query_editor_start_history_batch (tconsole->priv->history, ebatch->hist_batch);
 
 	stmt_list = gda_batch_get_statements (batch);
@@ -858,7 +872,6 @@ sql_execute_clicked_cb (GtkButton *button, QueryConsole *tconsole)
 									       tconsole->priv->params,
 									       GDA_STATEMENT_MODEL_RANDOM_ACCESS,
 									       FALSE, &(estmt->exec_error));
-			g_print ("Executing: %u\n", estmt->exec_id);
 			if (estmt->exec_id == 0) {
 				browser_show_error (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) tconsole)),
 						    _("Error executing query: %s"),
@@ -888,7 +901,6 @@ query_exec_fetch_cb (QueryConsole *tconsole)
 			g_assert (estmt->exec_id);
 			g_assert (!estmt->result);
 			g_assert (!estmt->exec_error);
-			g_print ("Getting results for exec ID %u\n", estmt->exec_id);
 			estmt->result = browser_connection_execution_get_result (tconsole->priv->bcnc,
 										 estmt->exec_id, NULL,
 										 &(estmt->exec_error));
@@ -899,13 +911,12 @@ query_exec_fetch_cb (QueryConsole *tconsole)
 				if (!sqlst->sql) {
 					gchar *sql;
 					sql = gda_statement_to_sql (GDA_STATEMENT (estmt->stmt), NULL, NULL);
-					history = query_editor_history_item_new (sql, tconsole->priv->params,
-										 estmt->result);
+					history = query_editor_history_item_new (sql, estmt->result, estmt->exec_error);
 					g_free (sql);
 				}
 				else
-					history = query_editor_history_item_new (sqlst->sql, tconsole->priv->params,
-										 estmt->result);
+					history = query_editor_history_item_new (sqlst->sql,
+										 estmt->result, estmt->exec_error);
 				gda_sql_statement_free (sqlst);
 				if (estmt->exec_error) {
 					browser_show_error (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) tconsole)),
@@ -938,7 +949,6 @@ query_exec_fetch_cb (QueryConsole *tconsole)
 											       GDA_STATEMENT_MODEL_RANDOM_ACCESS,
 											       FALSE,
 											       &(estmt->exec_error));
-					g_print ("Executing: %u\n", estmt->exec_id);
 					if (estmt->exec_id == 0) {
 						browser_show_error (GTK_WINDOW (gtk_widget_get_toplevel ((GtkWidget*) tconsole)),
 								    _("Error executing query:\n%s"),
diff --git a/tools/browser/query-exec/query-editor.c b/tools/browser/query-exec/query-editor.c
index 32be854..6896b22 100644
--- a/tools/browser/query-exec/query-editor.c
+++ b/tools/browser/query-exec/query-editor.c
@@ -37,6 +37,7 @@
 
 #define QUERY_EDITOR_LANGUAGE_SQL "gda-sql"
 #define COLOR_ALTER_FACTOR 1.8
+#define MAX_HISTORY_BATCH_ITEMS 20
 
 typedef void (* CreateTagsFunc) (QueryEditor *editor, const gchar *language);
 
@@ -721,7 +722,7 @@ query_editor_start_history_batch (QueryEditor *editor, QueryEditorHistoryBatch *
 		GTimeVal run_time = {0, 0};
 		empty = TRUE;
 		
-		hist_batch = query_editor_history_batch_new (run_time);
+		hist_batch = query_editor_history_batch_new (run_time, NULL);
 	}
 
 	/* update editor->priv->insert_into_batch */
@@ -768,6 +769,13 @@ query_editor_start_history_batch (QueryEditor *editor, QueryEditorHistoryBatch *
 	/* add timout to 1 sec. */
 	editor->priv->ts_timeout_id  = g_timeout_add_seconds (60,
 							      (GSourceFunc) timestamps_update_cb, editor);
+
+	/* remove too old batches */
+	if (g_slist_length (editor->priv->batches_list) > MAX_HISTORY_BATCH_ITEMS) {
+		QueryEditorHistoryBatch *obatch;
+		obatch = g_slist_last (editor->priv->batches_list)->data;
+		query_editor_del_history_batch (editor, obatch);
+	}
 }
 
 static gboolean
@@ -1253,13 +1261,16 @@ query_editor_paste_clipboard (QueryEditor *editor)
  * QueryEditorHistoryBatch
  */
 QueryEditorHistoryBatch *
-query_editor_history_batch_new (GTimeVal run_time)
+query_editor_history_batch_new (GTimeVal run_time, GdaSet *params)
 {
 	QueryEditorHistoryBatch *qib;
 	
 	qib = g_new0 (QueryEditorHistoryBatch, 1);
 	qib->ref_count = 1;
 	qib->run_time = run_time;
+	if (params)
+		qib->params = gda_set_copy (params);
+
 	return qib;
 }
 
@@ -1281,6 +1292,9 @@ query_editor_history_batch_unref (QueryEditorHistoryBatch *qib)
 			g_slist_foreach (qib->hist_items, (GFunc) query_editor_history_item_unref, NULL);
 			g_slist_free (qib->hist_items);
 		}
+		if (qib->params)
+			g_object_unref (qib->params);
+
 		g_free (qib);
 	}
 }
@@ -1306,7 +1320,7 @@ query_editor_history_batch_del_item (QueryEditorHistoryBatch *qib, QueryEditorHi
  * QueryEditorHistoryItem
  */
 QueryEditorHistoryItem *
-query_editor_history_item_new (const gchar *sql, GdaSet *params, GObject *result)
+query_editor_history_item_new (const gchar *sql, GObject *result, GError *error)
 {
 	QueryEditorHistoryItem *qih;
 	
@@ -1315,15 +1329,10 @@ query_editor_history_item_new (const gchar *sql, GdaSet *params, GObject *result
 	qih = g_new0 (QueryEditorHistoryItem, 1);
 	qih->ref_count = 1;
 	qih->sql = g_strdup (sql);
-	if (params)
-		qih->params = gda_set_copy (params);
-	if (result) {
+	if (result)
 		qih->result = g_object_ref (result);
-		if (GDA_IS_DATA_MODEL (result))
-			gda_data_model_dump (GDA_DATA_MODEL (result), NULL);
-		else
-			g_print ("RESULT!!!\n");
-	}
+	if (error)
+		qih->exec_error = g_error_copy (error);
 
 	return qih;
 }
@@ -1343,10 +1352,10 @@ query_editor_history_item_unref (QueryEditorHistoryItem *qih)
 	qih->ref_count--;
 	if (qih->ref_count <= 0) {
 		g_free (qih->sql);
-		if (qih->params)
-			g_object_unref (qih->params);
 		if (qih->result)
 			g_object_unref (qih->result);
+		if (qih->exec_error)
+			g_error_free (qih->exec_error);
 		g_free (qih);
 	}
 }
diff --git a/tools/browser/query-exec/query-editor.h b/tools/browser/query-exec/query-editor.h
index d92dab1..462f724 100644
--- a/tools/browser/query-exec/query-editor.h
+++ b/tools/browser/query-exec/query-editor.h
@@ -56,13 +56,13 @@ struct _QueryEditorClass {
  */
 typedef struct {
 	gchar *sql;
-	GdaSet *params;
 	GObject *result;
+	GError *exec_error;
 
 	gint ref_count;
 } QueryEditorHistoryItem;
 
-QueryEditorHistoryItem *query_editor_history_item_new (const gchar *sql, GdaSet *params, GObject *result);
+QueryEditorHistoryItem *query_editor_history_item_new (const gchar *sql, GObject *result, GError *error);
 QueryEditorHistoryItem *query_editor_history_item_ref (QueryEditorHistoryItem *qih);
 void                    query_editor_history_item_unref (QueryEditorHistoryItem *qih);
 
@@ -71,12 +71,13 @@ void                    query_editor_history_item_unref (QueryEditorHistoryItem
  */
 typedef struct {
 	GTimeVal run_time;
+	GdaSet *params;
 	GSList *hist_items; /* list of QueryEditorHistoryItem, ref held here */
 
 	gint ref_count;
 } QueryEditorHistoryBatch;
 
-QueryEditorHistoryBatch *query_editor_history_batch_new (GTimeVal run_time);
+QueryEditorHistoryBatch *query_editor_history_batch_new (GTimeVal run_time, GdaSet *params);
 QueryEditorHistoryBatch *query_editor_history_batch_ref (QueryEditorHistoryBatch *qib);
 void                     query_editor_history_batch_unref (QueryEditorHistoryBatch *qib);
 void                     query_editor_history_batch_add_item (QueryEditorHistoryBatch *qib,
diff --git a/tools/browser/query-exec/query-result.c b/tools/browser/query-exec/query-result.c
new file mode 100644
index 0000000..788555e
--- /dev/null
+++ b/tools/browser/query-exec/query-result.c
@@ -0,0 +1,298 @@
+/* GNOME DB library
+ * Copyright (C) 2009 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      Vivien Malerba <malerba gnome-db org>
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include "query-result.h"
+#include <libgda-ui/libgda-ui.h>
+
+struct _QueryResultPrivate {
+	QueryEditorHistoryBatch *hbatch;
+	QueryEditorHistoryItem *hitem;
+
+	GtkWidget *child;
+};
+
+static void query_result_class_init (QueryResultClass *klass);
+static void query_result_init       (QueryResult *result, QueryResultClass *klass);
+static void query_result_finalize   (GObject *object);
+
+static GObjectClass *parent_class = NULL;
+
+static GtkWidget *make_widget_for_notice (void);
+static GtkWidget *make_widget_for_data_model (GdaDataModel *model);
+static GtkWidget *make_widget_for_set (GdaSet *set);
+static GtkWidget *make_widget_for_error (GError *error);
+
+
+/*
+ * QueryResult class implementation
+ */
+static void
+query_result_class_init (QueryResultClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+	object_class->finalize = query_result_finalize;
+}
+
+static void
+query_result_init (QueryResult *result, QueryResultClass *klass)
+{
+	GtkWidget *wid;
+
+	/* allocate private structure */
+	result->priv = g_new0 (QueryResultPrivate, 1);
+	result->priv->hbatch = NULL;
+	result->priv->hitem = NULL;
+
+	wid = make_widget_for_notice ();
+	gtk_box_pack_start (GTK_BOX (result), wid, TRUE, TRUE, 0);
+	gtk_widget_show (wid);
+	result->priv->child = wid;
+}
+
+static void
+query_result_finalize (GObject *object)
+{
+	QueryResult *result = (QueryResult *) object;
+
+	g_return_if_fail (IS_QUERY_RESULT (result));
+
+	/* free memory */
+	if (result->priv->hbatch)
+		query_editor_history_batch_unref (result->priv->hbatch);
+	if (result->priv->hitem)
+		query_editor_history_item_unref (result->priv->hitem);
+
+	g_free (result->priv);
+	result->priv = NULL;
+
+	parent_class->finalize (object);
+}
+
+GType
+query_result_get_type (void)
+{
+	static GType type = 0;
+
+	if (G_UNLIKELY (type == 0)) {
+		static const GTypeInfo info = {
+			sizeof (QueryResultClass),
+			(GBaseInitFunc) NULL,
+			(GBaseFinalizeFunc) NULL,
+			(GClassInitFunc) query_result_class_init,
+			NULL,
+			NULL,
+			sizeof (QueryResult),
+			0,
+			(GInstanceInitFunc) query_result_init
+		};
+		type = g_type_register_static (GTK_TYPE_VBOX, "QueryResult", &info, 0);
+	}
+	return type;
+}
+
+/**
+ * query_result_new
+ *
+ * Create a new #QueryResult widget
+ *
+ * Returns: the newly created widget.
+ */
+GtkWidget *
+query_result_new (void)
+{
+	QueryResult *result;
+
+	result = g_object_new (QUERY_TYPE_RESULT, NULL);
+
+	return GTK_WIDGET (result);
+}
+
+/**
+ * query_result_show_history_batch
+ * @qres: a #QueryResult widget
+ * @hbatch: the #QueryEditorHistoryBatch to display, or %NULL
+ *
+ * 
+ */
+void
+query_result_show_history_batch (QueryResult *qres, QueryEditorHistoryBatch *hbatch)
+{
+	GtkWidget *child;
+
+	g_return_if_fail (IS_QUERY_RESULT (qres));
+	if (qres->priv->child)
+		gtk_widget_destroy (qres->priv->child);
+	TO_IMPLEMENT;
+
+	child = make_widget_for_notice ();
+	gtk_box_pack_start (GTK_BOX (qres), child, TRUE, TRUE, 10);
+	gtk_widget_show (child);
+	qres->priv->child = child;
+}
+
+/**
+ * query_result_show_history_item
+ * @qres: a #QueryResult widget
+ * @hitem: the #QueryEditorHistoryItem to display, or %NULL
+ *
+ * 
+ */
+void
+query_result_show_history_item (QueryResult *qres, QueryEditorHistoryItem *hitem)
+{
+	GtkWidget *child;
+
+	g_return_if_fail (IS_QUERY_RESULT (qres));
+	if (qres->priv->child)
+		gtk_widget_destroy (qres->priv->child);
+	
+	if (!hitem)
+		child = make_widget_for_notice ();
+	else if (hitem->result) {
+		if (GDA_IS_DATA_MODEL (hitem->result))
+			child = make_widget_for_data_model (GDA_DATA_MODEL (hitem->result));
+		else if (GDA_IS_SET (hitem->result))
+			child = make_widget_for_set (GDA_SET (hitem->result));
+		else
+			g_assert_not_reached ();
+	}
+	else 
+		child = make_widget_for_error (hitem->exec_error);
+
+	gtk_box_pack_start (GTK_BOX (qres), child, TRUE, TRUE, 10);
+	gtk_widget_show (child);
+	qres->priv->child = child;
+}
+
+static GtkWidget *
+make_widget_for_notice (void)
+{
+	GtkWidget *label;
+	label = gtk_label_new (_("No result selected"));
+	return label;
+}
+
+static GtkWidget *
+make_widget_for_data_model (GdaDataModel *model)
+{
+	GtkWidget *grid;
+	grid = gdaui_grid_new (model);
+	return grid;
+}
+
+static GtkWidget *
+make_widget_for_set (GdaSet *set)
+{
+	GtkWidget *hbox, *img;
+	hbox = gtk_hbox_new (FALSE, 5);
+	
+	img = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
+	gtk_misc_set_alignment (GTK_MISC (img), 0., 0.);
+	gtk_box_pack_start (GTK_BOX (hbox), img, FALSE, FALSE, 0);
+
+	GtkWidget *sw;
+	GtkWidget *view;
+	GtkTextBuffer *buffer;
+	GSList *list;
+	GtkTextIter iter;
+
+	view = gtk_text_view_new ();
+	sw = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_container_add (GTK_CONTAINER (sw), view);
+
+	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+	gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+	for (list = set->holders; list; list = list->next) {
+		GdaHolder *h;
+		const GValue *value;
+		gchar *tmp;
+		const gchar *cstr;
+		h = GDA_HOLDER (list->data);
+		gtk_text_buffer_get_end_iter (buffer, &iter);
+
+		if (list != set->holders)
+			gtk_text_buffer_insert (buffer, &iter, "\n", -1);
+		
+		cstr = gda_holder_get_id (h);
+		if (!strcmp (cstr, "IMPACTED_ROWS"))
+			gtk_text_buffer_insert (buffer, &iter, _("Number of rows impacted"), -1);
+		else
+			gtk_text_buffer_insert (buffer, &iter, cstr, -1);
+		gtk_text_buffer_insert (buffer, &iter, ": ", -1);
+		value = gda_holder_get_value (h);
+		tmp = gda_value_stringify (value);
+		gtk_text_buffer_insert (buffer, &iter, tmp, -1);
+		g_free (tmp);
+	}
+
+	gtk_widget_show_all (hbox);
+	gtk_widget_hide (hbox);
+
+	return hbox;
+}
+
+static GtkWidget *
+make_widget_for_error (GError *error)
+{
+	GtkWidget *hbox, *img;
+	hbox = gtk_hbox_new (FALSE, 5);
+	
+	img = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
+	gtk_misc_set_alignment (GTK_MISC (img), 0., 0.);
+	gtk_box_pack_start (GTK_BOX (hbox), img, FALSE, FALSE, 0);
+
+	GtkWidget *sw;
+	GtkWidget *view;
+	GtkTextBuffer *buffer;
+	GSList *list;
+	GtkTextIter iter;
+
+	view = gtk_text_view_new ();
+	sw = gtk_scrolled_window_new (NULL, NULL);
+	gtk_box_pack_start (GTK_BOX (hbox), sw, TRUE, TRUE, 0);
+	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
+					GTK_POLICY_AUTOMATIC,
+					GTK_POLICY_AUTOMATIC);
+	gtk_container_add (GTK_CONTAINER (sw), view);
+
+	buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
+	gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
+	gtk_text_buffer_get_end_iter (buffer, &iter);
+	gtk_text_buffer_insert (buffer, &iter, "Error\n", -1);
+	if (error && error->message)
+		gtk_text_buffer_insert (buffer, &iter, error->message, -1);
+	else
+		gtk_text_buffer_insert (buffer, &iter, _("No detail"), -1);
+	
+	gtk_widget_show_all (hbox);
+	gtk_widget_hide (hbox);
+	return hbox;
+}
diff --git a/tools/browser/query-exec/query-result.h b/tools/browser/query-exec/query-result.h
new file mode 100644
index 0000000..581062f
--- /dev/null
+++ b/tools/browser/query-exec/query-result.h
@@ -0,0 +1,60 @@
+/* GNOME DB library
+ * Copyright (C) 2009 The GNOME Foundation.
+ *
+ * AUTHORS:
+ *      Vivien Malerba <malerba gnome-db org>
+ *
+ * This Library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this Library; see the file COPYING.LIB.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __QUERY_RESULT_H__
+#define __QUERY_RESULT_H__
+
+#include <gtk/gtkvbox.h>
+#include <libgda/libgda.h>
+#include "query-editor.h"
+
+G_BEGIN_DECLS
+
+#define QUERY_TYPE_RESULT            (query_result_get_type())
+#define QUERY_RESULT(obj)            (G_TYPE_CHECK_INSTANCE_CAST (obj, QUERY_TYPE_RESULT, QueryResult))
+#define QUERY_RESULT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST (klass, QUERY_TYPE_RESULT, QueryResultClass))
+#define IS_QUERY_RESULT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE (obj, QUERY_TYPE_RESULT))
+#define IS_QUERY_RESULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUERY_TYPE_RESULT))
+
+typedef struct _QueryResult        QueryResult;
+typedef struct _QueryResultClass   QueryResultClass;
+typedef struct _QueryResultPrivate QueryResultPrivate;
+
+struct _QueryResult {
+	GtkVBox parent;
+	QueryResultPrivate *priv;
+};
+
+struct _QueryResultClass {
+	GtkVBoxClass parent_class;
+};
+
+
+GType      query_result_get_type (void) G_GNUC_CONST;
+GtkWidget *query_result_new (void);
+
+void       query_result_show_history_batch (QueryResult *qres, QueryEditorHistoryBatch *hbatch);
+void       query_result_show_history_item (QueryResult *qres, QueryEditorHistoryItem *hitem);
+
+G_END_DECLS
+
+#endif



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