aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2002-05-27 00:46:49 +0800
committerJP Rosevear <jpr@src.gnome.org>2002-05-27 00:46:49 +0800
commita1d69a1b83b4a1de9f54fef9a4e0da7703de9a55 (patch)
tree9930ac4b8d85e1712a79fec7dbae9950c78fa1c3
parentfb1d17d150cb5178ca1d63431958d3df9dfc60b3 (diff)
downloadgsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar.gz
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar.bz2
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar.lz
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar.xz
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.tar.zst
gsoc2013-evolution-a1d69a1b83b4a1de9f54fef9a4e0da7703de9a55.zip
if there are remaining items, return false (foreach_close_cb): don't
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 * gui/e-comp-editor-registry.h: update proto * gui/component-factory.c (request_quit): return a boolean indicating if everything was closed * gui/dialogs/comp-editor.h: update proto * gui/dialogs/comp-editor.c (comp_editor_close): return true if the editor was closed, false otherwise svn path=/trunk/; revision=17019
-rw-r--r--calendar/ChangeLog16
-rw-r--r--calendar/gui/calendar-component.c4
-rw-r--r--calendar/gui/component-factory.c4
-rw-r--r--calendar/gui/dialogs/comp-editor.c13
-rw-r--r--calendar/gui/dialogs/comp-editor.h2
-rw-r--r--calendar/gui/e-comp-editor-registry.c11
-rw-r--r--calendar/gui/e-comp-editor-registry.h2
7 files changed, 37 insertions, 15 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index c682b7a0c1..225f7b076a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,21 @@
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
+
+ * gui/e-comp-editor-registry.h: update proto
+
+ * gui/component-factory.c (request_quit): return a boolean
+ indicating if everything was closed
+
+ * gui/dialogs/comp-editor.h: update proto
+
+ * gui/dialogs/comp-editor.c (comp_editor_close): return true if
+ the editor was closed, false otherwise
+
+2002-05-26 JP Rosevear <jpr@ximian.com>
+
* gui/e-comp-editor-registry.[hc]: a registry of comp editors so
we can close them all centrally
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index f1d09b90ed..71c52f9c7c 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -472,9 +472,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
static gboolean
request_quit (EvolutionShellComponent *shell_component, void *closure)
{
- e_comp_editor_registry_close_all (comp_editor_registry);
-
- return TRUE;
+ return e_comp_editor_registry_close_all (comp_editor_registry);
}
static GList *shells = NULL;
diff --git a/calendar/gui/component-factory.c b/calendar/gui/component-factory.c
index f1d09b90ed..71c52f9c7c 100644
--- a/calendar/gui/component-factory.c
+++ b/calendar/gui/component-factory.c
@@ -472,9 +472,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
static gboolean
request_quit (EvolutionShellComponent *shell_component, void *closure)
{
- e_comp_editor_registry_close_all (comp_editor_registry);
-
- return TRUE;
+ return e_comp_editor_registry_close_all (comp_editor_registry);
}
static GList *shells = NULL;
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 21f5e1c9f3..18ca46af27 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -978,16 +978,21 @@ comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
klass->send_comp (editor, method);
}
-void
+gboolean
comp_editor_close (CompEditor *editor)
{
- g_return_if_fail (editor != NULL);
- g_return_if_fail (IS_COMP_EDITOR (editor));
+ gboolean close;
+
+ g_return_val_if_fail (editor != NULL, FALSE);
+ g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE);
commit_all_fields (editor);
- if (prompt_to_save_changes (editor, TRUE))
+ close = prompt_to_save_changes (editor, TRUE);
+ if (close)
close_dialog (editor);
+
+ return close;
}
/**
diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h
index 9297526e48..db4a407e25 100644
--- a/calendar/gui/dialogs/comp-editor.h
+++ b/calendar/gui/dialogs/comp-editor.h
@@ -83,7 +83,7 @@ gboolean comp_editor_save_comp (CompEditor *editor,
void comp_editor_delete_comp (CompEditor *editor);
void comp_editor_send_comp (CompEditor *editor,
CalComponentItipMethod method);
-void comp_editor_close (CompEditor *editor);
+gboolean comp_editor_close (CompEditor *editor);
void comp_editor_merge_ui (CompEditor *editor,
const char *filename,
BonoboUIVerb *verbs,
diff --git a/calendar/gui/e-comp-editor-registry.c b/calendar/gui/e-comp-editor-registry.c
index 4385cb1a84..46548a57c6 100644
--- a/calendar/gui/e-comp-editor-registry.c
+++ b/calendar/gui/e-comp-editor-registry.c
@@ -171,15 +171,16 @@ foreach_close_cb (gpointer key, gpointer value, gpointer data)
gtk_signal_disconnect_by_data (GTK_OBJECT (rdata->editor), data);
comp_editor_focus (rdata->editor);
- comp_editor_close (rdata->editor);
-
+ if (!comp_editor_close (rdata->editor))
+ return FALSE;
+
g_free (rdata->uid);
g_free (rdata);
return TRUE;
}
-void
+gboolean
e_comp_editor_registry_close_all (ECompEditorRegistry *reg)
{
ECompEditorRegistryPrivate *priv;
@@ -190,6 +191,10 @@ e_comp_editor_registry_close_all (ECompEditorRegistry *reg)
priv = reg->priv;
g_hash_table_foreach_remove (priv->editors, foreach_close_cb, reg);
+ if (g_hash_table_size (priv->editors) != 0)
+ return FALSE;
+
+ return TRUE;
}
static void
diff --git a/calendar/gui/e-comp-editor-registry.h b/calendar/gui/e-comp-editor-registry.h
index 13833e2357..dfcc1b21bc 100644
--- a/calendar/gui/e-comp-editor-registry.h
+++ b/calendar/gui/e-comp-editor-registry.h
@@ -68,7 +68,7 @@ void e_comp_editor_registry_add (ECompEditorRegistry *reg,
gboolean remote);
CompEditor *e_comp_editor_registry_find (ECompEditorRegistry *reg,
const char *uid);
-void e_comp_editor_registry_close_all (ECompEditorRegistry *reg);
+gboolean e_comp_editor_registry_close_all (ECompEditorRegistry *reg);
#ifdef __cplusplus
}