[libgda] Fix build with LDAP and Web providers
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda] Fix build with LDAP and Web providers
- Date: Sat, 16 Feb 2019 04:55:35 +0000 (UTC)
commit b612eea4809431e119467b9afb8ef3481705b715
Author: Daniel Espinosa Ortiz <esodan gmail com>
Date: Fri Feb 15 22:54:56 2019 -0600
Fix build with LDAP and Web providers
providers/meson.build | 4 +
providers/postgres/meson.build | 2 +-
providers/web/gda-web-ddl.c | 13 ++-
providers/web/gda-web-recordset.c | 9 +-
providers/web/meson.build | 114 +++++++++++++++++++++
tools/browser/data-manager/data-source.c | 2 +-
tools/browser/dummy-perspective/meson.build | 2 +-
tools/browser/ldap-browser/Makefile.am | 4 +-
tools/browser/ldap-browser/class-properties.c | 2 +-
tools/browser/ldap-browser/entry-properties.c | 2 +-
.../browser/ldap-browser/ldap-favorite-selector.c | 2 +-
tools/browser/ldap-browser/meson.build | 41 ++++++++
tools/browser/meson.build | 8 +-
tools/browser/mgr-favorites.c | 78 +++++++-------
tools/browser/ui-formgrid.c | 25 ++---
tools/common/t-connection.c | 21 ----
tools/common/t-connection.h | 3 -
tools/meson.build | 21 ++--
18 files changed, 251 insertions(+), 102 deletions(-)
---
diff --git a/providers/meson.build b/providers/meson.build
index c42b2c372..b1f87a464 100644
--- a/providers/meson.build
+++ b/providers/meson.build
@@ -26,4 +26,8 @@ endif
if mysql_dep.found()
subdir('mysql')
+endif
+
+if soup_dep.found() and get_option('with-libsoup')
+subdir('web')
endif
\ No newline at end of file
diff --git a/providers/postgres/meson.build b/providers/postgres/meson.build
index 6ecb22306..b5f1a5693 100644
--- a/providers/postgres/meson.build
+++ b/providers/postgres/meson.build
@@ -117,4 +117,4 @@ libgda_postgres_provider = library ('gda-postgres-'+project_api_version,
link_with: libgda,
install: true,
install_dir: join_paths(get_option('libdir'), project_package, 'providers')
- )
+ )
\ No newline at end of file
diff --git a/providers/web/gda-web-ddl.c b/providers/web/gda-web-ddl.c
index 1c2a4258f..3a8e558fa 100644
--- a/providers/web/gda-web-ddl.c
+++ b/providers/web/gda-web-ddl.c
@@ -40,7 +40,7 @@ gda_web_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
/* CREATE TABLE */
string = g_string_new ("CREATE TABLE ");
- tmp = gda_server_operation_get_sql_identifier_at (op, "/TABLE_DEF_P/TABLE_NAME", error);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op, "/TABLE_DEF_P/TABLE_NAME", error);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -62,9 +62,9 @@ gda_web_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
for (i = 0; i < nrows; i++) {
value = gda_server_operation_get_value_at (op, "/FIELDS_A/@COLUMN_PKEY/%d", i);
if (value && G_VALUE_HOLDS (value, G_TYPE_BOOLEAN) && g_value_get_boolean (value)) {
- tmp = gda_server_operation_get_sql_identifier_at (op,
- "/FIELDS_A/@COLUMN_NAME/%d",
- error, i);
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
+
"/FIELDS_A/@COLUMN_NAME/%d",
+ error, i);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
@@ -83,9 +83,8 @@ gda_web_render_CREATE_TABLE (GdaServerProvider *provider, GdaConnection *cnc,
first = FALSE;
else
g_string_append (string, ", ");
-
- tmp = gda_server_operation_get_sql_identifier_at (op,
- "/FIELDS_A/@COLUMN_NAME/%d", error,
i);
+
+ tmp = gda_connection_operation_get_sql_identifier_at (cnc, op,
"/FIELDS_A/@COLUMN_NAME/%d", error, i);
if (!tmp) {
g_string_free (string, TRUE);
return NULL;
diff --git a/providers/web/gda-web-recordset.c b/providers/web/gda-web-recordset.c
index 3446b49fb..55a840d42 100644
--- a/providers/web/gda-web-recordset.c
+++ b/providers/web/gda-web-recordset.c
@@ -25,6 +25,7 @@
#include <libgda/gda-util.h>
#include <libgda/sql-parser/gda-sql-parser.h>
#include <libgda/gda-connection-private.h>
+#include <gda-data-select-extra.h>
#include "gda-web.h"
#include "gda-web-recordset.h"
#include "gda-web-provider.h"
@@ -324,13 +325,13 @@ gda_web_recordset_fetch_nb_rows (GdaDataSelect *model)
GdaWebRecordset *imodel;
imodel = GDA_WEB_RECORDSET (model);
- if (model->advertized_nrows >= 0)
- return model->advertized_nrows;
+ if (_gda_data_select_get_advertized_nrows (model) >= 0)
+ return _gda_data_select_get_advertized_nrows (model);
if (imodel->priv->real_model)
- model->advertized_nrows = gda_data_model_get_n_rows (imodel->priv->real_model);
+ _gda_data_select_set_advertized_nrows (model, gda_data_model_get_n_rows
(imodel->priv->real_model));
- return model->advertized_nrows;
+ return _gda_data_select_get_advertized_nrows (model);
}
/*
diff --git a/providers/web/meson.build b/providers/web/meson.build
new file mode 100644
index 000000000..521b77625
--- /dev/null
+++ b/providers/web/meson.build
@@ -0,0 +1,114 @@
+
+
+inc_gda_webh = include_directories ('.')
+inc_gda_webh_dep = declare_dependency (include_directories : inc_gda_webh)
+
+gda_web_sources = files([
+ 'gda-web-blob-op.c',
+ 'gda-web-blob-op.h',
+ 'gda-web-ddl.c',
+ 'gda-web-ddl.h',
+ 'gda-web-provider.c',
+ 'gda-web-provider.h',
+ 'gda-web-pstmt.h',
+ 'gda-web-pstmt.c',
+ 'gda-web-meta.c',
+ 'gda-web-meta.h',
+ 'gda-web-recordset.c',
+ 'gda-web-recordset.h',
+ 'gda-web-util.h',
+ 'gda-web-util.c',
+ 'gda-web.h',
+ 'libmain.c'
+ ])
+
+gda_web_xml_fnames = [
+ 'web_specs_dsn',
+ 'web_specs_auth'
+ ]
+
+gda_web_xml_res = []
+foreach xt : gda_web_xml_fnames
+ i18n.merge_file(
+ input: xt+'.xml.in',
+ output: xt+'.xml',
+ type: 'xml',
+ po_dir: join_paths(meson.build_root(),'po')
+ )
+ gda_web_xml_res += custom_target(xt+'.raw.xml',
+ command: [raw_spec,
+ '-o', meson.current_build_dir(),
+ '@INPUT@'
+ ],
+ input: xt+'.xml.in',
+ output: xt+'.raw.xml',
+ )
+endforeach
+
+gda_web_resourcesc = custom_target('gda_web_resourcesc',
+ command: [compile_resources,
+ '--sourcedir='+meson.current_build_dir(),
+ '--generate-source',
+ '--target', '@OUTPUT@',
+ '--internal',
+ '@INPUT@'
+ ],
+ input: 'web.gresource.xml',
+ output: 'gda_web_resource.c',
+ depends: gda_web_xml_res,
+ install: false
+ )
+
+gda_web_resourcesh = custom_target('gda_web_resourcesh',
+ command: [compile_resources,
+ '--sourcedir='+meson.current_build_dir(),
+ '--generate-header',
+ '--target', '@OUTPUT@',
+ '--internal',
+ '@INPUT@'
+ ],
+ input: 'web.gresource.xml',
+ output: 'gda_web_resource.h',
+ depends: gda_web_xml_res,
+ install: false
+ )
+gda_web_resources = []
+gda_web_resources += gda_web_resourcesc
+gda_web_resources += gda_web_resourcesh
+
+libgda_web_providerpc = configure_file(
+ input: 'libgda-web-'+project_api_version+'.pc.in',
+ output: 'libgda-web-'+project_api_version+'.pc',
+ configuration : conf,
+ install_dir: join_paths(get_option('libdir'),'pkgconfig')
+ )
+
+libgda_web_sources = []
+libgda_web_sources += gda_web_sources
+libgda_web_sources += gda_web_resources
+libgda_web_sources += libreuseable_sources
+
+libgda_web_provider = library ('gda-web-'+project_api_version,
+ libgda_web_sources,
+ dependencies: [
+ libgda_dep,
+ soup_dep,
+ inc_rooth_dep,
+ inc_libgdah_dep,
+ inc_gda_webh_dep,
+ ],
+ c_args: [
+ '-include',
+ meson.build_root() + '/config.h',
+ ],
+ link_args: [
+ '-export-dynamic',
+ ],
+ link_with: [
+ libgda,
+ libgda_mysql_provider,
+ libgda_postgres_provider
+ ],
+ install: true,
+ install_dir: join_paths(get_option('libdir'), project_package, 'providers')
+ )
diff --git a/tools/browser/data-manager/data-source.c b/tools/browser/data-manager/data-source.c
index 6ba9240f8..21a704856 100644
--- a/tools/browser/data-manager/data-source.c
+++ b/tools/browser/data-manager/data-source.c
@@ -898,7 +898,7 @@ data_source_execute (DataSource *source, GError **error)
if (source->priv->need_rerun) {
source->priv->need_rerun = FALSE;
g_signal_emit (source, data_source_signals [EXEC_STARTED], 0);
- t_connection_rerun_select (source->priv->tcnc, source->priv->model, &lerror);
+ // FIXME: Use a GdaDataModelSelect instead
gda_data_model_dump (source->priv->model, NULL);
g_signal_emit (source, data_source_signals [EXEC_FINISHED], 0, lerror);
}
diff --git a/tools/browser/dummy-perspective/meson.build b/tools/browser/dummy-perspective/meson.build
index e5d6a8d8d..655700a23 100644
--- a/tools/browser/dummy-perspective/meson.build
+++ b/tools/browser/dummy-perspective/meson.build
@@ -1,5 +1,5 @@
-perspective_sources = files([
+dummy_perspective_sources = files([
'perspective-main.c',
'perspective-main.h',
'dummy-perspective.h',
diff --git a/tools/browser/ldap-browser/Makefile.am b/tools/browser/ldap-browser/Makefile.am
index eeeae6e41..d9a071e3d 100644
--- a/tools/browser/ldap-browser/Makefile.am
+++ b/tools/browser/ldap-browser/Makefile.am
@@ -12,9 +12,9 @@ AM_CPPFLAGS = \
$(GTK_CFLAGS) -DHAVE_LDAP \
$(MAC_INTEGRATION_CFLAGS)
-marshal.h: marshal.list $(GLIB_GENMARSHAL)
+perspective-marshal.h: marshal.list $(GLIB_GENMARSHAL)
$(GLIB_GENMARSHAL) $< --header --prefix=_ldap_marshal > $@
-marshal.c: marshal.list $(GLIB_GENMARSHAL) marshal.h
+perspective-marshal.c: marshal.list $(GLIB_GENMARSHAL) marshal.h
$(GLIB_GENMARSHAL) $< --body --prefix=_ldap_marshal > $@
GENFILES = \
diff --git a/tools/browser/ldap-browser/class-properties.c b/tools/browser/ldap-browser/class-properties.c
index 20addba02..2f01a0bd5 100644
--- a/tools/browser/ldap-browser/class-properties.c
+++ b/tools/browser/ldap-browser/class-properties.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include "class-properties.h"
-#include "marshal.h"
+#include "perspective-marshal.h"
#include "../text-search.h"
#include "../ui-support.h"
diff --git a/tools/browser/ldap-browser/entry-properties.c b/tools/browser/ldap-browser/entry-properties.c
index 8a0663359..2a25eff34 100644
--- a/tools/browser/ldap-browser/entry-properties.c
+++ b/tools/browser/ldap-browser/entry-properties.c
@@ -21,7 +21,7 @@
#include <string.h>
#include <gtk/gtk.h>
#include "entry-properties.h"
-#include "marshal.h"
+#include "perspective-marshal.h"
#include <time.h>
#include <libgda-ui/libgda-ui.h>
#include "../ui-support.h"
diff --git a/tools/browser/ldap-browser/ldap-favorite-selector.c
b/tools/browser/ldap-browser/ldap-favorite-selector.c
index 6504745fa..e4906ebb4 100644
--- a/tools/browser/ldap-browser/ldap-favorite-selector.c
+++ b/tools/browser/ldap-browser/ldap-favorite-selector.c
@@ -26,7 +26,7 @@
#include <libgda-ui/gdaui-tree-store.h>
#include "../dnd.h"
#include "../ui-support.h"
-#include "marshal.h"
+#include "perspective-marshal.h"
#include "../gdaui-bar.h"
#include <gdk/gdkkeysyms.h>
#include <libgda-ui/internal/popup-container.h>
diff --git a/tools/browser/ldap-browser/meson.build b/tools/browser/ldap-browser/meson.build
new file mode 100644
index 000000000..a7dc2fac5
--- /dev/null
+++ b/tools/browser/ldap-browser/meson.build
@@ -0,0 +1,41 @@
+inc_ldapbrowserdirh = include_directories ('.')
+inc_ldapbrowserdir_dep = declare_dependency (include_directories : inc_ldapbrowserdirh)
+
+ldap_perspective_sources = files([
+ 'perspective-main.h',
+ 'perspective-main.c',
+ 'ldap-browser-perspective.h',
+ 'ldap-browser-perspective.c',
+ 'ldap-favorite-selector.h',
+ 'ldap-favorite-selector.c',
+ 'ldap-entries-page.c',
+ 'ldap-entries-page.h',
+ 'mgr-ldap-entries.h',
+ 'mgr-ldap-entries.c',
+ 'hierarchy-view.h',
+ 'hierarchy-view.c',
+ 'entry-properties.h',
+ 'entry-properties.c',
+ 'mgr-ldap-classes.h',
+ 'mgr-ldap-classes.c',
+ 'classes-view.h',
+ 'classes-view.c',
+ 'ldap-classes-page.h',
+ 'ldap-classes-page.c',
+ 'class-properties.h',
+ 'class-properties.c',
+ 'filter-editor.h',
+ 'filter-editor.c',
+ 'ldap-search-page.h',
+ 'ldap-search-page.c',
+ 'vtable-dialog.h',
+ 'vtable-dialog.c'
+ ])
+
+
+ldap_perspective_marshalls = gnome_module.genmarshal('perspective-marshal',prefix : '_ldap_marshal',
+ sources : 'marshal.list')
+
+ldap_perspective_sources += [
+ ldap_perspective_marshalls
+ ]
\ No newline at end of file
diff --git a/tools/browser/meson.build b/tools/browser/meson.build
index 207393359..403288aca 100644
--- a/tools/browser/meson.build
+++ b/tools/browser/meson.build
@@ -7,12 +7,18 @@ subdir('schema-browser')
subdir('query-exec')
subdir('data-manager')
+if ldap_found
+subdir('ldap-browser')
+gda_browser_sources += ldap_perspective_sources
+browser_deps += inc_ldapbrowserdir_dep
+endif
+
if goocanvas_dep.found()
subdir('canvas')
gda_browser_sources += canvas_sources
endif
-gda_browser_sources += perspective_sources
+gda_browser_sources += dummy_perspective_sources
gda_browser_sources += schema_sources
gda_browser_sources += query_exec_sources
gda_browser_sources += data_manager_sources
diff --git a/tools/browser/mgr-favorites.c b/tools/browser/mgr-favorites.c
index 33349ad9d..d264f4768 100644
--- a/tools/browser/mgr-favorites.c
+++ b/tools/browser/mgr-favorites.c
@@ -353,7 +353,7 @@ hash_for_existing_nodes (const GSList *nodes)
return hash;
}
-//static gboolean icons_resol_cb (MgrFavorites *mgr);
+static gboolean icons_resol_cb (MgrFavorites *mgr);
static GSList *
mgr_favorites_update_children (GdaTreeManager *manager, GdaTreeNode *node, const GSList *children_nodes,
@@ -780,41 +780,41 @@ mgr_favorites_update_children (GdaTreeManager *manager, GdaTreeNode *node, const
return g_slist_reverse (nodes_list);
}
-//#ifdef HAVE_LDAP
-/* static gboolean */
-/* icons_resol_cb (MgrFavorites *mgr) */
-/* { */
-/* if (mgr->priv->icons_resol_timer == 0) */
-/* return FALSE; */
-/* if (mgr->priv->icons_resol_list) { */
-/* IconResolutionData *data; */
-/* data = (IconResolutionData*) mgr->priv->icons_resol_list->data; */
-/* mgr->priv->icons_resol_list = g_slist_delete_link (mgr->priv->icons_resol_list, */
-/* mgr->priv->icons_resol_list); */
-
-/* GdkPixbuf *pixbuf; */
-/* pixbuf = ui_connection_ldap_icon_for_dn (mgr->priv->tcnc, data->dn, NULL); */
-/* if (pixbuf) { */
-/* GValue *av; */
-/* av = gda_value_new (G_TYPE_OBJECT); */
-/* g_value_set_object (av, pixbuf); */
-/* gda_tree_node_set_node_attribute ((GdaTreeNode*) data->node, "icon", av, NULL); */
-/* gda_value_free (av); */
-/* } */
-/* icon_resolution_data_free (data); */
-/* } */
-
-/* if (! mgr->priv->icons_resol_list) { */
-/* mgr->priv->icons_resol_timer = 0; */
-/* return FALSE; */
-/* } */
-/* else */
-/* return TRUE; */
-/* } */
-//#else
-//static gboolean
-/* icons_resol_cb (MgrFavorites *mgr) */
-/* { */
-/* return FALSE; */
-/* } */
-//#endif
+#ifdef HAVE_LDAP
+static gboolean
+icons_resol_cb (MgrFavorites *mgr)
+{
+ if (mgr->priv->icons_resol_timer == 0)
+ return FALSE;
+ if (mgr->priv->icons_resol_list) {
+ IconResolutionData *data;
+ data = (IconResolutionData*) mgr->priv->icons_resol_list->data;
+ mgr->priv->icons_resol_list = g_slist_delete_link (mgr->priv->icons_resol_list,
+ mgr->priv->icons_resol_list);
+
+ GdkPixbuf *pixbuf;
+ pixbuf = ui_connection_ldap_icon_for_dn (mgr->priv->tcnc, data->dn, NULL);
+ if (pixbuf) {
+ GValue *av;
+ av = gda_value_new (G_TYPE_OBJECT);
+ g_value_set_object (av, pixbuf);
+ gda_tree_node_set_node_attribute ((GdaTreeNode*) data->node, "icon", av, NULL);
+ gda_value_free (av);
+ }
+ icon_resolution_data_free (data);
+ }
+
+ if (! mgr->priv->icons_resol_list) {
+ mgr->priv->icons_resol_timer = 0;
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+#else
+static gboolean
+icons_resol_cb (MgrFavorites *mgr)
+{
+ return FALSE;
+}
+#endif
diff --git a/tools/browser/ui-formgrid.c b/tools/browser/ui-formgrid.c
index b8c230ab8..16201712b 100644
--- a/tools/browser/ui-formgrid.c
+++ b/tools/browser/ui-formgrid.c
@@ -606,18 +606,19 @@ action_executed_holder_changed_cb (G_GNUC_UNUSED GdaSet *params, G_GNUC_UNUSED G
GError *error = NULL;
gda_data_model_freeze (aed->model);
- if (!t_connection_rerun_select (aed->tcnc, aed->model, &error)) {
- GtkWidget *toplevel;
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (aed->formgrid));
- ui_show_error (GTK_WINDOW (toplevel),
- _("Error executing query:\n%s"), error->message ? error->message : _("No
detail"));
- g_clear_error (&error);
- gda_data_model_thaw (aed->model);
- }
- else {
- gda_data_model_thaw (aed->model);
- gda_data_model_reset (aed->model);
- }
+ // FIXME: Use a GdaDataModelSelect instead
+ /* if (!t_connection_rerun_select (aed->tcnc, aed->model, &error)) { */
+ /* GtkWidget *toplevel; */
+ /* toplevel = gtk_widget_get_toplevel (GTK_WIDGET (aed->formgrid)); */
+ /* ui_show_error (GTK_WINDOW (toplevel), */
+ /* _("Error executing query:\n%s"), error->message ? error->message : _("No
detail")); */
+ /* g_clear_error (&error); */
+ /* gda_data_model_thaw (aed->model); */
+ /* } */
+ /* else { */
+ /* gda_data_model_thaw (aed->model); */
+ /* gda_data_model_reset (aed->model); */
+ /* } */
}
static void
diff --git a/tools/common/t-connection.c b/tools/common/t-connection.c
index b6db561c4..113050ec0 100644
--- a/tools/common/t-connection.c
+++ b/tools/common/t-connection.c
@@ -1453,27 +1453,6 @@ t_connection_execute_statement (TConnection *tcnc,
return obj;
}
-/**
- * t_connection_rerun_select
- * @tcnc: a #TConnection object
- * @model: a #GdaDataModel, which has to ba a #GdaDataSelect
- * @error: a place to store errors, or %NULL
- *
- * Re-execute @model
- *
- * Returns: %TRUE if no error occurred
- */
-gboolean
-t_connection_rerun_select (TConnection *tcnc,
- GdaDataModel *model,
- GError **error)
-{
- g_return_val_if_fail (T_IS_CONNECTION (tcnc), FALSE);
- g_return_val_if_fail (GDA_IS_DATA_SELECT (model), FALSE);
-
- return gda_data_select_rerun (GDA_DATA_SELECT (model), error);
-}
-
/**
* t_connection_normalize_sql_statement
* @tcnc: a #TConnection
diff --git a/tools/common/t-connection.h b/tools/common/t-connection.h
index 313f29ea2..e41283fa3 100644
--- a/tools/common/t-connection.h
+++ b/tools/common/t-connection.h
@@ -136,9 +136,6 @@ GObject *t_connection_execute_statement (TConnection *tcnc,
GdaStatementModelUsage model_usage,
GdaSet **last_insert_row,
GError **error);
-gboolean t_connection_rerun_select (TConnection *tcnc,
- GdaDataModel *model,
- GError **error);
void t_connection_set_busy_state (TConnection *bcnc, gboolean busy, const gchar *busy_reason);
gboolean t_connection_normalize_sql_statement(TConnection *tcnc,
GdaSqlStatement *sqlst, GError **error);
diff --git a/tools/meson.build b/tools/meson.build
index 5e9ab31fe..ae6a38d48 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -32,6 +32,19 @@ if soup_dep.found()
endif
+tools_cargs = [
+ '-include',
+ meson.build_root() + '/config.h',
+ '-DROOT_DIR="'+meson.source_root()+'"',
+ '-DIS_BROWSER',
+ '-DHAVE_GTK_CLASSES'
+ ]
+if ldap_found
+tools_cargs += [
+ '-DHAVE_LDAP'
+ ]
+endif
+
gda_sql = executable('gda-sql-'+project_api_version,
gda_sql_sources,
link_with: libgda,
@@ -134,13 +147,7 @@ executable('org.gnome.gda.Browser',
libgdaui
],
dependencies: browser_deps,
- c_args: [
- '-include',
- meson.build_root() + '/config.h',
- '-DROOT_DIR="'+meson.source_root()+'"',
- '-DIS_BROWSER',
- '-DHAVE_GTK_CLASSES'
- ],
+ c_args: tools_cargs,
link_args: gda_browser_link_args,
install: true
)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]