aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/ChangeLog15
-rw-r--r--calendar/gui/dialogs/comp-editor.c13
-rw-r--r--calendar/gui/dialogs/comp-editor.h1
-rw-r--r--calendar/gui/e-comp-editor-registry.c21
4 files changed, 39 insertions, 11 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 225f7b076a..de08d34644 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,20 @@
2002-05-26 JP Rosevear <jpr@ximian.com>
+ * gui/dialogs/comp-editor.h: update proto
+
+ * gui/dialogs/comp-editor.c (comp_editor_get_comp): new function
+ to get base comp
+
+ * gui/e-comp-editor-registry.c (e_comp_editor_registry_add): get
+ the base comp, not the current comp, don't unref it
+ (foreach_close_cb): block the signal, unblock it if the editor
+ could not be closed
+ (e_comp_editor_registry_close_all): fix preconditions
+ (editor_destroy_cb): get the base comp, not the current comp,
+ don't unref it
+
+2002-05-26 JP Rosevear <jpr@ximian.com>
+
* gui/e-comp-editor-registry.c (e_comp_editor_registry_close_all):
if there are remaining items, return false
(foreach_close_cb): don't remove the item if it couldn't be closed
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 18ca46af27..3e245a0c98 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -913,6 +913,19 @@ comp_editor_edit_comp (CompEditor *editor, CalComponent *comp)
}
CalComponent *
+comp_editor_get_comp (CompEditor *editor)
+{
+ CompEditorPrivate *priv;
+
+ g_return_val_if_fail (editor != NULL, NULL);
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL);
+
+ priv = editor->priv;
+
+ return priv->comp;
+}
+
+CalComponent *
comp_editor_get_current_comp (CompEditor *editor)
{
CompEditorPrivate *priv;
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index db4a407e25..6772f135e8 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -77,6 +77,7 @@ void comp_editor_set_cal_client (CompEditor *editor,
CalClient *comp_editor_get_cal_client (CompEditor *editor);
void comp_editor_edit_comp (CompEditor *ee,
CalComponent *comp);
+CalComponent *comp_editor_get_comp (CompEditor *editor);
CalComponent *comp_editor_get_current_comp (CompEditor *editor);
gboolean comp_editor_save_comp (CompEditor *editor,
gboolean send);
diff --git a/calendar/gui/e-comp-editor-registry.c b/calendar/gui/e-comp-editor-registry.c
index 46548a57c6..f619a1d0d1 100644
--- a/calendar/gui/e-comp-editor-registry.c
+++ b/calendar/gui/e-comp-editor-registry.c
@@ -128,7 +128,7 @@ e_comp_editor_registry_add (ECompEditorRegistry *reg, CompEditor *editor, gboole
priv = reg->priv;
- comp = comp_editor_get_current_comp (editor);
+ comp = comp_editor_get_comp (editor);
cal_component_get_uid (comp, &uid);
rdata = g_new0 (ECompEditorRegistryData, 1);
@@ -138,8 +138,7 @@ e_comp_editor_registry_add (ECompEditorRegistry *reg, CompEditor *editor, gboole
g_hash_table_insert (priv->editors, rdata->uid, rdata);
gtk_signal_connect (GTK_OBJECT (editor), "destroy", editor_destroy_cb, reg);
-
- gtk_object_unref (GTK_OBJECT (comp));
+
}
CompEditor *
@@ -168,12 +167,14 @@ foreach_close_cb (gpointer key, gpointer value, gpointer data)
rdata = value;
- gtk_signal_disconnect_by_data (GTK_OBJECT (rdata->editor), data);
+ gtk_signal_handler_block_by_data (GTK_OBJECT (rdata->editor), data);
comp_editor_focus (rdata->editor);
- if (!comp_editor_close (rdata->editor))
+ if (!comp_editor_close (rdata->editor)) {
+ gtk_signal_handler_unblock_by_data (GTK_OBJECT (rdata->editor), data);
return FALSE;
-
+ }
+
g_free (rdata->uid);
g_free (rdata);
@@ -185,8 +186,8 @@ e_comp_editor_registry_close_all (ECompEditorRegistry *reg)
{
ECompEditorRegistryPrivate *priv;
- g_return_if_fail (reg != NULL);
- g_return_if_fail (E_IS_COMP_EDITOR_REGISTRY (reg));
+ g_return_val_if_fail (reg != NULL, FALSE);
+ g_return_val_if_fail (E_IS_COMP_EDITOR_REGISTRY (reg), FALSE);
priv = reg->priv;
@@ -209,7 +210,7 @@ editor_destroy_cb (GtkWidget *widget, gpointer data)
reg = E_COMP_EDITOR_REGISTRY (data);
priv = reg->priv;
- comp = comp_editor_get_current_comp (COMP_EDITOR (widget));
+ comp = comp_editor_get_comp (COMP_EDITOR (widget));
cal_component_get_uid (comp, &uid);
rdata = g_hash_table_lookup (priv->editors, uid);
@@ -218,7 +219,5 @@ editor_destroy_cb (GtkWidget *widget, gpointer data)
g_hash_table_remove (priv->editors, rdata->uid);
g_free (rdata->uid);
g_free (rdata);
-
- gtk_object_unref (GTK_OBJECT (comp));
}