]> saetta.ns0.it Git - libgdaex/commitdiff
Added GdaExQueryEditor::dispose and ::finalize.
authorAndrea Zagli <andrea.zagli@email.it>
Sun, 27 Dec 2015 11:23:13 +0000 (12:23 +0100)
committerAndrea Zagli <andrea.zagli@email.it>
Sun, 27 Dec 2015 11:23:13 +0000 (12:23 +0100)
Some adjustments.

src/queryeditor.c
tests/query_editor.c

index ca824c680588eb3fa157172defcd747f62806529..09aebb7e51f6c9e7eac3fcafb0b210eb02ea8519 100644 (file)
@@ -69,6 +69,9 @@ enum
 static void gdaex_query_editor_class_init (GdaExQueryEditorClass *class);
 static void gdaex_query_editor_init (GdaExQueryEditor *gdaex_query_editor);
 
+static void gdaex_query_editor_dispose (GObject *object);
+static void gdaex_query_editor_finalize (GObject *object);
+
 static void gdaex_query_editor_set_property (GObject *object,
                                guint property_id,
                                const GValue *value,
@@ -293,6 +296,9 @@ gdaex_query_editor_class_init (GdaExQueryEditorClass *class)
        object_class->set_property = gdaex_query_editor_set_property;
        object_class->get_property = gdaex_query_editor_get_property;
 
+       object_class->dispose = gdaex_query_editor_dispose;
+       object_class->finalize = gdaex_query_editor_finalize;
+
        g_type_class_add_private (object_class, sizeof (GdaExQueryEditorPrivate));
 }
 
@@ -301,14 +307,6 @@ gdaex_query_editor_init (GdaExQueryEditor *gdaex_query_editor)
 {
        GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
 
-       gdaex_query_editor_clean (gdaex_query_editor);
-
-       priv->lstore_link_type = gtk_list_store_new (2,
-                                                    G_TYPE_UINT,
-                                                    G_TYPE_STRING);
-       priv->lstore_where_type = gtk_list_store_new (2,
-                                                     G_TYPE_UINT,
-                                                     G_TYPE_STRING);
 }
 
 /**
@@ -331,6 +329,15 @@ GdaExQueryEditor
 
        priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
 
+       gdaex_query_editor_clean (gdaex_query_editor);
+
+       priv->lstore_link_type = gtk_list_store_new (2,
+                                                    G_TYPE_UINT,
+                                                    G_TYPE_STRING);
+       priv->lstore_where_type = gtk_list_store_new (2,
+                                                     G_TYPE_UINT,
+                                                     G_TYPE_STRING);
+
        priv->gdaex = gdaex;
 
        /* test if we can use GtkDateEntry */
@@ -2723,21 +2730,52 @@ gdaex_query_editor_get_property (GObject *object,
 }
 
 static void
