[libgda/gtk3] GdaBrowser: add warning about foreign key definition errors
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/gtk3] GdaBrowser: add warning about foreign key definition errors
- Date: Thu, 16 Dec 2010 20:20:22 +0000 (UTC)
commit ee2ffc11e8fd746b4fee64f0d1827e4d25c59d79
Author: Vivien Malerba <malerba gnome-db org>
Date: Thu Dec 16 18:51:49 2010 +0100
GdaBrowser: add warning about foreign key definition errors
tools/browser/schema-browser/table-columns.c | 30 ++++++++++++++++++++++---
1 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/tools/browser/schema-browser/table-columns.c b/tools/browser/schema-browser/table-columns.c
index c8ff5aa..876a049 100644
--- a/tools/browser/schema-browser/table-columns.c
+++ b/tools/browser/schema-browser/table-columns.c
@@ -263,6 +263,29 @@ meta_changed_cb (G_GNUC_UNUSED BrowserConnection *bcnc, GdaMetaStruct *mstruct,
gtk_text_buffer_insert (tbuffer, ¤t, " ", -1);
gtk_text_buffer_insert (tbuffer, ¤t,
fk->ref_pk_names_array [i], -1);
+
+ if (fdbo->obj_type == GDA_META_DB_TABLE) {
+ GdaMetaTableColumn *fkcol, *refcol;
+ fkcol = g_slist_nth_data (mtable->columns,
+ fk->fk_cols_array[i] - 1);
+ refcol = g_slist_nth_data (GDA_META_TABLE (fdbo)->columns,
+ fk->ref_pk_cols_array[i] - 1);
+ if (fkcol && refcol &&
+ (fkcol->gtype != refcol->gtype)) {
+ /* incompatible FK types */
+ gchar *text;
+ text = g_strdup_printf (_("incompatible types: '%s' for the foreign key and '%s' for the referenced primary key"),
+ fkcol->column_type,
+ refcol->column_type);
+ gtk_text_buffer_insert (tbuffer, ¤t, " ", -1);
+ gtk_text_buffer_insert_with_tags_by_name (tbuffer,
+ ¤t,
+ text,
+ -1,
+ "warning", NULL);
+ g_free (text);
+ }
+ }
}
gtk_text_buffer_insert (tbuffer, ¤t, "\n\n", -1);
@@ -523,14 +546,13 @@ table_columns_new (TableInfo *tinfo)
gtk_text_buffer_set_text (tcolumns->priv->constraints, "aa", -1);
gtk_widget_show_all (vbox);
- gtk_text_buffer_create_tag (tcolumns->priv->constraints, "header",
- "weight", PANGO_WEIGHT_BOLD,
- "foreground", "red", NULL);
-
gtk_text_buffer_create_tag (tcolumns->priv->constraints, "section",
"weight", PANGO_WEIGHT_BOLD,
"foreground", "blue", NULL);
+ gtk_text_buffer_create_tag (tcolumns->priv->constraints, "warning",
+ "foreground", "red", NULL);
+
g_signal_connect (textview, "key-press-event",
G_CALLBACK (key_press_event), tcolumns);
g_signal_connect (textview, "event-after",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]