[libgda] GdaBrowser: misc corrections
- From: Vivien Malerba <vivien src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgda] GdaBrowser: misc corrections
- Date: Tue, 29 Sep 2009 19:28:02 +0000 (UTC)
commit a2fd2277c17ced73a7394c11dbe54557a25f4c47
Author: Vivien Malerba <malerba gnome-db org>
Date: Tue Sep 29 20:41:59 2009 +0200
GdaBrowser: misc corrections
tools/browser/browser-connection.c | 17 +++++++------
tools/browser/canvas/browser-canvas-db-relations.c | 24 +++++++++++++++-----
tools/browser/schema-browser/table-columns.c | 10 +++++--
tools/browser/schema-browser/table-relations.c | 7 ++++-
4 files changed, 39 insertions(+), 19 deletions(-)
---
diff --git a/tools/browser/browser-connection.c b/tools/browser/browser-connection.c
index b29fe04..695f3ce 100644
--- a/tools/browser/browser-connection.c
+++ b/tools/browser/browser-connection.c
@@ -368,11 +368,16 @@ check_for_wrapper_result (BrowserConnection *bcnc)
break;
}
case JOB_TYPE_META_STRUCT_SYNC: {
+ g_mutex_lock (bcnc->priv->p_mstruct_mutex);
+ GdaMetaStruct *old_mstruct;
+ old_mstruct = bcnc->priv->mstruct;
+ bcnc->priv->mstruct = bcnc->priv->p_mstruct;
+ bcnc->priv->p_mstruct = NULL;
+ if (old_mstruct)
+ g_object_unref (old_mstruct);
#ifdef GDA_DEBUG_NO
GSList *all, *list;
- g_mutex_lock (bcnc->priv->p_mstruct_mutex);
- all = gda_meta_struct_get_all_db_objects (bcnc->priv->p_mstruct);
- g_mutex_unlock (bcnc->priv->p_mstruct_mutex);
+ all = gda_meta_struct_get_all_db_objects (bcnc->priv->mstruct);
for (list = all; list; list = list->next) {
GdaMetaDbObject *dbo = (GdaMetaDbObject *) list->data;
g_print ("DBO, Type %d: %s\n", dbo->obj_type,
@@ -380,11 +385,7 @@ check_for_wrapper_result (BrowserConnection *bcnc)
}
g_slist_free (all);
#endif
- g_mutex_lock (bcnc->priv->p_mstruct_mutex);
- if (bcnc->priv->mstruct)
- g_object_unref (bcnc->priv->mstruct);
- bcnc->priv->mstruct = bcnc->priv->p_mstruct;
- bcnc->priv->p_mstruct = NULL;
+
g_signal_emit (bcnc, browser_connection_signals [META_CHANGED], 0, bcnc->priv->mstruct);
g_mutex_unlock (bcnc->priv->p_mstruct_mutex);
break;
diff --git a/tools/browser/canvas/browser-canvas-db-relations.c b/tools/browser/canvas/browser-canvas-db-relations.c
index 947cd23..faeb5d7 100644
--- a/tools/browser/canvas/browser-canvas-db-relations.c
+++ b/tools/browser/canvas/browser-canvas-db-relations.c
@@ -161,17 +161,22 @@ browser_canvas_db_relations_set_property (GObject *object,
canvas = BROWSER_CANVAS_DB_RELATIONS (object);
if (canvas->priv) {
switch (param_id) {
- case PROP_META_STRUCT:
- if (canvas->priv->mstruct)
- clean_canvas_items (BROWSER_CANVAS (canvas));
+ case PROP_META_STRUCT: {
+ GdaMetaStruct *mstruct = g_value_get_object (value);
+ if (mstruct)
+ g_object_ref (mstruct);
- canvas->priv->mstruct = g_value_get_object (value);
- if (canvas->priv->mstruct)
- g_object_ref (canvas->priv->mstruct);
+ if (canvas->priv->mstruct) {
+ clean_canvas_items (BROWSER_CANVAS (canvas));
+ g_object_unref (canvas->priv->mstruct);
+ canvas->priv->mstruct = NULL;
+ }
+ canvas->priv->mstruct = mstruct;
if (canvas->priv->cloud)
objects_cloud_set_meta_struct (canvas->priv->cloud, canvas->priv->mstruct);
break;
}
+ }
}
}
@@ -307,6 +312,13 @@ static void
clean_canvas_items (BrowserCanvas *canvas)
{
BrowserCanvasDbRelations *dbrel = BROWSER_CANVAS_DB_RELATIONS (canvas);
+ GSList *clist, *list;
+
+ /* remove canvas item */
+ clist = g_slist_copy (canvas->priv->items);
+ for (list = clist; list; list = list->next)
+ goo_canvas_item_remove (GOO_CANVAS_ITEM (list->data));
+ g_slist_free (clist);
/* clean memory */
g_hash_table_destroy (dbrel->priv->hash_tables);
diff --git a/tools/browser/schema-browser/table-columns.c b/tools/browser/schema-browser/table-columns.c
index 8156f72..380c821 100644
--- a/tools/browser/schema-browser/table-columns.c
+++ b/tools/browser/schema-browser/table-columns.c
@@ -92,8 +92,11 @@ table_columns_dispose (GObject *object)
g_source_remove (tcolumns->priv->idle_update_columns);
if (tcolumns->priv->columns_tree)
g_object_unref (tcolumns->priv->columns_tree);
- if (tcolumns->priv->bcnc)
+ if (tcolumns->priv->bcnc) {
+ g_signal_handlers_disconnect_by_func (tcolumns->priv->bcnc,
+ G_CALLBACK (meta_changed_cb), tcolumns);
g_object_unref (tcolumns->priv->bcnc);
+ }
g_free (tcolumns->priv);
tcolumns->priv = NULL;
}
@@ -224,6 +227,7 @@ meta_changed_cb (BrowserConnection *bcnc, GdaMetaStruct *mstruct, TableColumns *
gda_value_free (v1);
gda_value_free (v2);
gda_value_free (v3);
+ continue;
}
gtk_text_buffer_insert_with_tags_by_name (tbuffer,
¤t,
@@ -598,8 +602,8 @@ follow_if_link (GtkWidget *text_view, GtkTextIter *iter, TableColumns *tcolumns)
table_name = g_object_get_data (G_OBJECT (tag), "table_name");
table_short_name = g_object_get_data (G_OBJECT (tag), "table_short_name");
- bpers = browser_find_parent_widget (GTK_WIDGET (tcolumns),
- TYPE_SCHEMA_BROWSER_PERSPECTIVE);
+ bpers = SCHEMA_BROWSER_PERSPECTIVE (browser_find_parent_widget (GTK_WIDGET (tcolumns),
+ TYPE_SCHEMA_BROWSER_PERSPECTIVE));
if (table_name && table_schema && table_short_name && bpers) {
schema_browser_perspective_display_table_info (bpers,
table_schema,
diff --git a/tools/browser/schema-browser/table-relations.c b/tools/browser/schema-browser/table-relations.c
index 414671f..bef1eab 100644
--- a/tools/browser/schema-browser/table-relations.c
+++ b/tools/browser/schema-browser/table-relations.c
@@ -84,8 +84,11 @@ table_relations_dispose (GObject *object)
/* free memory */
if (trels->priv) {
- if (trels->priv->bcnc)
+ if (trels->priv->bcnc) {
+ g_signal_handlers_disconnect_by_func (trels->priv->bcnc,
+ G_CALLBACK (meta_changed_cb), trels);
g_object_unref (trels->priv->bcnc);
+ }
g_free (trels->priv);
trels->priv = NULL;
}
@@ -115,7 +118,6 @@ table_relations_get_type (void)
return type;
}
-
static void
meta_changed_cb (BrowserConnection *bcnc, GdaMetaStruct *mstruct, TableRelations *trels)
{
@@ -157,6 +159,7 @@ meta_changed_cb (BrowserConnection *bcnc, GdaMetaStruct *mstruct, TableRelations
GdaMetaTableForeignKey *fkey = (GdaMetaTableForeignKey*) list->data;
if (! trels->priv->all_schemas &&
+ (fkey->depend_on->obj_type != GDA_META_DB_UNKNOWN) &&
! strcmp (fkey->depend_on->obj_short_name, fkey->depend_on->obj_full_name))
continue;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]