aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/contact-editor
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui/contact-editor')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c37
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h20
2 files changed, 48 insertions, 9 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index fd0f14ddb5..a3dd431d2e 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -112,6 +112,8 @@ enum {
DYNAMIC_LIST_ADDRESS
};
+static GSList *all_contact_editors = NULL;
+
GtkType
e_contact_editor_get_type (void)
{
@@ -1489,6 +1491,14 @@ supported_fields_cb (EBook *book, EBookStatus status,
command_state_changed (ce);
}
+static void
+contact_editor_destroy_notify (void *data)
+{
+ EContactEditor *ce = E_CONTACT_EDITOR (data);
+
+ all_contact_editors = g_slist_remove (all_contact_editors, ce);
+}
+
EContactEditor *
e_contact_editor_new (EBook *book,
ECard *card,
@@ -1502,6 +1512,9 @@ e_contact_editor_new (EBook *book,
ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
+ all_contact_editors = g_slist_prepend (all_contact_editors, ce);
+ gtk_object_weakref (GTK_OBJECT (ce), contact_editor_destroy_notify, ce);
+
gtk_object_set (GTK_OBJECT (ce),
"book", book,
"card", card,
@@ -2746,3 +2759,27 @@ enable_widget (GtkWidget *widget, gboolean enabled)
else
gtk_widget_set_sensitive (widget, enabled);
}
+
+
+gboolean
+e_contact_editor_request_close_all (void)
+{
+ GSList *p;
+ GSList *pnext;
+ gboolean retval;
+
+ retval = TRUE;
+ for (p = all_contact_editors; p != NULL; p = pnext) {
+ pnext = p->next;
+
+ e_contact_editor_raise (E_CONTACT_EDITOR (p->data));
+ if (! prompt_to_save_changes (E_CONTACT_EDITOR (p->data))) {
+ retval = FALSE;
+ break;
+ }
+
+ close_dialog (E_CONTACT_EDITOR (p->data));
+ }
+
+ return retval;
+}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index 249640379b..0010182b99 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -117,17 +117,19 @@ struct _EContactEditorClass
void (* editor_closed) (EContactEditor *ce);
};
-EContactEditor *e_contact_editor_new (EBook *book,
- ECard *card,
- gboolean is_new_card,
- gboolean editable);
-GtkType e_contact_editor_get_type (void);
-void e_contact_editor_show (EContactEditor *editor);
-void e_contact_editor_close (EContactEditor *editor);
-void e_contact_editor_raise (EContactEditor *editor);
+EContactEditor *e_contact_editor_new (EBook *book,
+ ECard *card,
+ gboolean is_new_card,
+ gboolean editable);
+GtkType e_contact_editor_get_type (void);
+void e_contact_editor_show (EContactEditor *editor);
+void e_contact_editor_close (EContactEditor *editor);
+void e_contact_editor_raise (EContactEditor *editor);
-gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
+gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
+
+gboolean e_contact_editor_request_close_all (void);
#ifdef __cplusplus
}