-gdaex_query_editor_clean (GdaExQueryEditor *gdaex_query_editor)
+gdaex_query_editor_dispose (GObject *object)
 {
+       GdaExQueryEditor *gdaex_query_editor = (GdaExQueryEditor *)object;
        GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
 
+       gtk_tree_store_clear (priv->tstore_fields);
+       gtk_list_store_clear (priv->lstore_show);
+       gtk_tree_store_clear (priv->tstore_where);
+       gtk_list_store_clear (priv->lstore_order);
+
        if (priv->tables != NULL)
                {
                        g_hash_table_destroy (priv->tables);
+                       priv->tables = NULL;
                }
-       priv->tables = g_hash_table_new (g_str_hash, g_str_equal);
 
-       if (GTK_IS_PANED (priv->hpaned_main))
+       if (priv->relations != NULL)
                {
-                       gtk_widget_destroy (priv->hpaned_main);
+                       g_slist_free (priv->relations);
+                       priv->relations = NULL;
                }
-       priv->hpaned_main = NULL;
+
+       G_OBJECT_CLASS (gdaex_query_editor_parent_class)->dispose (object);
+}
+
+static void
+gdaex_query_editor_finalize (GObject *object)
+{
+       GdaExQueryEditor *gdaex_query_editor = (GdaExQueryEditor *)object;
+       GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
+
+       gtk_widget_destroy (priv->hpaned_main);
+
+       G_OBJECT_CLASS (gdaex_query_editor_parent_class)->finalize (object);
+}
+
+static void
+gdaex_query_editor_clean (GdaExQueryEditor *gdaex_query_editor)
+{
+       GdaExQueryEditorPrivate *priv = GDAEX_QUERY_EDITOR_GET_PRIVATE (gdaex_query_editor);
+
+       if (priv->tables != NULL)
+               {
+                       g_hash_table_destroy (priv->tables);
+               }
+       priv->tables = g_hash_table_new (g_str_hash, g_str_equal);
 
        if (priv->relations != NULL)
                {
index 22a471beec5b6be5e2b4f41f5e4941b88523a70b..69ab18aaca5d4214f29f507b08efecf1a1b721dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2011-2015 Andrea Zagli <azagli@libero.it>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <gdaex.h>
 #include <queryeditor.h>
 
+GdaExQueryEditor *qe;
+
+gchar *xmlfile;
+
+GdaEx *gdaex;
+
 GtkWidget *w;
 
+GtkWidget *widget_qe;
+GtkWidget *btn_destroy;
+GtkWidget *btn_clean;
+GtkWidget *btn_get_sql;
+GtkWidget *btn_save_xml;
+GtkWidget *btn_load_xml;
+GtkWidget *btn_ok;
+
+GtkWidget *vbox;
+
+static void
+do_query_editor ()
+{
+       GdaExQueryEditorField *field;
+
+       qe = gdaex_query_editor_new (gdaex);
+
+       if (xmlfile != NULL)
+               {
+                       gdaex_query_editor_load_tables_from_file (qe, xmlfile, TRUE);
+               }
+       else
+               {
+                       gdaex_query_editor_add_table (qe, "clients", "Clients");
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("id");
+                       field->name_visible = g_strdup ("ID");
+                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
+                       field->for_show = TRUE;
+                       field->always_showed = TRUE;
+                       field->for_where = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_EQUAL;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("name");
+                       field->name_visible = g_strdup ("Name");
+                       field->description = g_strdup ("The client's name");
+                       field->type = GDAEX_QE_FIELD_TYPE_TEXT;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_STARTS
+                                                     | GDAEX_QE_WHERE_TYPE_CONTAINS
+                                                     | GDAEX_QE_WHERE_TYPE_ENDS
+                                                     | GDAEX_QE_WHERE_TYPE_ISTARTS
+                                                     | GDAEX_QE_WHERE_TYPE_ICONTAINS
+                                                     | GDAEX_QE_WHERE_TYPE_IENDS;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("surname");
+                       field->name_visible = g_strdup ("Surname");
+                       field->description = g_strdup ("The client's surname");
+                       field->type = GDAEX_QE_FIELD_TYPE_TEXT;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_STRING
+                                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("brithday");
+                       field->name_visible = g_strdup ("Birthday");
+                       field->description = g_strdup ("The client's birthday");
+                       field->type = GDAEX_QE_FIELD_TYPE_DATE;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_DATETIME
+                                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("age");
+                       field->name_visible = g_strdup ("Age");
+                       field->description = g_strdup ("The client's age");
+                       field->alias = g_strdup ("client_age");
+                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_NUMBER;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("datetime");
+                       field->name_visible = g_strdup ("DateTime");
+                       field->description = g_strdup ("???");
+                       field->type = GDAEX_QE_FIELD_TYPE_DATETIME;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_DATETIME
+                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("id_cities");
+                       field->name_visible = g_strdup ("City");
+                       field->description = g_strdup ("The client's city");
+                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->decode_table2 = g_strdup ("cities");
+                       field->decode_join_type = GDAEX_QE_JOIN_TYPE_LEFT;
+                       /*field->decode_fields1 = g_slist_append (field->decode_fields1, "id_cities");
+                       field->decode_fields2 = g_slist_append (field->decode_fields2, "id");*/
+                       field->decode_field2 = g_strdup ("id");
+                       field->decode_field_to_show = g_strdup ("name");
+                       field->decode_field_alias = g_strdup ("city_name");
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_EQUAL;
+                       gdaex_query_editor_table_add_field (qe, "clients", *field);
+                       g_free (field);
+
+                       gdaex_query_editor_add_table (qe, "orders", "Orders");
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("id");
+                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
+                       gdaex_query_editor_table_add_field (qe, "orders", *field);
+                       g_free (field);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("id_clients");
+                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
+                       gdaex_query_editor_table_add_field (qe, "orders", *field);
+                       g_free (field);
+
+                       gdaex_query_editor_add_relation (qe,
+                                                        "clients", "orders",
+                                                        GDAEX_QE_JOIN_TYPE_LEFT,
+                                                        "id", "id_clients",
+                                                        NULL);
+
+                       field = g_new0 (GdaExQueryEditorField, 1);
+                       field->name = g_strdup ("amount");
+                       field->name_visible = g_strdup ("Amount");
+                       field->type = GDAEX_QE_FIELD_TYPE_DOUBLE;
+                       field->for_show = TRUE;
+                       field->for_where = TRUE;
+                       field->for_order = TRUE;
+                       field->available_where_type = GDAEX_QE_WHERE_TYPE_NUMBER;
+                       gdaex_query_editor_table_add_field (qe, "orders", *field);
+                       g_free (field);
+               }
+
+       widget_qe = gdaex_query_editor_get_widget (qe);
+       gtk_box_pack_start (GTK_BOX (vbox), widget_qe, TRUE, TRUE, 5);
+}
+
+static void
+on_btn_destroy_clicked (GtkButton *button,
+                      gpointer user_data)
+{
+       if (widget_qe != NULL)
+               {
+                       g_object_unref (G_OBJECT (qe));
+                       widget_qe = NULL;
+               }
+       else
+               {
+                       do_query_editor ();
+               }
+}
+
 static void
 on_btn_clean_clicked (GtkButton *button,
                       gpointer user_data)
@@ -188,21 +369,7 @@ main (int argc, char *argv[])
 
        GOptionContext *context;
 
-       GdaEx *gdaex;
-       GdaExQueryEditor *qe;
-
-       GdaExQueryEditorField *field;
-
-       GtkWidget *vbox;
-       GtkWidget *widget_qe;
        GtkWidget *hbtnbox;
-       GtkWidget *btn_clean;
-       GtkWidget *btn_get_sql;
-       GtkWidget *btn_save_xml;
-       GtkWidget *btn_load_xml;
-       GtkWidget *btn_ok;
-
-       gchar *xmlfile;
 
        xmlfile = NULL;
 
@@ -231,147 +398,6 @@ main (int argc, char *argv[])
                        g_warning ("Error on command line parsing: %s", error->message);
                }
 
-       qe = gdaex_query_editor_new (gdaex);
-
-       if (xmlfile != NULL)
-               {
-                       gdaex_query_editor_load_tables_from_file (qe, xmlfile, TRUE);
-               }
-       else
-               {
-                       gdaex_query_editor_add_table (qe, "clients", "Clients");
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("id");
-                       field->name_visible = g_strdup ("ID");
-                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
-                       field->for_show = TRUE;
-                       field->always_showed = TRUE;
-                       field->for_where = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_EQUAL;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("name");
-                       field->name_visible = g_strdup ("Name");
-                       field->description = g_strdup ("The client's name");
-                       field->type = GDAEX_QE_FIELD_TYPE_TEXT;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_STARTS
-                                                     | GDAEX_QE_WHERE_TYPE_CONTAINS
-                                                     | GDAEX_QE_WHERE_TYPE_ENDS
-                                                     | GDAEX_QE_WHERE_TYPE_ISTARTS
-                                                     | GDAEX_QE_WHERE_TYPE_ICONTAINS
-                                                     | GDAEX_QE_WHERE_TYPE_IENDS;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("surname");
-                       field->name_visible = g_strdup ("Surname");
-                       field->description = g_strdup ("The client's surname");
-                       field->type = GDAEX_QE_FIELD_TYPE_TEXT;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_STRING
-                                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("brithday");
-                       field->name_visible = g_strdup ("Birthday");
-                       field->description = g_strdup ("The client's birthday");
-                       field->type = GDAEX_QE_FIELD_TYPE_DATE;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_DATETIME
-                                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("age");
-                       field->name_visible = g_strdup ("Age");
-                       field->description = g_strdup ("The client's age");
-                       field->alias = g_strdup ("client_age");
-                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_NUMBER;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("datetime");
-                       field->name_visible = g_strdup ("DateTime");
-                       field->description = g_strdup ("???");
-                       field->type = GDAEX_QE_FIELD_TYPE_DATETIME;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_DATETIME
-                                     | GDAEX_QE_WHERE_TYPE_IS_NULL;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("id_cities");
-                       field->name_visible = g_strdup ("City");
-                       field->description = g_strdup ("The client's city");
-                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->decode_table2 = g_strdup ("cities");
-                       field->decode_join_type = GDAEX_QE_JOIN_TYPE_LEFT;
-                       /*field->decode_fields1 = g_slist_append (field->decode_fields1, "id_cities");
-                       field->decode_fields2 = g_slist_append (field->decode_fields2, "id");*/
-                       field->decode_field2 = g_strdup ("id");
-                       field->decode_field_to_show = g_strdup ("name");
-                       field->decode_field_alias = g_strdup ("city_name");
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_EQUAL;
-                       gdaex_query_editor_table_add_field (qe, "clients", *field);
-                       g_free (field);
-
-                       gdaex_query_editor_add_table (qe, "orders", "Orders");
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("id");
-                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
-                       gdaex_query_editor_table_add_field (qe, "orders", *field);
-                       g_free (field);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("id_clients");
-                       field->type = GDAEX_QE_FIELD_TYPE_INTEGER;
-                       gdaex_query_editor_table_add_field (qe, "orders", *field);
-                       g_free (field);
-
-                       gdaex_query_editor_add_relation (qe,
-                                                        "clients", "orders",
-                                                        GDAEX_QE_JOIN_TYPE_LEFT,
-                                                        "id", "id_clients",
-                                                        NULL);
-
-                       field = g_new0 (GdaExQueryEditorField, 1);
-                       field->name = g_strdup ("amount");
-                       field->name_visible = g_strdup ("Amount");
-                       field->type = GDAEX_QE_FIELD_TYPE_DOUBLE;
-                       field->for_show = TRUE;
-                       field->for_where = TRUE;
-                       field->for_order = TRUE;
-                       field->available_where_type = GDAEX_QE_WHERE_TYPE_NUMBER;
-                       gdaex_query_editor_table_add_field (qe, "orders", *field);
-                       g_free (field);
-               }
-
        w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_window_set_default_size (GTK_WINDOW (w), 610, 400);
        gtk_window_set_modal (GTK_WINDOW (w), TRUE);
@@ -382,39 +408,43 @@ main (int argc, char *argv[])
        vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
        gtk_container_add (GTK_CONTAINER (w), vbox);
 
-       widget_qe = gdaex_query_editor_get_widget (qe);
-       gtk_box_pack_start (GTK_BOX (vbox), widget_qe, TRUE, TRUE, 5);
-
        hbtnbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_button_box_set_layout (GTK_BUTTON_BOX (hbtnbox), GTK_BUTTONBOX_END);
        gtk_box_set_spacing (GTK_BOX (hbtnbox), 5);
        gtk_box_pack_start (GTK_BOX (vbox), hbtnbox, FALSE, FALSE, 5);
 
+       btn_destroy = gtk_button_new_with_mnemonic ("_Destroy");
+       gtk_box_pack_start (GTK_BOX (hbtnbox), btn_destroy, TRUE, TRUE, 5);
+       g_signal_connect (G_OBJECT (btn_destroy), "clicked",
+                         G_CALLBACK (on_btn_destroy_clicked), NULL);
+
        btn_clean = gtk_button_new_from_stock ("gtk-clear");
        gtk_box_pack_start (GTK_BOX (hbtnbox), btn_clean, TRUE, TRUE, 5);
        g_signal_connect (G_OBJECT (btn_clean), "clicked",
-                         G_CALLBACK (on_btn_clean_clicked), qe);
+                         G_CALLBACK (on_btn_clean_clicked), NULL);
 
        btn_get_sql = gtk_button_new_with_mnemonic ("Get _Sql");
        gtk_box_pack_start (GTK_BOX (hbtnbox), btn_get_sql, TRUE, TRUE, 5);
        g_signal_connect (G_OBJECT (btn_get_sql), "clicked",
-                         G_CALLBACK (on_btn_get_sql_clicked), qe);
+                         G_CALLBACK (on_btn_get_sql_clicked), NULL);
 
        btn_save_xml = gtk_button_new_from_stock ("gtk-save");
        gtk_box_pack_start (GTK_BOX (hbtnbox), btn_save_xml, TRUE, TRUE, 5);
        g_signal_connect (G_OBJECT (btn_save_xml), "clicked",
-                         G_CALLBACK (on_btn_save_xml_clicked), qe);
+                         G_CALLBACK (on_btn_save_xml_clicked), NULL);
 
        btn_load_xml = gtk_button_new_from_stock ("gtk-open");
        gtk_box_pack_start (GTK_BOX (hbtnbox), btn_load_xml, TRUE, TRUE, 5);
        g_signal_connect (G_OBJECT (btn_load_xml), "clicked",
-                         G_CALLBACK (on_btn_load_xml_clicked), qe);
+                         G_CALLBACK (on_btn_load_xml_clicked), NULL);
 
        btn_ok = gtk_button_new_from_stock ("gtk-close");
        gtk_box_pack_start (GTK_BOX (hbtnbox), btn_ok, TRUE, TRUE, 5);
        g_signal_connect (G_OBJECT (btn_ok), "clicked",
                          gtk_main_quit, NULL);
 
+       do_query_editor ();
+
        gtk_widget_show_all (w);
 
        gtk_main ();