[libgda] Browser: show error message on meta data update fail
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Browser: show error message on meta data update fail
- Date: Tue, 31 Jul 2018 19:57:34 +0000 (UTC)
commit 74850cef37b55e943d3f74dd9b3493657a20cdc2
Author: Daniel Espinosa <esodan gmail com>
Date: Tue Jul 31 12:13:00 2018 -0500
Browser: show error message on meta data update fail
tools/browser/browser-window.c | 24 ++++++++++++++++++++++--
tools/common/t-connection.c | 20 ++++++++------------
tools/common/t-connection.h | 2 +-
3 files changed, 31 insertions(+), 15 deletions(-)
---
diff --git a/tools/browser/browser-window.c b/tools/browser/browser-window.c
index bd4166fb7..d59cc2ebc 100644
--- a/tools/browser/browser-window.c
+++ b/tools/browser/browser-window.c
@@ -670,7 +670,13 @@ connection_properties_cb (G_GNUC_UNUSED GSimpleAction *action, GVariant *paramet
}
/* update meta store */
- t_connection_update_meta_data (bwin->priv->tcnc);
+ t_connection_update_meta_data (bwin->priv->tcnc, &error);
+ if (error != NULL) {
+ ui_show_error ((GtkWindow*) bwin,
+ _("Error updating meta data for connection: %s"),
+ error && error->message ? error->message : _("No detail"));
+ g_clear_error (&error);
+ }
}
gtk_widget_destroy (win);
}
@@ -681,8 +687,22 @@ connection_properties_cb (G_GNUC_UNUSED GSimpleAction *action, GVariant *paramet
static void
connection_meta_update_cb (G_GNUC_UNUSED GSimpleAction *action, GVariant *parameter, gpointer data)
{
+ GError *error = NULL;
BrowserWindow *bwin = BROWSER_WINDOW (data);
- t_connection_update_meta_data (bwin->priv->tcnc);
+ t_connection_update_meta_data (bwin->priv->tcnc, &error);
+ if (error != NULL) {
+ GtkWidget *msg;
+ msg = gtk_message_dialog_new_with_markup (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ _("Error Updating Meta Data: %s"),
+ error->message ? error->message : _("No detail")
+ );
+ gtk_dialog_run (GTK_DIALOG (msg));
+ gtk_widget_destroy (msg);
+ g_clear_error (&error);
+ }
//gtk_widget_insert_action_group (GTK_WIDGET (bwin), "win", NULL);
}
diff --git a/tools/common/t-connection.c b/tools/common/t-connection.c
index 7040c4b6f..9028e8b70 100644
--- a/tools/common/t-connection.c
+++ b/tools/common/t-connection.c
@@ -1191,7 +1191,7 @@ t_connection_is_busy (TConnection *tcnc, gchar **out_reason)
* Make @tcnc update its meta store in the background.
*/
void
-t_connection_update_meta_data (TConnection *tcnc)
+t_connection_update_meta_data (TConnection *tcnc, GError ** error)
{
g_return_if_fail (T_IS_CONNECTION (tcnc));
@@ -1199,19 +1199,15 @@ t_connection_update_meta_data (TConnection *tcnc)
GdaMetaContext context = {"_tables", 0, NULL, NULL};
gboolean result;
- GError *error = NULL;
- result = gda_connection_update_meta_store (tcnc->priv->cnc, &context, &error);
-
- t_connection_set_busy_state (tcnc, FALSE, NULL);
-
- if (!result) {
- gchar *tmp;
+ result = gda_connection_update_meta_store (tcnc->priv->cnc, &context, error);
+ if (!result) {
+ gchar *tmp;
tmp = g_strdup_printf (_("Error while fetching meta data from the connection: %s"),
- error->message ? error->message : _("No detail"));
- g_clear_error (&error);
+ (*error)->message ? (*error)->message : _("No detail"));
g_signal_emit (tcnc, t_connection_signals [NOTICE], 0, tmp);
- g_free (tmp);
- }
+ return;
+ }
+ t_connection_set_busy_state (tcnc, FALSE, NULL);
}
/**
diff --git a/tools/common/t-connection.h b/tools/common/t-connection.h
index 6fb1b65f4..313f29ea2 100644
--- a/tools/common/t-connection.h
+++ b/tools/common/t-connection.h
@@ -91,7 +91,7 @@ const GdaDsnInfo *t_connection_get_dsn_information (TConnection *tcnc);
gboolean t_connection_is_busy (TConnection *tcnc, gchar **out_reason);
gboolean t_connection_is_virtual (TConnection *tcnc);
-void t_connection_update_meta_data (TConnection *tcnc);
+void t_connection_update_meta_data (TConnection *tcnc, GError **error);
void t_connection_meta_data_changed (TConnection *tcnc);
GdaMetaStruct *t_connection_get_meta_struct (TConnection *tcnc);
GdaMetaStore *t_connection_get_meta_store (TConnection *tcnc);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]