</child>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="menuitem3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Utilities</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkMenuItem" id="menuitem5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Add _all tables</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_mnu_utilities_add_all_tables_activate"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkMenuItem" id="menuitem4">
<property name="visible">True</property>
<property name="type_hint">normal</property>
<property name="program_name">Audit GUI</property>
<property name="version">0.0.1</property>
- <property name="copyright" translatable="yes">Andrea Zagli 2010</property>
+ <property name="copyright" translatable="yes">Andrea Zagli 2010-2011</property>
<property name="authors">Andrea Zagli <azagli@libero.it></property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
</object>
</child>
</object>
+ <object class="GtkWindow" id="w_progress">
+ <property name="title" translatable="yes">Audit GUI</property>
+ <property name="modal">True</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="default_width">550</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="decorated">False</property>
+ <child>
+ <object class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">label</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkProgressBar" id="progressbar1">
+ <property name="visible">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
</interface>
/*
- * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2011 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 <glib-object.h>
#include <gtk/gtk.h>
-#include <libgdaex.h>
#include "commons.h"
error = NULL;
gtk_builder_add_objects_from_file (priv->commons->gtkbuilder, priv->commons->guifile,
- g_strsplit (g_strconcat ("tstore_ds_tables_fields|",
- "vbox5",
- NULL), "|", -1),
+ g_strsplit ("tstore_ds_tables_fields"
+ "|w_progress"
+ "|vbox5",
+ "|", -1),
&error);
if (error != NULL)
{
GtkWidget
*datasources_get_widget (Datasources *datasources)
{
- DatasourcesPrivate *priv = DATASOURCES_GET_PRIVATE (datasources);
+ DatasourcesPrivate *priv;
+
+ g_return_val_if_fail (IS_DATASOURCES (datasources), NULL);
+
+ priv = DATASOURCES_GET_PRIVATE (datasources);
return priv->widget;
}
+/**
+ * datasources_add_all_tables:
+ * @datasources:
+ *
+ */
+void
+datasources_add_all_tables (Datasources *datasources)
+{
+ DatasourcesPrivate *priv;
+
+ GtkWidget *dialog;
+ GtkTreeIter iter;
+
+ guint id_ds;
+ guint depth;
+ GtkTreePath *path;
+
+ g_return_if_fail (IS_DATASOURCES (datasources));
+
+ priv = DATASOURCES_GET_PRIVATE (datasources);
+
+ if (gtk_tree_selection_get_selected (priv->selection, NULL, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_datasources), &iter,
+ COL_ID_DS, &id_ds,
+ -1);
+
+ if (id_ds == 0)
+ {
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->tstore_datasources), &iter);
+ if (path != NULL)
+ {
+ depth = gtk_tree_path_get_depth (path);
+
+ if (depth >= 2) gtk_tree_path_up (path);
+ if (depth >= 3) gtk_tree_path_up (path);
+
+ if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->tstore_datasources), &iter, path))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->tstore_datasources), &iter,
+ COL_ID_DS, &id_ds,
+ -1);
+ }
+ }
+ }
+
+ if (id_ds != 0)
+ {
+ dialog = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_progress"));
+ gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")),
+ "Updating data store");
+ gtk_widget_show_all (dialog);
+ gtk_widget_show_now (dialog);
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_label_set_text (GTK_LABEL (gtk_builder_get_object (priv->commons->gtkbuilder, "label10")),
+ "Adding table «table_name»");
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ g_usleep (3000000);
+ gtk_progress_bar_pulse (GTK_PROGRESS_BAR (gtk_builder_get_object (priv->commons->gtkbuilder, "progressbar1")));
+ while (gtk_events_pending ()) gtk_main_iteration ();
+ gtk_widget_hide_all (dialog);
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Select a datasource.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ }
+ else
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_builder_get_object (priv->commons->gtkbuilder, "w_main")),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Select a datasource.");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+}
+
/* PRIVATE */
static void
datasources_load_fields (Datasources *datasources, guint id_table, GtkTreeIter *iter_parent)
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <libgdaex.h>
#include "commons.h"
GtkWidget *datasources_get_widget (Datasources *datasources);
+void datasources_add_all_tables (Datasources *datasources);
+
G_END_DECLS
static GtkWidget *vbx_body;
static GtkWidget *vbx_body_child;
+static Datasources *datasources;
+
static void
main_set_vbx_body_child (GtkWidget *child)
{
gchar *cnc;
gchar *pos;
- Datasources *m;
-
if (arg1 == NULL)
{
return;
commons->gdaparser = gda_sql_parser_new ();
}
- m = datasources_new (commons);
+ datasources = datasources_new (commons);
- vbx = datasources_get_widget (m);
+ vbx = datasources_get_widget (datasources);
main_set_vbx_body_child (vbx);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem5")), TRUE);
g_free (cnc);
}
{
gtk_widget_destroy (vbx_body_child);
vbx_body_child = NULL;
+
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem5")), FALSE);
+ g_object_unref (datasources);
+}
+
+G_MODULE_EXPORT void
+on_mnu_utilities_add_all_tables_activate (GtkMenuItem *menuitem,
+ gpointer user_data)
+{
+ datasources_add_all_tables (datasources);
}
G_MODULE_EXPORT void
gtk_widget_show (w);
gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem2")), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (commons->gtkbuilder, "menuitem5")), FALSE);
if (argc > 0)
{
/*
- * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2011 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 <glib-object.h>
#include <gtk/gtk.h>
-#include <libgdaex.h>
#include "commons.h"
/*
- * Copyright (C) 2010 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2011 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 <glib-object.h>
#include <gtk/gtk.h>
-#include <libgdaex.h>
#include "commons.h"