From: Andrea Zagli Date: Sun, 17 Dec 2017 21:11:24 +0000 (+0100) Subject: Removed libgdaui dependency. X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=39f78f588948324d60641f495c63dccd9ac9d56b;p=zakaudit%2Fgui Removed libgdaui dependency. --- diff --git a/.gitignore b/.gitignore index 3d5eeac..f57fca6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ *~ config.h.in intltool*.in -src/audit-gui +src/zak-audit-gui COPYING INSTALL Makefile diff --git a/configure.ac b/configure.ac index 7ca71ff..305b857 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ([2.65]) -AC_INIT([audit-gui], [0.5.0], [azagli@libero.it]) +AC_INIT([zak-audit-gui], [0.5.0], [azagli@libero.it]) AC_CONFIG_SRCDIR([src/main.c]) AC_CONFIG_HEADER([config.h]) @@ -22,14 +22,15 @@ IT_PROG_INTLTOOL([0.35.0]) dnl ****************************** dnl Translations dnl ****************************** -GETTEXT_PACKAGE=audit-gui +GETTEXT_PACKAGE=zak-audit-gui AC_SUBST(GETTEXT_PACKAGE) AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.]) AM_GLIB_GNU_GETTEXT # Checks for libraries. -PKG_CHECK_MODULES(AUDITGUI, [libgda-ui-5.0 >= 5.1.0]) +PKG_CHECK_MODULES(AUDITGUI, [gtk+-3.0 + libgda-5.0 >= 5.1.0]) AC_SUBST(AUDITGUI_CFLAGS) AC_SUBST(AUDITGUI_LIBS) @@ -44,8 +45,8 @@ AC_CONFIG_FILES([ Makefile src/Makefile data/Makefile - data/audit-gui/Makefile - data/audit-gui/gui/Makefile + data/zak-audit-gui/Makefile + data/zak-audit-gui/gui/Makefile po/Makefile.in ]) AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am index f48f1a7..52c3c3c 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1 +1 @@ -SUBDIRS = audit-gui +SUBDIRS = zak-audit-gui diff --git a/data/audit-gui/Makefile.am b/data/audit-gui/Makefile.am deleted file mode 100644 index 13c2b3d..0000000 --- a/data/audit-gui/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -SUBDIRS = gui diff --git a/data/audit-gui/gui/Makefile.am b/data/audit-gui/gui/Makefile.am deleted file mode 100644 index 9fdc923..0000000 --- a/data/audit-gui/gui/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -guidir = $(datadir)/$(PACKAGE)/gui - -gui_DATA = audit-gui.ui - -EXTRA_DIST = $(gui_DATA) diff --git a/data/audit-gui/gui/audit-gui.ui b/data/audit-gui/gui/audit-gui.ui deleted file mode 100644 index 19517c9..0000000 --- a/data/audit-gui/gui/audit-gui.ui +++ /dev/null @@ -1,895 +0,0 @@ - - - - - - False - 5 - normal - Audit GUI - 0.0.1 - Copyright © Andrea Zagli 2010-2015 - Andrea Zagli <azagli@libero.it> - image-missing - - - True - False - vertical - 2 - - - True - False - end - - - False - True - end - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - False - Table - Audit GUI - True - center-on-parent - 450 - 300 - True - - - True - False - 5 - vertical - 5 - - - True - False - 5 - 5 - - - True - False - True - lbl_id - 0 - - - 1 - 0 - - - - - True - False - True - lstore_tables - - - - 0 - - - - - 1 - 1 - - - - - True - False - ID - 0 - - - 0 - 0 - - - - - False - lbl_id_datasources - - - 0 - 2 - - - - - True - False - Table - 0 - - - 0 - 1 - - - - - - - - False - True - 0 - - - - - True - False - 5 - - - True - True - True - etched-in - - - True - True - lstore_fields - False - 0 - - - - - - Fields - - - - 1 - - - - - - - Under audit - - - - 2 - - - - - - - - - True - True - 0 - - - - - True - False - vertical - 5 - spread - - - _Select all - True - True - True - True - - - False - False - 0 - - - - - _Unselect all - True - True - True - True - - - False - False - 1 - - - - - False - True - 1 - - - - - True - True - 1 - - - - - True - False - 5 - end - - - gtk-cancel - True - True - True - True - - - False - False - 0 - - - - - gtk-save - True - True - True - True - - - False - False - 1 - - - - - False - True - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - False - Datasources - Audit GUI - True - center-on-parent - True - - - True - False - 5 - vertical - 5 - - - True - True - etched-in - - - True - True - tstore_ds_tables_fields - False - 0 - - - - - - Objects - - - - 0 - 1 - - - - - - 0 - 2 - - - - - - 3 - 4 - - - - - - 5 - 6 - - - - - - - - - True - True - 0 - - - - - True - False - 5 - end - - - New _Datasource - True - True - True - True - - - False - False - 0 - - - - - New _Table - True - True - True - True - - - False - False - 1 - - - - - gtk-edit - True - True - True - True - - - False - False - 2 - - - - - gtk-delete - True - True - True - True - - - False - False - 3 - - - - - False - True - 1 - - - - - - - False - Datasource - Audit GUI - True - center-on-parent - True - - - True - False - 5 - vertical - 5 - - - True - False - True - True - 5 - 5 - - - True - False - ID - 0 - - - 0 - 0 - - - - - True - False - True - lbl_id - 0 - - - 1 - 0 - - - - - True - True - True - 30 - ● - False - False - - - 1 - 1 - - - - - True - False - Name - - - 0 - 1 - - - - - True - False - True - True - 0 - - - - - - True - False - <b>Connection string</b> - True - - - - - 0 - 2 - 2 - - - - - True - True - 0 - - - - - True - False - 5 - end - - - gtk-cancel - True - True - True - True - - - False - False - 0 - - - - - gtk-save - True - True - True - True - - - False - False - 1 - - - - - False - True - 1 - - - - - - - False - Audit GUI - center - 600 - 400 - - - - True - False - vertical - - - True - False - - - True - False - _File - True - - - True - False - - - gtk-open - True - False - True - True - - - - - - gtk-close - True - False - True - True - - - - - - True - False - - - - - gtk-quit - True - False - True - True - - - - - - - - - - True - False - _Utilities - True - - - True - False - - - True - False - Add _all tables and fields - True - - - - - - - - - - True - False - _Help - True - - - True - False - - - gtk-about - True - False - True - True - - - - - - - - - - False - True - 0 - - - - - True - False - - - - - - True - True - 1 - - - - - True - False - 2 - - - False - True - 2 - - - - - - - False - Open Audit Datasource - Audit GUI - True - center-on-parent - True - - - True - False - 5 - vertical - 5 - - - True - False - 5 - - - True - False - Table name prefix - 0 - - - False - True - 0 - - - - - True - True - ● - False - False - - - True - True - 1 - - - - - False - True - 0 - - - - - - - - True - False - 5 - end - - - gtk-cancel - True - True - True - True - - - False - False - 0 - - - - - gtk-open - True - True - True - True - - - False - False - 1 - - - - - False - True - 2 - - - - - - - False - Audit GUI - True - center-on-parent - 550 - True - False - - - True - False - 5 - vertical - 5 - - - True - False - label - - - False - True - 0 - - - - - True - False - - - False - True - 1 - - - - - - diff --git a/data/zak-audit-gui/Makefile.am b/data/zak-audit-gui/Makefile.am new file mode 100644 index 0000000..13c2b3d --- /dev/null +++ b/data/zak-audit-gui/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = gui diff --git a/data/zak-audit-gui/gui/Makefile.am b/data/zak-audit-gui/gui/Makefile.am new file mode 100644 index 0000000..9fdc923 --- /dev/null +++ b/data/zak-audit-gui/gui/Makefile.am @@ -0,0 +1,5 @@ +guidir = $(datadir)/$(PACKAGE)/gui + +gui_DATA = audit-gui.ui + +EXTRA_DIST = $(gui_DATA) diff --git a/data/zak-audit-gui/gui/audit-gui.ui b/data/zak-audit-gui/gui/audit-gui.ui new file mode 100644 index 0000000..4b3d453 --- /dev/null +++ b/data/zak-audit-gui/gui/audit-gui.ui @@ -0,0 +1,940 @@ + + + + + + False + 5 + normal + ZakAudit GUI + 0.5.0 + Copyright © Andrea Zagli 2010-2017 + Andrea Zagli <azagli@libero.it> + image-missing + + + True + False + vertical + 2 + + + True + False + end + + + False + True + end + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Table - ZakAudit GUI + True + center-on-parent + 450 + 300 + True + + + True + False + 5 + vertical + 5 + + + True + False + 5 + 5 + + + True + False + True + lbl_id + 0 + + + 1 + 0 + + + + + True + False + True + lstore_tables + + + + 0 + + + + + 1 + 1 + + + + + True + False + ID + 0 + + + 0 + 0 + + + + + False + lbl_id_datasources + + + 0 + 2 + + + + + True + False + Table + 0 + + + 0 + 1 + + + + + + + + False + True + 0 + + + + + True + False + 5 + + + True + True + True + etched-in + + + True + True + lstore_fields + False + 0 + + + + + + Fields + + + + 1 + + + + + + + Under audit + + + + 2 + + + + + + + + + True + True + 0 + + + + + True + False + vertical + 5 + spread + + + _Select all + True + True + True + True + + + False + False + 0 + + + + + _Unselect all + True + True + True + True + + + False + False + 1 + + + + + False + True + 1 + + + + + True + True + 1 + + + + + True + False + 5 + end + + + gtk-cancel + True + True + True + True + + + False + False + 0 + + + + + gtk-save + True + True + True + True + + + False + False + 1 + + + + + False + True + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + False + Datasources - ZakAudit GUI + True + center-on-parent + True + + + True + False + 5 + vertical + 5 + + + True + True + etched-in + + + True + True + tstore_ds_tables_fields + False + 0 + + + + + + Objects + + + + 0 + 1 + + + + + + 0 + 2 + + + + + + 3 + 4 + + + + + + 5 + 6 + + + + + + + + + True + True + 0 + + + + + True + False + 5 + end + + + New _Datasource + True + True + True + True + + + False + False + 0 + + + + + New _Table + True + True + True + True + + + False + False + 1 + + + + + gtk-edit + True + True + True + True + + + False + False + 2 + + + + + gtk-delete + True + True + True + True + + + False + False + 3 + + + + + False + True + 1 + + + + + + + + + + False + Datasource - ZakAudit GUI + True + center-on-parent + True + + + True + False + 5 + vertical + 5 + + + True + False + True + True + 5 + 5 + + + True + False + ID + 0 + + + 0 + 0 + + + + + True + False + True + lbl_id + 0 + + + 1 + 0 + + + + + True + True + True + 30 + ● + False + False + + + 1 + 1 + + + + + True + False + Name + 0 + + + 0 + 1 + + + + + True + False + Connection string + 0 + + + 0 + 2 + + + + + True + True + True + ● + False + False + + + 1 + 2 + + + + + True + True + 0 + + + + + True + False + 5 + end + + + gtk-cancel + True + True + True + True + + + False + False + 0 + + + + + gtk-save + True + True + True + True + + + False + False + 1 + + + + + False + True + 1 + + + + + + + + + + False + ZakAudit GUI + center + 600 + 400 + + + + True + False + vertical + + + True + False + + + True + False + _File + True + + + True + False + + + gtk-open + True + False + True + True + + + + + + gtk-close + True + False + True + True + + + + + + True + False + + + + + gtk-quit + True + False + True + True + + + + + + + + + + True + False + _Utilities + True + + + True + False + + + True + False + Add _all tables and fields + True + + + + + + + + + + True + False + _Help + True + + + True + False + + + gtk-about + True + False + True + True + + + + + + + + + + False + True + 0 + + + + + True + False + + + + + + True + True + 1 + + + + + True + False + 2 + + + False + True + 2 + + + + + + + + + + False + Open Audit Datasource - ZakAudit GUI + True + center-on-parent + True + + + True + False + 5 + vertical + 5 + + + True + False + 5 + 5 + + + True + False + Table name prefix + 0 + + + 0 + 1 + + + + + True + True + ● + False + False + + + 1 + 1 + + + + + True + False + Connection string + 0 + + + 0 + 0 + + + + + True + True + True + ● + False + False + + + 1 + 0 + + + + + False + True + 0 + + + + + True + False + 5 + end + + + gtk-cancel + True + True + True + True + + + False + False + 0 + + + + + gtk-open + True + True + True + True + + + False + False + 1 + + + + + False + True + 1 + + + + + + + + + + False + ZakAudit GUI + True + center-on-parent + 550 + True + False + + + True + False + 5 + vertical + 5 + + + True + False + label + + + False + True + 0 + + + + + True + False + + + False + True + 1 + + + + + + + + + diff --git a/src/Makefile.am b/src/Makefile.am index 44a6887..81c0c9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,9 +7,9 @@ AM_CPPFLAGS = $(AUDITGUI_CFLAGS) \ LIBS = $(AUDITGUI_LIBS) \ -export-dynamic -bin_PROGRAMS = audit-gui +bin_PROGRAMS = zak-audit-gui -audit_gui_SOURCES = \ +zak_audit_gui_SOURCES = \ commons.h \ datasource.c \ datasource.h \ diff --git a/src/datasource.c b/src/datasource.c index efc9de2..df96c2a 100644 --- a/src/datasource.c +++ b/src/datasource.c @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-2015 Andrea Zagli +/* + * Copyright (C) 2010-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ #include -#include +#include #include #include "datasource.h" @@ -43,10 +43,6 @@ static void datasource_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void datasource_on_wlogin_changed (GdauiLogin *gdauilogin, - gboolean arg1, - gpointer user_data); - static void datasource_on_btn_cancel_clicked (GtkButton *button, gpointer user_data); static void datasource_on_btn_save_clicked (GtkButton *button, @@ -60,7 +56,7 @@ struct _DatasourcePrivate Commons *commons; GtkWidget *w; - GtkWidget *wlogin; + GtkWidget *txt_cnc_string; gint id; }; @@ -110,7 +106,6 @@ Datasource *datasource_new (Commons *commons, gint id) { GError *error; - GdauiLoginMode mode; Datasource *a = DATASOURCE (g_object_new (datasource_get_type (), NULL)); @@ -129,27 +124,13 @@ Datasource } priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_datasource")); + priv->txt_cnc_string = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "entry4")); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button3"), "clicked", G_CALLBACK (datasource_on_btn_cancel_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button4"), "clicked", G_CALLBACK (datasource_on_btn_save_clicked), (gpointer *)a); - /* creating login widget */ - priv->wlogin = gdaui_login_new (NULL); - - g_object_get (G_OBJECT (priv->wlogin), "mode", &mode, NULL); - mode |= GDA_UI_LOGIN_HIDE_DSN_SELECTION_MODE; - gdaui_login_set_mode (GDAUI_LOGIN (priv->wlogin), mode); - - g_signal_connect (G_OBJECT (priv->wlogin), "changed", - G_CALLBACK (datasource_on_wlogin_changed), (gpointer *)a); - - gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->commons->gtkbuilder, "frame1")), - priv->wlogin); - - gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button4")), FALSE); - priv->id = id; if (priv->id == 0) { @@ -187,9 +168,6 @@ datasource_load (Datasource *datasource) gchar *sql; GdaStatement *stmt; GdaDataModel *dm; - GdaDsnInfo *info; - gchar *username; - gchar *password; sql = g_strdup_printf ("SELECT id, name, cnc_string FROM datasources WHERE id = %d", priv->id); @@ -201,25 +179,8 @@ datasource_load (Datasource *datasource) gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry1")), gda_value_stringify (gda_data_model_get_value_at (dm, 1, 0, NULL))); - info = g_malloc0 (sizeof (GdaDsnInfo)); - gda_connection_string_split (gda_value_stringify (gda_data_model_get_value_at (dm, 2, 0, NULL)), - &info->cnc_string, - &info->provider, - &username, - &password); - info->auth_string = g_strdup (""); - if (username != NULL && g_strcmp0 (g_strstrip (username), "") != 0) - { - info->auth_string = g_strdup_printf ("USERNAME=%s", username); - } - if (password != NULL && g_strcmp0 (g_strstrip (password), "") != 0) - { - info->auth_string = g_strconcat (info->auth_string, - (g_strcmp0 (info->auth_string, "") != 0 ? ";" : ""), - g_strdup_printf ("PASSWORD=%s", password), - NULL); - } - gdaui_login_set_connection_information (GDAUI_LOGIN (priv->wlogin), info); + gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry4")), + gda_value_stringify (gda_data_model_get_value_at (dm, 2, 0, NULL))); } else { @@ -237,24 +198,19 @@ datasource_load (Datasource *datasource) static void datasource_save (Datasource *datasource) { - const GdaDsnInfo *info; GError *error; gchar *sql; GdaStatement *stmt; GdaDataModel *dm; GtkWidget *dialog; - gchar *cncstring; + GString *cncstring; DatasourceClass *klass = DATASOURCE_GET_CLASS (datasource); DatasourcePrivate *priv = DATASOURCE_GET_PRIVATE (datasource); - info = gdaui_login_get_connection_information (GDAUI_LOGIN (priv->wlogin)); - - cncstring = g_strconcat (info->provider, "://", - (info->auth_string != NULL ? g_strdup_printf ("%s;", info->auth_string) : ""), - info->cnc_string, NULL); + cncstring = g_string_new (gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry4")))); if (priv->id == 0) { @@ -276,7 +232,7 @@ datasource_save (Datasource *datasource) " VALUES (%d, '%s', '%s')", new_id, gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry1"))), - cncstring); + cncstring->str); stmt = gda_sql_parser_parse_string (priv->commons->gdaparser, sql, NULL, NULL); } else @@ -287,7 +243,7 @@ datasource_save (Datasource *datasource) " cnc_string = '%s'" " WHERE id = %d", gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry1"))), - cncstring, + cncstring->str, priv->id); stmt = gda_sql_parser_parse_string (priv->commons->gdaparser, sql, NULL, NULL); } @@ -361,22 +317,6 @@ datasource_get_property (GObject *object, guint property_id, GValue *value, GPar } /* CALLBACK */ -static void -datasource_on_wlogin_changed (GdauiLogin *gdauilogin, - gboolean arg1, - gpointer user_data) -{ - Datasource *ds = (Datasource *)user_data; - - DatasourcePrivate *priv = DATASOURCE_GET_PRIVATE (ds); - - gboolean is_valid; - - g_object_get (G_OBJECT (priv->wlogin), "valid", &is_valid, NULL); - gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button4")), - is_valid); -} - static void datasource_on_btn_cancel_clicked (GtkButton *button, gpointer user_data) diff --git a/src/datasources.c b/src/datasources.c index 7db6cff..e695e94 100644 --- a/src/datasources.c +++ b/src/datasources.c @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-2015 Andrea Zagli +/* + * Copyright (C) 2010-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -294,21 +294,18 @@ datasources_add_all_tables (Datasources *datasources) priv->update_metastore_datasource_id = id_ds; priv->update_metastore_ended = FALSE; priv->error_update_metastore = NULL; - - error = NULL; - thr = g_thread_create (datasources_update_metastore, - (gpointer)datasources, - FALSE, - &error); - if (thr == NULL || error != NULL) + + thr = g_thread_new (NULL, + datasources_update_metastore, + (gpointer)datasources); + if (thr == NULL) { gtk_widget_hide (dialog); 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, - _("Unable to update the metastore: %s"), - error != NULL && error->message != NULL ? error->message : "no details"); + _("Unable to update the metastore")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return; @@ -829,7 +826,7 @@ GdaConnection { cnc = gda_value_stringify (gda_data_model_get_value_at (dm, 0, 0, NULL)); g_object_unref (dm); - } + } } else { @@ -1239,7 +1236,7 @@ datasources_on_btn_delete_clicked (GtkButton *button, stmt = gda_sql_parser_parse_string (priv->commons->gdaparser, g_strdup_printf ("UPDATE %stables SET status = 'D' WHERE id = %d", priv->commons->prefix, id), NULL, NULL); - + } } diff --git a/src/openauditds.c b/src/openauditds.c index 52e1508..4a9fbc3 100644 --- a/src/openauditds.c +++ b/src/openauditds.c @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-2015 Andrea Zagli +/* + * Copyright (C) 2010-2017 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,7 +23,7 @@ #include -#include +#include #include "openauditds.h" @@ -39,10 +39,6 @@ static void open_audit_ds_get_property (GObject *object, GValue *value, GParamSpec *pspec); -static void open_audit_ds_on_wlogin_changed (GdauiLogin *gdauilogin, - gboolean arg1, - gpointer user_data); - static void open_audit_ds_on_btn_cancel_clicked (GtkButton *button, gpointer user_data); static void open_audit_ds_on_btn_open_clicked (GtkButton *button, @@ -56,7 +52,7 @@ struct _OpenAuditDSPrivate Commons *commons; GtkWidget *w; - GtkWidget *wlogin; + GtkWidget *txt_cnc_string; }; G_DEFINE_TYPE (OpenAuditDS, open_audit_ds, G_TYPE_OBJECT) @@ -105,8 +101,6 @@ OpenAuditDS { GError *error; - GdauiLoginMode mode; - OpenAuditDS *a = OPEN_AUDIT_DS (g_object_new (open_audit_ds_get_type (), NULL)); OpenAuditDSPrivate *priv = OPEN_AUDIT_DS_GET_PRIVATE (a); @@ -124,29 +118,13 @@ OpenAuditDS } priv->w = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "w_open_audit_datasource")); + priv->txt_cnc_string = GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "entry3")); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button1"), "clicked", G_CALLBACK (open_audit_ds_on_btn_cancel_clicked), (gpointer *)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button2"), "clicked", G_CALLBACK (open_audit_ds_on_btn_open_clicked), (gpointer *)a); - /* creating login widget */ - priv->wlogin = gdaui_login_new (NULL); - - g_object_get (G_OBJECT (priv->wlogin), "mode", &mode, NULL); - mode |= GDA_UI_LOGIN_HIDE_DSN_SELECTION_MODE; - gdaui_login_set_mode (GDAUI_LOGIN (priv->wlogin), mode); - - g_signal_connect (G_OBJECT (priv->wlogin), "changed", - G_CALLBACK (open_audit_ds_on_wlogin_changed), (gpointer *)a); - - gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "vbox2")), - priv->wlogin, TRUE, TRUE, 0); - gtk_box_reorder_child (GTK_BOX (gtk_builder_get_object (priv->commons->gtkbuilder, "vbox2")), - priv->wlogin, 0); - - gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button2")), FALSE); - return a; } @@ -195,22 +173,6 @@ open_audit_ds_get_property (GObject *object, guint property_id, GValue *value, G } /* CALLBACK */ -static void -open_audit_ds_on_wlogin_changed (GdauiLogin *gdauilogin, - gboolean arg1, - gpointer user_data) -{ - OpenAuditDS *open_audit_ds = (OpenAuditDS *)user_data; - - OpenAuditDSPrivate *priv = OPEN_AUDIT_DS_GET_PRIVATE (open_audit_ds); - - gboolean is_valid; - - g_object_get (G_OBJECT (priv->wlogin), "valid", &is_valid, NULL); - gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "button2")), - is_valid); -} - static void open_audit_ds_on_btn_cancel_clicked (GtkButton *button, gpointer user_data) @@ -230,18 +192,14 @@ open_audit_ds_on_btn_open_clicked (GtkButton *button, OpenAuditDSPrivate *priv = OPEN_AUDIT_DS_GET_PRIVATE (open_audit_ds); OpenAuditDSClass *klass = OPEN_AUDIT_DS_GET_CLASS (open_audit_ds); - gchar *cncstring; + GString *cncstring; - const GdaDsnInfo *info; - info = gdaui_login_get_connection_information (GDAUI_LOGIN (priv->wlogin)); + cncstring = g_string_new (gtk_entry_get_text (GTK_ENTRY (priv->txt_cnc_string))); - cncstring = g_strconcat (info->provider, "://", - (info->auth_string != NULL ? g_strdup_printf ("%s;", info->auth_string) : ""), - info->cnc_string, - "{prefix}", gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry2"))), - NULL); + g_string_append_printf (cncstring, + "{prefix}%s", gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry2")))); - g_signal_emit (open_audit_ds, klass->opened_signal_id, 0, cncstring); + g_signal_emit (open_audit_ds, klass->opened_signal_id, 0, cncstring->str); gtk_widget_destroy (priv->w); } diff --git a/src/table.c b/src/table.c index 2f5e6cf..c4a5542 100644 --- a/src/table.c +++ b/src/table.c @@ -1,5 +1,5 @@ -/* - * Copyright (C) 2010-2015 Andrea Zagli +/* + * Copyright (C) 2010-2019 Andrea Zagli * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -292,20 +292,17 @@ table_load_db_tables (Table *table) priv->update_metastore_ended = FALSE; priv->error_update_metastore = NULL; - error = NULL; - thr = g_thread_create (table_update_metastore, - (gpointer)table, - FALSE, - &error); - if (thr == NULL || error != NULL) + thr = g_thread_new (NULL, + table_update_metastore, + (gpointer)table); + if (thr == NULL) { gtk_widget_hide (dialog); 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, - _("Unable to update the metastore: %s"), - error != NULL && error->message != NULL ? error->message : _("no details")); + _("Unable to update the metastore")); gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); return;